TP For Your Soul

Raspberry Pi: USB Block Erupter Mining

Background

I have done much searching around the net for how to get my Pi set up just they way I want it to mine my new ASICs. I’ve already posted about how to mine with BFGMiner on Windows 7, but the Pi was my ultimate goal because I’m one of those dudes who still shuts down his main PC at night.
I bought my Block Erupters with the intent of running them even after their hashrate gets left in the dust when more higher powered ASICs really kick the difficulty in the nuts, just because the power usage/heat is negligible and I could use them on my Raspberry Pi which does nothing cool except be an SNES arcade. Homebrewing a Wii sure changed that, and thus the Pi sat in the dark, powered off, all alone.

Software

General steps to take (not all are really in particular order)

Turn on SSH (if you want to – I am using it) by running sudo raspi-config

Make sure your USB hub AND wireless adapter (if you’re using one) is detected by the Pi. Run the command to see if your WiFi adapter and Hub show up: lsusb(My 3 Erupters are already running, so ignore those around the top)

Connect to WiFi via the shortcut on the desktop. It’ll make it easy to connect you to your AP and will connect to it by default when the system boots (even without login).

If you want the Pi to begin mining when it boots, create a script in /etc/init.d/ that will execute the mining command as a non-root user (WordPress is intent on screwing up the formatting, so make sure there’s no issues in copying or anything):

What this will do is start your command detached from any SSH session so that if you log out of your session, it will continue running. You can see if it’s running by using:screen -ls
You can attach your shell to it by using:screen -r MINER

Make this script executable:

chmod 755 /etc/init.d/mining.sh

Test to make sure your script runs:

/etc/init.d/mining.sh start

To stop the script, use:

/etc/init.d/mining.sh stop

Register your script to launch on boot (if you don’t do this, your script will be ignored):

sudo update-rc.d NameOfYourScript defaults

If, in the future, you want to remove this script from being registered, use: