1

I'm using Ubuntu 16.04 and xmr-stak-portbin-linux.tar.gz

The miner when run manually with Nvidia GPU, runs without error, but gives error when run as a startup service.

Earlier, I was doing only CPU mining. I created a startup service xmr-service to run the miner at startup, which worked fine

[Unit]
Description=xmr-stak

[Service]
ExecStart=/usr/local/tmp/xmr-stak.sh -c "/usr/local/tmp/config.txt"
User=root

[Install]
WantedBy=multi-user.target
This was working fine at startup for CPU mining.

Now the system also had Nvidia Quadro K620 GPU but with no installed drivers. So I installed Nvidia drivers 384.81 and Cuda 9.0.176

Then I ran xmr-stak.sh manually. Following is the nvidia.txt that the miner generated.

"gpu_threads_conf" :
[
  // gpu: Quadro K620 architecture: 50
  //      memory: 1781/1995 MiB
  //      smx: 3
  { "index" : 0,
    "threads" : 90, "blocks" : 9,
    "bfactor" : 0, "bsleep" :  0,
    "affine_to_cpu" : false,
  },

],

The miner crashed, so I changed the parameters to following:

"gpu_threads_conf" :
[
  // gpu: Quadro K620 architecture: 50
  //      memory: 1781/1995 MiB
  //      smx: 3
  { "index" : 0,
    "threads" : 1, "blocks" : 1,
    "bfactor" : 8, "bsleep" :  25,
    "affine_to_cpu" : false,
  },

],

On again running the miner manually, the miner was running with these parameters.

Then I did

sudo systemctl daemon-reload
and restarted the system

On sudo systemctl status xmr-service , it shows following:

workstation xmr-stak.sh[795]: [2017-12-12 18:16:37] : Result accepted by the pool. 
workstation xmr-stak.sh[795]: [2017-12-12 18:16:39] : Result accepted by the pool. 
workstation xmr-stak.sh[795]: [2017-12-12 18:16:42] : Result accepted by the pool. 
workstation xmr-stak.sh[795]: [CUDA] Error gpu 0: </home/fireice/xmr-stak/xmrstak/backend/nvidia/nvcc_code/cuda_extra.cu>:244
workstation xmr-stak.sh[795]: terminate called after throwing an Instance of 'std::runttme_error'
workstation xmr-stak.sh[795]: what(): [CUDA] Error: the launch timed out and was terminated
workstation xmr-stak.sh[795]: /usr/local/tmp/xmr-stak.sh: line 3: 824 Aborted (core dumped) $SCRIPT_PATH/stak/ld-linux-x86-64.so.2 --library-path $SCRIPT_PATH/stak $SCRIPT_PATH/stak/xmr-stak $* 
workstation systemd[1]: xmr-stak.service: Main process exited, code=exited, status=134/n/a 
workstation systemd[1]: xmr-stak.service: Unit entered failed state. 
workstation systemd[1]: xmr-stak.service: Failed with result 'exit-code'. 

The miner when run manually with Nvidia GPU, runs without error, but gives error when run as a startup service. Also the startup service worked fine with only CPU.

What could be the problem?

1

I haven't played with my systemctl script in a while, but here are my notes. They are close to yours, except for my file name is xmr.service and there are two additional commands at the end. Hope this helps.


Create systemd startup script Create new file xmr.service in /etc/systemd/system

Add the following snippet:

[Unit]
Description=XMRig
After=network-online.target

[Service]
ExecStart=/PATH/TO/MINER

[Install]
WantedBy=multi-user.target

Perform these commands:

systemctl daemon-reload

systemctl start xmr.service

systemctl enable xmr.service

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.