Ubuntu Bitcoin Mining Guide for Radeon cards

Step 1: Download and Burn Ubuntu 12.04

Go to http://www.ubuntu.com/download/desktop and download Ubuntu 12.04 LTS

Burn the image file ‘ubuntu-12.04.2-desktop-i386.iso’ to a CD (or DVD). The image will work with a DVD being that it is under 700MB, but a DVD will work if you don’t have any CD’s around. If installing on a UBS, it is not necessary to burn the image to disk.

Before installing any software make absolutely certain that there is good airflow to the GPU cooling fans. Many of the things here will test your hardware. Follow at your own risk.


Step 2: Install Ubuntu

Use unetbootin http://unetbootin.sourceforge.net/ if you are booting from a UBS flash drive.

Insert the disk, or USB drive and complete the installation. You may be operating this without a hard drive, so the USB drive may be the installation.

NOTE: Remember to set the option to login automatically. If you want to change this option

sudo nano /etc/lightdm/lightdm.conf

add lines to file:



Step 3: Ensure Updates are Installed

Open a terminal window and run:

sudo apt-get update
sudo apt-get upgrade
sudo reboot


Step 4: install openssh-server and enable desktop sharing

sudo apt-get install openssh-server

Obtain your local IP address with:

ip addr show
4: virbr0: mtu 1500 qdisc noqueue state UNKNOWN
 link/ether cf:8f:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
 inet brd scope global virbr0
 inet6 XXX0::XXX:1X:fXX:11/XX scope link

Steps for connecting from a remote location come later. This is the local IP address good if you are connected to the same router as the server.

If you intend on using the ubuntu GUI then you need to enable desktop sharing. This can be done in Ubuntu itself, by searching for ‘desktop sharing’, or with the following command.



Step 5: Download PuTTY and login remotely (over your home network)


Putty is merely a small executable used for making an encrypted connection to the terminal of the server remotely. Make sure to put the local IP address in, and port 22. Save the session for later use, and click ‘Open’.

If this is the first time, you should see this window. Click ‘Yes’. You should only see this if you have never connected with this computer before.

Login to the server in the resulting window, and you now have terminal access.

You can save the username and/or password in the settings, but it is not recommended. You can also send a shortcut to the desktop, and edit the properties to include the username/password, but again this is not recommended.

C:\...\putty.exe -load -l -pw .bitcoin/bitcoin.conf


Step 6: Download TightVNC to view the GUI remotely

Download TightVNC and install.


You are only going to be using the client so, disable any startup/TightVNC-server stuff in your system tray in Windows. Run TightVNC Viewer

You may need to add a port 0, 5900, 5901, or 5902 after the local IP address of the server. Also, there is a small chance this will error on the first few attempts. Retry. Retry. Retry. To have this connection fully encrypted you might want to skip ahead to the ‘offsite connection’ step before proceeding. It’s not totally needed on a local/home/secure/trusted/protected/private/safe/router-firewalled/etc. network.

If you have multiple graphics cards, there is a possible issue involving the ‘Remote Desktop’ crashing due to there being multiple monitors to choose from. You can still login using PuTTy, and run the following commands based on http://ubuntuforums.org/showthread.php?t=1603059

sudo nano one_display.c


/* File: one_display.c */
int gdk_display_get_n_screens(void *p)
{ return 1; }




gcc -o one_screen.so -shared -fPIC -s one_display.c
sudo mv one_screen.so /usr/lib/vino

Next, go to the 'Startup Applications' and add a new entry, you will not be able to do this remotely.

Name: vino
Command: env LD_PRELOAD=/usr/lib/vino/one_screen.so /usr/lib/vino/vino-server --sm-disable

Log out and log back in using Unity 2D. If you would rather use the CLI, then editing the startup config is easy.

sudo /usr/lib/lightdm/lightdm-set-defaults -s ubuntu-2d

Reboot to make sure everything is working correctly. It may take a few attempts because vino is notoriously buggy in Ubuntu. After a few restarts and pokes it will probably start working correctly.

sudo reboot


Step 7: Install the Graphics Card Drivers

This will identify your graphics cards:

lspci -nn | grep VGA

In the GUI interface in TightVNC go to System Settings → Additional Drivers. Pick a driver and click ‘Activate’. The proprietary/post-release drivers are recommended

If you happen to be using the putty terminal this will allow the next commands to work:

export DISPLAY=:0

Setup the xorg.conf file:

sudo aticonfig --adapter=all --initial --force
sudo reboot

Make sure it worked in the putty terminal:

export DISPLAY=:0
aticonfig –-lsa
aticonfig –adapter=all --odgt 
aticonfig --adapter=all --odgc

The output should look similar to this mishmash:

display: :0 screen: 0
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 6999 Series
OpenGL version string: 4.2.12172 Compatibility Profile Context 12.10.17
display: :0 screen: 1
I eat tomatoes
cucumbers are for hitler

* 0. 01:00.0 AMD Radeon HD 6820 Series
1. 02:00.0 AMD Radeon HD 6147 Series

* - Default adapter

Adapter 0 - AMD Radeon HD 6000 Series
Sensor 0: Temperature - 40.00 C

Adapter 0 - AMD Radeon HD 6900 Series
Sensor 0: Temperature - 220.00 C

Adapter 0 - AMD Radeon HD 6400 Series
Core (MHz) Memory (MHz)
Current Clocks : 930 1002
Current Peak : 924 1080
Configurable Peak Range : [75-1002] [100-1250]
GPU load : -3%


As a side note. If you are not using a monitor attached to a graphics card, then you might want to consider a ‘Dummy Plug’. Obviously, this voids all warranties. However, if you do not attach something to the graphics cards other than ‘–device=0’ on ‘–platform=0 poclbm may not utilize it. Making a dummy plug is pretty simple. http://www.overclock.net/t/384733/the-30-second-dummy-plug


If the link breaks, these are the clues to the images in the link :

“68 ohm resistors from RadioShack“
“you want to bridge the top three pins on the right with the pins directly below one-to-one.“
…Trapezoid shorter side down.
“Alternate the resistors so the leg of one is against the body of another to avoid shorting out the jumpers.”


I love the last bit. Continue on to the end to realize the importance of placing a load on the graphics card in order to utilize it.


Step 8: Install SDK

Download SDK from the AMD website. The wget command will not work because they need you to agree to the license terms. So open TightVNC and download it from the website using firefox. http://developer.amd.com/tools/heterogeneous-computing/amd-accelerated-parallel-processing-app-sdk/. Alternately, just search for “AMD STK”. For here we are using version 2.7, as it seems to be the optimal Ghash/s for the specific cards used in the creation of this tutorial.

This seems to make SDK work correctly:

sudo apt-get install libglu1-mesa-dev

The Installation of the downloaded SDK:

cd ~/Downloads
tar xvf AMD-APP-SDK-v2.7-lnx32.tar
sudo ./Install-AMD-APP.sh

Do not delete these files (you might use them again later).


Step 9: All the rest or the stuff; Bitcoin Client, OpenCL, and proclbm (or proclbm gui)

Based on https://bitcointalk.org/index.php?topic=2636.35;wap2, but heavily modified.

cd ~
sudo apt-add-repository ppa:bitcoin/bitcoin  
sudo apt-get update
sudo apt-get install python-pyopencl subversion git-core python-wxtools bitcoin-qt

svn checkout https://github.com/bmjames/python-jsonrpc
cd ~/python-jsonrpc/trunk/
sudo python setup.py install
cd ~ 

mkdir ~/.bitcoin
echo "rpcuser=user" > .bitcoin/bitcoin.conf
echo "rpcpassword=password" >> .bitcoin/bitcoin.conf

git clone http://github.com/m0mchil/poclbm

Go to 'Startup Applications' and add a new entry:

Name: bitcoin
Command: bitcoin-qt -min

After signing up for a mining pool, the miner should now run using a command similar to:
cd ~/poclbm
python poclbm.py stratum://<user>:<password>@<mining-pool-url>:3333 –-no-bfl

It's a pretty sweet joke to have '--no-bfl' in there, but it's required if you don't have any FPGA, LPGA, or PGA devices attached. Also, if you are going golfing any time this month you may not want to leave out the flag '--no-bfl'. The following commands will enable you to check if it is running correctly. Feel free to launch multiple terminals.

export DISPLAY=:0
aticonfig –-lsa
aticonfig --adapter=all --odgt
aticonfig --adapter=all --odgc

Good Source:



Step 10: Write a script to make it easier to run

The idea is to make an extremely basic script file so that editing the command is easy to run. Added advantages are that it can be edited quickly, and set to run automatically. However, there is some delicacy required.

Write an extremely basic script:

cd ~
nano i.sh

Copy/Paste in your mining launch commands:

cd ~/poclbm
python poclbm.py stratum://:@:3333 –-no-bfl
sudo chmod +x i.sh

Now running it is pretty easy:


To run the miner in the background from a remote terminal. This will keep the process running when you close the terminal (or remote terminal).

nohup ./i.sh &

It would be safe to make a backup before setting the server to mine upon startup, because its easy to back yourself into a corner. If something breaks, you might not want to mine on startup.


Step 11: backing up, making a USB/DVD boot copy.

WARNING: as of 4/28/2013 Remastersys is no longer available. Skip to end for ‘relinux’ instead of ‘remastersys’


Be careful installing or using remastersys, as it requires ‘sudo su’. This command removes all safeties in linux, and means any command can be run without needing sudo+password. It sounds cool to not have to type sudo or your password, but its very risky.

Install remastersys:

sudo su
wget -O - http://www.remastersys.com/ubuntu/remastersys.gpg.key | apt-key add -
nano /etc/apt/sources.list

add these lines at the end:

#Remastersys Precise
deb http://www.remastersys.com/ubuntu precise main

Freshen up and install:

apt-get update
apt-get upgrade
apt-get install remastersys remastersys-gui

For here we will be using the cli interface. However, the gui is pretty solid. There are two specific commands ‘backup’ and ‘dist’. Each has it’s own benefits and drawbacks. For here we will keep it basic, and use ‘backup’.


This will produce a copy of the installed software minus a lot of things that will require redoing. For example, it will not include proprietary drivers. Also, the user and user files will not be included like scripts, startup settings, the mining client, and even your wallet. This is because the dist option is meant for producing a copy that you can distribute to your friends, or for replicating over multiple servers.


This option is easiest because it makes a complete backup of the entire system. It will include all of the user settings. During installation of the backup, you will have to make a dummy user just to get through the process. The dummy user is just to make the installation work. However, drivers will need to be reinstalled.

Either way remastersys will not work with autologin enabled. To disable auto login prior to starting:

sudo nano /etc/lightdm/lightdm.conf

Comment out these lines by adding a # symbol to the beginning of any line that has the word autologin:


Save, exit, reboot.

If you check the disk with the Disk Analyzer you will notice that ./Bitcoin is full of junk. This is the blockchain, and there is no reason to back it up.

sudo nano /etc/remastersys.conf

This next command can take a long time. While this runs make sure not to have anything running, or try to start anything. It will produce an iso backup if the system is less than 4GB.

sudo remastersys backup mining_backup.iso

If it fails because the filesize is to large you can consider removing libre office, thunderbird, or any large installations, and trying again. Also, go through your downloads and delete the larger files it should do the trick.

sudo apt-get remove --purge libreoffice* thunderbird*
sudo apt-get clean
sudo apt-get autoremove

After it finishes, and you have confirmed that you have the output file has been made, you can turn autologin back on and cleanup the leftover remastersys files:

sudo nano /etc/lightdm/lightdm.conf
sudo remastersys clean

To make a UBS bootable copy of the iso you just created use unetbootin (this program appears to require the use of the gui) http://unetbootin.sourceforge.net/

sudo apt-get install unetbootin
unetbootin method=diskimage isofile="/home/remastersys/remastersys/mining_backup.iso"

You can also burn the image to a DVD (but not likely to a CD). The Disk or USB can later be used to quickly reinstall everything if the system goes down. Obviously you will have to reinstall the drivers, and reconfigure a few things.

You turn autologin back on:

sudo nano /etc/lightdm/lightdm.conf

Remove the # symbols you placed in either:


You can go to the ‘Startup Applications’ and add a new entry:

Name: mining
Command: ./i.sh

Alternately, give it a good long delayed start.

Name: mining
Command: ./i.sh -p 120

For most, this is enough. However, you may want to postpone this step until you are completely satisfied with your setup.

UPDATE: use ‘relinux’ instead of ‘remastersys’


sudo add-apt-repository ppa:relinux-dev/testing
sudo apt-get update
sudo apt-get install relinux


cp /etc/relinux/relinux.conf ./relinux.conf
sed -i 's:EXCLUDES="\(.*\)":EXCLUDES="\1 '`readlink -f ./relinux.conf`'":g' ./relinux.conf
readlink -f ./relinux.conf

Use the GUI version (in other words run this command from a terminal on the machine, not putty):

sudo relinux

Remember to add “/home//.bitcoin” to the excludes portion, diable auto-login, and all the same things as remastersys.

Use this instead of ‘remastersys clean’

sudo rm /home/relinux -r


Step 12: Setup conky to display feedback


Conky is a tool for displaying information on the desktop. It’s not a puppet from the Trailer Park Boys.

sudo apt-get install conky curl lm-sensors hddtemp

hdtemp will request to run as a dameon, let the defaults go,

Setup conky:

sudo cp /etc/conky/conky.conf .conkyrc

Add it to the ‘Starup Applications’ with a delayed start. The delayed start prevents a known bug:
Name: conky
Command: conky -p 30

sudo reboot

Editing the conky configuration can be done on the fly.

sudo nano .conkyrc

Add the following lines to the file, just after TEXT. This should give a quick readout of the information on your graphics cards immediately after saving (ctrl+o)


${color slate grey}GPU:${color } ${execi 10 aticonfig --odgc --odgt --adapter=all | egrep -i "clock|load|temperature" | xargs echo | awk '{print $9 " " $4 "MHz " $23 "C\n " $18 " " $13 "MHz " $29 "C"}'}
 ${color slate grey}GPU Fanspeed:${color } ${execi 10 aticonfig --pplib-cmd "get fanspeed 0" | grep -i result | awk '{print $4}'}

If conky crashes, or locks up run:

killall -SIGUSR1 conky

You may have to do some quick modification to the settings section to stabilize the program. Settings are usually at the top of a .conkyrc file before the TEXT section.

alignment top_right
 background yesA
 double_buffer yes
 xftfont DejaVu Sans Mono:size= own_window_class Conky
 own_window_type root
 own_window_transparent yes
 own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager


There are tons of places to obtain .conkyrc files that others use. For example: http://ubuntuforums.org/showthread.php?t=281865&page=1922&p=11680710#post11680710

Usually people develop their own and share it with others.


Step 13: Advanced remote connecting (offsite connecting)

The first task is to login to your home router and port forward to the local IP address of the mining machine. This will vary depending on your router, home network, and ISP. Typing “” or “routerlogin” into the address bar on your browser should get you to the login for your router.

Get your public IP address (this is not to be confused with your local network IP address)

curl ifconfig.me
curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/< .*$//'
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

To check what ports are open:

sudo apt-get install nmap
 nmap -A -PN
 nmap -PN
 netstat -ntl |grep :22


A good practice task is to run TightVNC through a putty tunnel over the local network. So far TightVNC has been running wide open on your local home network. This is typically okay, but when accessing from remote, the tunnel is needed to encrypt the connection. This prevents anyone from listening in on the connection.

If TightVNC sever is installed as a service, you need to go to windows “Computer Management” and disable it. Otherwise you will get the infinite window problem.

In putty load the session you typically use. Go to Connection → SSH → Tunnels. Source Port: “5900”, Destination: Open the connection and login to the server. If it connected, open the TightVNC Viewer, but this time type in This will connect as usual except that closing putty will now break the connection. This is because putty is being used by TightVNC to encrypt a tunnel to the server.


Save the session as something like <local_tunnel>

Some ISPs block, or filter ports. To solve the blocked ports there are two methods.

First, simply port-forward on the router from public/open port 80 to private port 22 on the local IP of the server. This may take some time to settle in, so give it a few minutes. Running nmap can help sort this out by showing what is open/filtered/closed.

nmap <public-ip-address> -PN

Second, if you are behind extremely heavy censors then http tunneling is your tool. This puts an http wrapper around each ssh packet and bypasses the filters. However, this can be a bit more risky as it is plain as day to anyone looking in the packets that they are really ssh encrypted.


If you want to go for the holy grail, you can attempt https (or ssl) tunneling which would allow for double-encryption. Being that bitcoin hash files are encrypted you might be able to argue that this is really triple-encryption, but that is discussion for some other time.


It’s very unlikely that you have a static IP address. A dynamic IP address means that your IP can change at some random time. It’s not a every-day occurrence, so you’re safe for now. However, months down the road it can leave you high and dry. There are three possible solutions to this problem.

1. Go back home and get the new IP address, then replace it in Putty. (No-cost)
2. Sign up for a service that hosts a url that specifically redirects to your home network. This service will redirect to your IP address if it is changed ($25/year)
3. Sign up for a VPN, preferably based in Sweden, that will give you a static IP address and some additional privacy. ($5-$10/ month)

To solve this issue consider dyndns.com. It’s free for 2 weeks, and then $25 a year.


Setting up dyndns can be as easy as typing your dyndns.com username/password into your router’s configuration. It can be as difficult as setting up a dameon to report to dyndns.com it’s IP address every few hours. The outcome is that you type the url that dyndns gives you into the host name section in Putty, rather than the IP address. This step can be done later, after you have finished configuring the setup, and are ready to shell out some dough.

Swedish based, but run by pirates (accepts bitcoins)
Swedish, but expensive (accepts bitcoins)

To add some privacy consider running the miner over a VPN. It’s preferable to have your VPN based in Sweden (both incorporated and servers). Take note that this will make dyndns unnecessary as a VPN will give you a static IP address to connect to. Also, logging into it via the VPN IP address from home voids any privacy benefit gained. Your ISP will now link the IP address directly to you. If you do setup a VPN for your mining server, do not log into it from a connection that can be traced back to you (in other words you are wasting your money).

There are two flavors PPTP and OpenVPN. Installing OpenVPN is simple:

sudo apt-get install openvpn


For now, we will forgo the details of the two options that require money.

In putty merely type your public IP address into the Host (instead of your local IP address) means that the connection will bounce off of public servers. Don’t worry it’s encrypted. If it connects, repeat the tunneling task, so that you can connect TightVNC over the encrypted connection.

Again, in TightVNC connect to, and you are ‘remote connected’ even if you are sitting at home. Now if you are at another location logging in and checking your mining setup is possible. It’s even safe over public wifi. However, if the connection is weak you may not be able to use the GUI. A weak connection will not display any clicks that you put into the VNC client, but it will send them. So if you click a lot, you won’t see what you are doing (be careful).

Now that it is feasible that someone can gain access to your bitcoin wallet remotely, it would be a good decision to encrypt the bitcoin-qt wallet that you have. Obviously this adds an annoyance, but it is well worth it. An attacker may gain access to your machine, but access to your wallet is totally unacceptable.

Last bit, after all the anguish of going through all that, more pain. Add on some extra security that will prevent any would be hacker from gaining any meaningful access. Obviously, this task should be saved until you are fully happy with your setup. Extra security will basically prevent any changes being made to the server.



Step 14: Optimization

WARNING: Some of the things in cgminer can damage your hardware.

A more advanced mining tool cgminer allows for tweaking. Typically most graphics cards should operate between 80C-90C when fully loaded and airflow inside the tower is adequate. The chips can operate at temperatures above 120C. However, it all depends on too many factors. Performance, Lifetime, Efficiency are all things to be considered. Personally, I do not want my cards to go above 85C, no matter how many Mhash/s I can get from them. Poclbm offers very few options to optimize for anything. cgminer allows for optimizing settings, at the risk of ruining your hardware. So for this step we are going to ignore all of cgminer’s bells and whistles and opt for a basic setup.

First install all of the packages that aid in using cgminer:

sudo apt-get install curl libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm

Clone the package with:

git clone git://github.com/ckolivas/cgminer.git cgminer

Download some more SDK files from http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk/ Keep in mind that you will have to use firefox again as AMD requires clicking a license agreement.

Go to your downloads, unzip it, and copy the applicable files to cgminer

cd ~/Downloads
unzip ADL_SDK_5.0.zip
cd ~/Downloads/include/
cp adl_defines.h adl_sdk.h adl_structures.h ~/cgminer/ADL_SDK/
cd ~/cgminer

Look for the following, if it says NOT found, then something went wrong.

ADL..................: SDK found, GPU monitoring support enabled

Now install and check that it can see your hardware. The -n flag should print out something indicating that it recognizes your hardware.

sudo make install
./cgminer -n

If it does recognize your hardware, then test that it can mine with your pool. A cleaner interface than your used to should show.

cgminer -o stratum:// -u -p

Go back and add this line to your ‘i.sh’ file just for backup purposes. Remeamber you can put a # at the front of a line, and it will be disregarded (or saved for future editing).

Cgminer has a great number of options, you can read the –help file to get familiar with it. However, it cannot be stressed enough. If you use these options you risk buring up or otherwise permanently damaging all of your hardware (not just the graphics cards).

man cgminer
cgminer –help

If you don’t want to waste tons of time perfecting your .conkyrc file then search for a way to make the start-up in a displayed terminal.

Name: mining
Command: ./i.sh -p 120

After everything is settled, working correctly, and good to your liking. Go back and repeat Step 11. However, this time burn a copy to a DVD. This will backup everything but the drivers and your wallet. Making sure that you don’t have to go through all these steps again.


Value for Value

I put together this planter last year with two blueberry bushes in it. Weeds started trying to take over, so I pulled them and put in some chamomile plants. The blueberries are on the bush and waiting to ripen. It’s hard to part with it, because I want those blueberries. So the only solution I could come up with was to part with it for something valuable… silver.


Half Barrel Planter:$40

Blueberry Bushes:$20


Choice between silver and blueberries: Valuable.


Conquest of the RSS is Complete

I’ve been through several extremely difficult roadblocks on my quest to conquer RSS. First I tried Google reader. This didn’t work, I could only capture RSS feeds, and besides I am trying to avoid using google products anyways. The problem is that it’s hard for me to combine, filter, or in other ways modify the feed to my liking.
It’s been a long road, and I finally found the tool to accomplish this in a quick manner. I don’t use yahoo for much, but yahoo pipes is an excellent tool.


Advertisement Hurts my Brain

I just discovered that when watching hulu, you can block the ads. If you’re using firefox, in conjunction with one of the ad blocking addons (adblock or flashblock not sure), then the ads will just be a black screen with a request to disable the adblocking software.
I prefer the silence much more over the ads for goods/services I never intend on buying…
Now if I could only figure out how to get them to pay me $100 a month to have television hooked up.

Projects & Links

Colonize the Moon
About moon/mars/asteroid colonies and space stuff

Computer Dungeon
linux/raspberry-pi/bitcoin and computer stuff

A video upload server I coded myself