Post
Topic
Board Hardware
Re: Who likes pod miners?
by
DM2008
on 24/02/2018, 04:10:51 UTC

Interesting - can you share how you did that? I usually go crazy trying to figure out the software setups and I'm trying a pi this time around

Here is what I did from a fresh install of Raspbian Stretch.  Feel free to comment.

1) Start by enabling ssh. Open a terminal:

Code:
sudo systemctl enable ssh
sudo systemctl start ssh

Ideally you should change the password for the pi user using the passwd command.

From here you can now run the pi headless and do everything remotely via ssh

2) An optional step that can prevent the pi from locking up after a while.

Code:
sudo nano /boot/cmdline.txt

add slub_debug=FPUZ to the existing line, do not add a new line.

3) Build cgminer - follow the steps on page 1 of the 2pac thread:
https://bitcointalk.org/index.php?topic=1764803.0

Code:
sudo apt-get update
sudo apt-get upgrade -y

sudo apt-get install -y build-essential git libusb-1.0-0-dev libusb-1.0-0 libcurl4-openssl-dev libncurses5-dev libudev-dev screen libtool automake pkg-config libjansson-dev

mkdir -p git/vthoang; cd git/vthoang
git clone https://github.com/vthoang/cgminer.git
cd cgminer

CFLAGS="-O2" ./autogen.sh --enable-gekko
make -j 2

Copy cgminer to /home/pi/cgminer (the location is up to you, you just need to adjust the path below if you change it)

Create /home/pi/cgminer.conf with your pool information and custom settings, here is an example:

Code:
{
"pools" : [
   {
      "url" : "stratum+tcp://pool.ckpool.org:3333",
      "user" : "1BURGERAXHH6Yi6LRybRJK7ybEm5m5HwTr",
      "pass" : "x"
   }
],

"gekko-terminus-freq" : "150",
"gekko-start-freq" : "100",
"gekko-step-freq" : "25",
"gekko-step-delay" : "15"
}

4) Setup a screen session to run at startup:

Create this file: /lib/systemd/system/cgminer.service
Code:
[Unit]
Description=cgminer
After=network.target

[Service]
Type=forking
User=pi

#Start:
# screen -dm creates detached session that forks.
#  use this with Type=forking
ExecStart=/usr/bin/screen -dmS cgminer /home/pi/cgminer --config /home/pi/cgminer.conf

#Stop:
# tell cgminer to quit (not screen), and screen will exit
ExecStop=/usr/bin/screen -S cgminer -X stuff 'q'

# or tell screen to quit and clobber cgminer - not best choice
#ExecStop=/usr/bin/screen -S cgminer -X quit
#Probably need a kill definition in case the miner is hung

#Reload:
# sending the string 'scy' (settings, restart, yes) to cgminer will
#  cause a restart which will re-read config file if using one
ExecReload=/usr/bin/screen -S cgminer -X stuff 'scy'

[Install]
WantedBy=multi-user.target

Then run:
Code:
sudo systemctl daemon-reload
sudo systemctl enable cgminer.service
sudo systemctl start cgminer.service

The screen setup  was a modification of instructions from https://techsparx.com/cryptocurrency/mining/setup-usb-miner-cgminer.html

If you want to check on things, you can ssh into the pi and type:
screen -r cgminer

This will reconnect you to the session running cgminer.

To disconnect and leave the screen session running, just type ‘ctrl-a d’ or ‘ctrl-a ctrl-d’