Post
Topic
Board Biete
Re: [GB] USB ASIC miner - closed and completed
by
Dunkelheit667
on 19/06/2013, 00:32:39 UTC
Update June 23rd - some additional stuff at the bottom.
Update June 24th - added how to update cgminer.



Mr. postman brought a second Raspberry today. Time to mess around with cgminer 3.2.2 and Block Erupter USBs. Wink jFYI, as expected it's working fine with Arch Linux, no SICK- or ZOMBIE-issues as seen on Raspbian wheezy. If you're interested and give it a shot, here you go... 30 minutes fun!



Download the latest Arch Linux image for your Raspberry:
http://downloads.raspberrypi.org/images/archlinuxarm/archlinux-hf-2013-06-15/archlinux-hf-2013-06-15.img.zip

Extract the zip file and write the img-file with e.g. Win32 Disk Imager on your SD card. Eject the SD card and insert it into your Raspberry, connect your Block Erupter USB(s) as well, power the Raspberry on.

Wait a minute, login as user root with password root.

Give your puppy a cute host name:
Code:
hostnamectl set-hostname erupterpi

Perform a system upgrade (confirm with y if asked):
Code:
pacman -Syu

Install some packages we'll need (confirm with y if asked):
Code:
pacman -S git autoconf automake pkg-config gcc make screen

Clone cgminer from git:
Code:
git clone https://github.com/ckolivas/cgminer.git

Install cgminer (you might add additional configuration options for other devices in row 3, e.g. --enable-avalon):
Code:
cd cgminer
CFLAGS="-O2 -W -Wall"
./autogen.sh --enable-icarus
make clean
make install
cd ..

You're done. Use screen as usual, fire up cgminer, type in your pool, username, password, write the config-file, whatever you prefer at this point and see your cuties hashing. Smiley

Side note: With cgminer up an running this Linux is using ~55-60 MB RAM and it looks like there is no swap file used at all. Guess the SD card will last much longer than using Raspbian wheezy... Shocked



Updates June 23rd and 24th
As I've received several PMs with questions regarding Arch Linux, please find below some additional information that might help. Smiley

1) Wi-Fi setup
2) Autostart cgminer
3) Run a watchdog (automatic restart of your Raspberry in case it's stuck for any reason)
4) Update cgminer

Everything tested an running smoothly so far.

1) Wifi
Assuming that you're using a known as Raspberry compatible USB Wi-Fi adapter.

Connect the Wi-Fi adapter to your Raspberry, wait a minute. Create a config-file for your wireless network:
Code:
wifi-menu -o

This will start a little application. Select your wireless network (SSID) and enter the passphrase. The application will write a config-file in /etc/netctl. The name should be wlan0-YOURSSID. You can check if the file was created and it's name as well:
Code:
dir /etc/netctl

Now you can start your Wi-Fi connection and enable it:
Code:
netctl start wlan0-YOURSSID
netctl enable wlan0-YOURSSID

That's it.

2) Autostart cgminer
Ok, would be nice if cgminer starts automatically after rebooting your Raspberry? Here we go.

Before following the next steps, please make sure you've already tested cgminer is working fine in general on your Raspberry and you've written a config-file (to /root/.cgminer/cgminer.conf) with your pool settings using cgminer's menu. Ensure that cgminer is not running at the moment.

Create a service-file with nano:
Code:
nano /usr/lib/systemd/system/mycgminer.service

Copy & paste the following:
Code:
[Unit]
Description=mycgminer
Requires=ntpd.service
After=network.service

[Service]
Type=forking
ExecStart=/usr/bin/screen -dmS miner /usr/local/bin/cgminer -c /root/.cgminer/cgminer.conf
ExecEnd=/usr/bin/screen -r miner -X quit

[Install]
WantedBy=multi-user.target

Exit nano and save the file.

Enable and start the service:
Code:
systemctl enable mycgminer.service
systemctl start mycgminer.service

Please note it can take up to five minutes till cgminer starts (same when rebooting the Raspberry), be a little bit patient. Wink

Use screen -r miner to reattach the cgminer screen.

3) Run a watchdog (automatic restart of your Raspberry in case it's stuck for any reason)
You've used your Raspberry for nasty things and it's stuck? Too lazy to enter the second floor or basement fiddling around with the Raspberry power cable? Whoop, here we go!

Install the watchdog:
Code:
pacman -S watchdog

Configure the watchdog... Well, here it depends what kind of stuff you would like to monitor. You might e.g. add a ping to your router if your Wi-Fi connection is not stable etc. Please check man watchdog.conf for available options.

I've just enables the max-load-1 option, this means the Raspberry will restart in case it's stuck/under heavy load for some reason.

Modify the watchdog configuration-file using nano:
Code:
nano /etc/watchdog.conf

Remove the leading hash from options/features you would like to enable, e.g.:
Code:
# Uncomment to enable test. Setting one of these values to '0' disables it.
# These values will hopefully never reboot your machine during normal use
# (if your machine is really hung, the loadavg will go much higher than 25)
max-load-1              = 24
#max-load-5             = 18
#max-load-15            = 12

Exit nano and save the file.

Enable and start the service:
Code:
systemctl enable watchdog.service
systemctl start watchdog.service

If you want to test the watchdog, throw a fork bomb. Grin Your Raspberry should restart after some minutes.

4) Update cgminer
A new cgminer release is availble and you want to install it? No problem.

Notes: It's a good idea to create a backup of your Raspberry SD card before following the next steps, just in case... The command in row #1 will upgrade your whole system. This is not necessary at this point in time, but maybe a good idea. Remember if you have added additional configuration options for other devices (e.g. --enable-avalon), please add them again in row #7.

Code:
pacman -Syu
cd /root
rm -r cgminer
git clone https://github.com/ckolivas/cgminer.git
cd cgminer
CFLAGS="-O2 -W -Wall"
./autogen.sh --enable-icarus
make clean
systemctl stop mycgminer.service
make install
systemctl start mycgminer.service
cd ..