Page 1 of 2

Systemd Service Error

Posted: 2018/01/21 05:11:46
by supertight
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.

Re: Systemd Service Error

Posted: 2018/01/21 10:17:01
by TrevorH
Maybe a google search for "status=203/EXEC" might help? First hit for me was https://stackoverflow.com/questions/457 ... -directory

Re: Systemd Service Error

Posted: 2018/01/21 15:39:42
by supertight
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

Re: Systemd Service Error

Posted: 2018/01/21 16:09:49
by supertight
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.

Re: Systemd Service Error

Posted: 2018/01/21 16:20:46
by TrevorH
Your script is in the root directory? ExecStart =/bin/bash /xmr-miner.sh says it is.

Re: Systemd Service Error

Posted: 2018/01/21 17:59:05
by supertight
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.

Re: Systemd Service Error

Posted: 2018/01/21 18:32:50
by supertight
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

Re: Systemd Service Error

Posted: 2018/01/21 20:15:13
by hunter86_bg
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.

Re: Systemd Service Error

Posted: 2018/01/21 21:26:17
by supertight
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.

Re: Systemd Service Error

Posted: 2018/01/22 00:13:07
by supertight
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.