Like all of my projects I scoured Google and through the reading of many tutorials I was able to piece together the settings and configurations I needed. I was originally inspired by this article written by Lee Hutchinson URL = http://arstechnica.com/gadgets/2013/06/how-a-total-n00b-mined-700-in-bitcoins/ I had also read about the Raspberry Pi project and wanted to get one but couldn’t think of what I would do with it other than increase my dust collector collection, but with butterfly labs releasing their hardware I now had something to do with a Pi. Anyway here we go and remember “Don’t Panic.”
Getting the Pi up and going with an OS and connectivity:
I followed the first three Raspberry Pi lessons over at learn.adafruit, great site with other good tutorials. I don’t remember making any obscene changes to the steps in the lessons other than those to personalize my box like I did sudo apt-get install vim cuz I like it better than nano which most of the tutorial use.
Lesson 1. Preparing an SD Card for your Raspberry Pi URL = http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-and-sd-card-for-your-raspberry-pi
Lesson 2. First Time Configuration URL = http://learn.adafruit.com/adafruits-raspberry-pi-lesson-2-first-time-configuration
Lesson 3. Network Setup URL = http://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup
Setting up cgminer:
I started with the tutorial “Super Tutorial Raspberry Pi+Raspbian+CGMiner+TightVNC+WIFI at boot” URL = https://forums.butterflylabs.com/bitcoin-discussion/3238-super-tutorial-raspberry-pi-raspbian-cgminer-tightvnc-wifi-boot.html by jafc76. You can go back and forth between that one and mine but I will put everything I did here so you don’t really have to.
I skipped everything that was redundant from the adafruit lessons mentioned above like initial setup and network configuration. I actually skipped over his TightVNC section the first time I read this and cost me more time finding the right VNC combination, but it was here all along. I have included my VNC setup at the end of this so don’t worry. I put things in here in the order that I did them with the goal of getting the end result working first then move on to ease of admining the box.
UPDATE UPDATE UPDATE
I RECIEVED MY BUTTERFLY LABS JALAPENO SO THIS TUTORIAL SHOULD BE COMPLETE NOW
sudo apt-get update
sudo apt-get install build-essential git autoconf libtool libcurl4-openssl-dev libncurses5-dev pkg-config yasm make libusb-1.0-0-dev
Clone latest stable version of cgminer source files
git clone https://github.com/ckolivas/cgminer.git cgminer
sudo ./configure --enable-bflsc
sudo make install
Auto start cgminer
1. Make and edit the cgminer.conf file in the /cgminer directory by
sudo vim /cgminer/cgminer.conf
The cgminer.conf file is what holds all your mining account specifics. Mine looks like this … well sort of, I sanitized it so it doesn’t have my actual account names and passwords.
The slush pool has updated. You can get more info from the place I got it from, here. Basically they have added more operation sites so you can replace the URL with one that is geographically closer to you.
"pools" : [
"url" : "stratum+tcp://stratum.slushpool.com:3333",
"user" : "bartimaeus.worker1",
"pass" : "C0mpl3xP@$$w0rd"
"api-port" : "4028",
"expiry" : "120",
"hotplug" : "5",
"log" : "5",
"no-pool-disable" : true,
"queue" : "1",
"scan-time" : "60",
"shares" : "0",
"kernel-path" : "/usr/local/bin"
2. Edit the rc.local file
sudo vim /etc/init.d/rc.local
3. Go all the way to the bottom and add a new line
/cgminer/cgminer --config PATHTO-CGMINER.CONF
Mine looks like this
/cgminer/cgminer --config /cgminer/cgminer.conf
4. Wright quit that gem and reboot to test. At boot cgminer should be running the the background as root, which is good because you need root privs to access the ASIC device. If your Pi is configured like mine, which it will be if you keep following all my steps you will run headless most of the time cuz the kids have priority on what’s on the TV, then start up PUTTY and login then run TOP to see cgminer in the list. It won’t be taking up too much CPU, maybe like 1 – 2 %.
Now this is all good and you’re now mining but if you want to check your status you will need to like me ask permission to interrupt Caillou or The Wild Kratts, I won’t interrupt Phineas and Ferb cuz that show rocks! and switch the TV over to your Pi for a few seconds. I don’t like interrupting my kids so I figured there had to be a way to see the session that is configured to boot. I found others that wanted remote capability and they used VNC as the solution. I have used it before for other projects and it works well so I jumped on board but there were a few things that the other tutorials didn’t do or work for me so here is what I did.
I started with and followed a lot from the “Installing VNC” tutorial written by Simon Monk over at learn.adafruit URL = http://learn.adafruit.com/adafruit-raspberry-pi-lesson-7-remote-control-with-vnc/installing-vnc
You can use that tutorial and this one together, if you like switching back and forth or if you like to see nice screen shots, or you can just follow what I have I will make my section titles jive with Simon’s so if you need to you can correlate his steps with mine. I will make it a short and sweet as possible and include anything that gave me a hang up during my install.
sudo apt-get update
sudo apt-get install tightvncserver -y
4. Give the prompts what they ask for. Note that the password will be truncated (AKA shortened) to 8 characters so if you put in 123456789 VNC will shorten it to 12345678 so make sure you know how your password will be changed, or just do what I did and pick an 8 character password. If you mess up and forget or fat finger your password just do
sudo rm ~/.vnc/passwd
and redo step 4.
Using a VNC Client
This will come latter, IMO it doesn’t make since to put this right here, it’s better to test at the end.
Running VNC Server at Startup
I could not make VNC server startup the way I wanted to by following Simon … I couldn’t get it to start at all mostly. Unlike Simon’s and other tutorials this will allow you to connect to the user session that starts at boot not an alternate session that would intern run another cgminer instance and whatever else might be in “/etc/xdg/lxsession/LXDE/autostart”.
sudo vim /etc/rc.local
2. Find the line that is
su -l USERNAME -c startx
and comment it out with a “#” so it looks something like this
#su -l USERNAME -c startx
replace USERNAME with a valid username on your box.
3. Add a new line
su - USERNAME -c "/usr/bin/vncserver :1 -geometry 800x600 -depth 16 -pixelformat rgb565 > /tmp/vncserver.log 2>&1 &"
replace USERNAME with a valid username on your box. Mine looks like this
su - bartimaeus -c "/usr/bin/vncserver :1 -geometry 1280x768 -depth 16 -pixelfomat rgb565 > /tmp/vncserver.log 2>&1 &"
4. Write quit that bad boy and reboot to test.
Using a VNC Client (in the right place this time)
1. Open up your favorite VNC client, I like RealVNC’s VNC Viewer, and put in the hostname or IP of you Pi followed by a :1 in the VNC Server or host or whatever spot, mine looks like this
and click connect or go or open or whatever.
2. You might be prompted about the connection being unencrypted just click whatever is equivalent to the don’t bug me again box and click continue or ok or yes or whatever.
3. Enter the password you set up, remember its 8 characters long MAX.
4. If you followed everything right, and I wrote everything right, you should see the desktop with a terminal running cgminer. You should check top to make sure there is only one instance of cgminer running otherwise you just started a new user session and launched a new cgminer instance which won’t do you much good because they will argue over resources and do less work each.
Now that it all works you should follow good industry standard practices and make a backup of you SD card in the event you mess something up in the future or you have hardware issues or you want to make another one of these. At the very lease you should save a copy of this write up someplace local on your system in the even I take it down or something, not that I plan to but again you never know … isn’t that right Perry?
After having the thing run for over a year I was only successful in generating enough Bitcoins for about $40.00. I have since taken it offline.
After several months of not caring about Bitcoins, the mostly death of my phone, made me go look at my Bitcoin wallet. I was surprised to see that the value of Bitcoins had dramatically gone up so that what was once worth only $40.00 was now worth nearly $300.00. So I turned the JalapinoPi back on. Well I had to redo it so that it was working alongside my Weather Underground reporting. With that I ran back through all of this and verified / updated where necessary.