fireice-uk / xmr-stak-cpu

Monero CPU miner
GNU General Public License v3.0
1.11k stars 478 forks source link

Setting XMR-STAK-CPU as startup service in Ubuntu 16.04 #423

Open AniketBhadane opened 7 years ago

AniketBhadane commented 7 years ago

I'm trying to setup xmr-stak-cpu as a startup background service on Ubuntu 16.04, but Ubuntu is not booting completely. Should I use systemd in Ubuntu 16.04 or rc.local? Here's what I did:

  1. sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev

  2. cd xmr-stak-cpu-master

  3. sudo cmake .

  4. sudo make install

  5. cd bin

  6. changed config.txt settings.

  7. sudo sysctl -w vm.nr_hugepages=128

  8. sudo gedit /etc/security/limits.conf

  9. added:

* soft memlock 262144 * hard memlock 262144

  1. sudo ./xmr-stak-cpu

Ran Successfully. Now I want to add it as a startup background service:

  1. cd /etc/init.d

  2. sudo gedit

  3. typed:

#!/bin/bash # /etc/init.d/miner echo password | sudo -S xmr-stak-cpu config.txt

  1. saved file as miner

  2. sudo update-rc.d miner defaults

  3. sudo chmod +x miner

  4. Rebooted machine

On rebooting, I'm getting following message on black screen:

/dev/sda1: clean, 432945/30269440 files, 4146215/121076480 blocks

https://i.stack.imgur.com/coTvz.png

And nothing happens after that. The miner is running in the background, I can see it on supportxmr dashboard. But on Ubuntu, only the above black screen is displayed with the above message.

How do I solve this? Is there any alternative way? How do you guys do it?

AniketBhadane commented 7 years ago

The problem was due to

* soft memlock 262144 * hard memlock 262144

On the black screen, I pressed Ctrl+Alt+F1, then

sudo vi /etc/security/limits.conf

removed the two lines, saved and rebooted.

Ubuntu rebooted normally.

Why do those 2 lines cause problem? Also alongwith the black screen, I was getting low graphics message.

chinf commented 7 years ago

I found the same issue with those wildcarded memlock lines (Ubuntu 16.04.3 LTS) - I worked around it by substituting the wildcard with the username of the user running the miner.

psychocrypt commented 7 years ago

Please link to the documentation whrer you copied the settings from.

chinf commented 7 years ago

I saw the memlock settings documented in the default config.txt.

nowheel commented 6 years ago

i make it: https://github.com/nowheel/xmr-stak-cpu-installer it's a xmr-stak-cpu installer for ubuntu 16.04/16.10, i don't make services for autostart but i configure it via crontab, try it, it's simple to use, please if you want to use it, read documentation, and, don't forget to buy me a beer.

BitRacer commented 6 years ago

I've had the same problem, I actually ended out doing a clean reinstall only to figure output was the memlock settings. Seema like this setting is excessive, I only have 64MB ram on my laptop