Systemd Service Error

General support questions
supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Systemd Service Error

Post by supertight » 2018/01/21 05:11:46

I'm having trouble setting up systemd service to automatically run the miner at startup. systemctl status is giving me the following.

Code: Select all

root@localhost /]# systemctl status xmr.service
● xmr.service - xmr-stak all in one miner
Loaded: loaded (/xmr.service; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sat 2018-01-20 >20:16:11 PST; 40min ago
Main PID: 1295 (code=exited, status=203/EXEC)
Jan 20 20:16:11 localhost.localdomain systemd[1]: Started xmr-miner.
Jan 20 20:16:11 localhost.localdomain systemd[1]: Starting xmr-miner...
Jan 20 20:16:11 localhost.localdomain systemd[1]: xmr.service: main process exited, code=exited, status=203/EXEC
Jan 20 20:16:11 localhost.localdomain systemd[1]: Unit xmr.service entered failed state.
Jan 20 20:16:11 localhost.localdomain systemd[1]: xmr.service failed.
I've searched around and can not find anything. This has been getting the better of me for several weeks.
Any point in the correct direction would be greatly appreciated. Thanks for reading.

User avatar
TrevorH
Forum Moderator
Posts: 23844
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Systemd Service Error

Post by TrevorH » 2018/01/21 10:17:01

Maybe a google search for "status=203/EXEC" might help? First hit for me was https://stackoverflow.com/questions/457 ... -directory
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: Systemd Service Error

Post by supertight » 2018/01/21 15:39:42

TrevorH wrote:Maybe a google search for "status=203/EXEC" might help? First hit for me was https://stackoverflow.com/questions/457 ... -directory
I've been googling the wrong thing for several weeks. Fudge.

Thank you, TrevorH

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: Systemd Service Error

Post by supertight » 2018/01/21 16:09:49

TrevorH wrote:Maybe a google search for "status=203/EXEC" might help? First hit for me was https://stackoverflow.com/questions/457 ... -directory
As suggested, I added /bin/bash to the ExecStart section.

# cat xmr.service

Code: Select all

[Unit]
Description = xmr-stak all in one miner
After = network.target

[Service]
ExecStart =/bin/bash /xmr-miner.sh

[Install]
WantedBy = multi-user.target
# cat xmr.sh

Code: Select all

#! /bin/bash
./xmr-stak
# systemctl enable xmr.service

Code: Select all

Failed to execute operation: No such file or directory
# systemctl status xmr.service

Code: Select all

● xmr.service - xmr-stak all in one miner
   Loaded: loaded (/xmr.service; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-01-21 07:48:46 PST; 1min 9s ago
  Process: 1300 ExecStart=/bin/bash /root/xmr-miner.sh (code=exited, status=127)
 Main PID: 1300 (code=exited, status=127)

Jan 21 07:48:46 localhost.localdomain systemd[1]: Started xmr-stak all in one...
Jan 21 07:48:46 localhost.localdomain systemd[1]: Starting xmr-stak all in on...
Jan 21 07:48:46 localhost.localdomain bash[1300]: /bin/bash: /root/xmr-miner....
Jan 21 07:48:46 localhost.localdomain systemd[1]: xmr.service: main process e...
Jan 21 07:48:46 localhost.localdomain systemd[1]: Unit xmr.service entered fa...
Jan 21 07:48:46 localhost.localdomain systemd[1]: xmr.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
I'm getting 'status=127' now.

User avatar
TrevorH
Forum Moderator
Posts: 23844
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Systemd Service Error

Post by TrevorH » 2018/01/21 16:20:46

Your script is in the root directory? ExecStart =/bin/bash /xmr-miner.sh says it is.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: Systemd Service Error

Post by supertight » 2018/01/21 17:59:05

TrevorH wrote:Your script is in the root directory? ExecStart =/bin/bash /xmr-miner.sh says it is.
Yes, Sir. I've changed the files around a little bit also while trying to get it working. here are the locations and updated config.

xmr.service is located in root. with a soft link in /etc/systemd/system/multi-user.target.wants/
# cat /xmr.service

Code: Select all

[Unit]
Description = xmr-stak all in one miner
After = network.target

[Service]
ExecStart =/bin/bash /xmr.sh

[Install]
WantedBy = multi-user.target
xmr.sh is located in root.
#cat /xmr.sh

Code: Select all

./#! /bin/bash
./home/xmr-stak/bin/xmr-stak
Still having the same errors.
# systemctl enable xmr.service
Failed to execute operation: No such file or directory
# systemctl status xmr.service
● xmr.service - xmr-stak all in one miner
Loaded: loaded (/xmr.service; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-01-21 09:16:31 PST; 42min ago
Main PID: 1299 (code=exited, status=126)

Jan 21 09:16:31 localhost.localdomain systemd[1]: Started xmr-stak all in one...
Jan 21 09:16:31 localhost.localdomain systemd[1]: Starting xmr-stak all in on...
Jan 21 09:16:31 localhost.localdomain bash[1299]: /home/xmr-stak/bin/xmr-stak...
Jan 21 09:16:31 localhost.localdomain systemd[1]: xmr.service: main process e...
Jan 21 09:16:31 localhost.localdomain systemd[1]: Unit xmr.service entered fa...
Jan 21 09:16:31 localhost.localdomain systemd[1]: xmr.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: Systemd Service Error

Post by supertight » 2018/01/21 18:32:50

supertight wrote:
TrevorH wrote:Your script is in the root directory? ExecStart =/bin/bash /xmr-miner.sh says it is.
Yes, Sir. I've changed the files around a little bit also while trying to get it working. here are the locations and updated config.

xmr.service is located in root. with a soft link in /etc/systemd/system/multi-user.target.wants/
# cat /xmr.service

Code: Select all

[Unit]
Description = xmr-stak all in one miner
After = network.target

[Service]
ExecStart =/bin/bash /xmr.sh

[Install]
WantedBy = multi-user.target
xmr.sh is located in root.
#cat /xmr.sh

Code: Select all

./#! /bin/bash
./home/xmr-stak/bin/xmr-stak
Still having the same errors.
# systemctl enable xmr.service
Failed to execute operation: No such file or directory
# systemctl status xmr.service
● xmr.service - xmr-stak all in one miner
Loaded: loaded (/xmr.service; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-01-21 09:16:31 PST; 42min ago
Main PID: 1299 (code=exited, status=126)

Jan 21 09:16:31 localhost.localdomain systemd[1]: Started xmr-stak all in one...
Jan 21 09:16:31 localhost.localdomain systemd[1]: Starting xmr-stak all in on...
Jan 21 09:16:31 localhost.localdomain bash[1299]: /home/xmr-stak/bin/xmr-stak...
Jan 21 09:16:31 localhost.localdomain systemd[1]: xmr.service: main process e...
Jan 21 09:16:31 localhost.localdomain systemd[1]: Unit xmr.service entered fa...
Jan 21 09:16:31 localhost.localdomain systemd[1]: xmr.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

Update. Changed things around again. Now getting 126.

New config =

# ll /etc/systemd/system/multi-user.target.wants/xmr.service

Code: Select all

lrwxrwxrwx 1 root root 30 Jan 21 10:21 /etc/systemd/system/multi-user.target.wants/xmr.service -> /home/xmr-stak/bin/xmr.service
# cat /home/xmr-stak/bin/xmr.service

Code: Select all

[Unit]
Description = xmr-miner
After = network.target

[Service]
ExecStart = /home/xmr-stak/bin/xmr-stak.sh
User=root
Group=root
WorkingDirectory=/home/xmr-stak/bin/

[Install]
WantedBy = multi-user.target
# cat /home/xmr-stak/bin/xmr.sh

Code: Select all

#! /bin/bash
./home/xmr-stak/bin/xmr-stak

hunter86_bg
Posts: 1411
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Systemd Service Error

Post by hunter86_bg » 2018/01/21 20:15:13

When you need to debug a systemd service , just add this to the [Service] stanza:

Code: Select all

Environment=SYSTEMD_LOG_LEVEL=debug
Reload systemd's daemon and restart the service, then you can check the journal for errors/warnings.

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: Systemd Service Error

Post by supertight » 2018/01/21 21:26:17

hunter86_bg wrote:When you need to debug a systemd service , just add this to the [Service] stanza:

Code: Select all

Environment=SYSTEMD_LOG_LEVEL=debug
Reload systemd's daemon and restart the service, then you can check the journal for errors/warnings.
Added the code to [service]. reloaded the daemon. ran the enable command.
**update**
# journalctl | grep xm

Code: Select all

Configuration file /home/xmr-stak/bin/xmr.service is marked executable. Please remove executable permission bits. Proceeding anyway.

supertight
Posts: 171
Joined: 2017/02/07 21:47:51

Re: Systemd Service Error

Post by supertight » 2018/01/22 00:13:07

Now status is showing

Code: Select all

 /home/xmr-stak/bin/xmr.sh: line 3: ./home/xmr-stak/bin/xmr-stak: No such file or directory
This is the proper directory. from /home/xmr-stak/bin/ I can run ./xmr-stak and the miner will start.
I don't understand why I'm getting no such file or directory.

Post Reply