Litecoin or Bitcoin: Ubuntu Cgminer install

I just spent a good amount of time trying to get my headless ubuntu litecoin miner to work.

There are several great tutorials out there:

http://decryption.wordpress.com/2013/04/22/mining-litecoin-with-cgminer-ubuntu-12-10/
https://docs.google.com/document/d/1Gw7YPYgMgNNU42skibULbJJUx_suP_CpjSEdSi8_z9U

But it would have saved me a lot of time if they were more concise and left out all the unnecessary stuff.

So here is my attempt at a more succinct, “get down to business”, type of tutorial.

Step 1

Install ubuntu, I am using 12.04, but I am sure you can choose any flavor you like.

Step 2

Clean up old drivers. This is important if you are already having issues with your install. If this is a brand new install, you can ignore this step.

sudo sh /usr/share/ati/fglrx-uninstall.sh
sudo apt-get remove --purge fglrx fglrx_* fglrx-amdcccle* fglrx-dev* xorg-driver-fglrx

Step 3

Install dependencies. Honestly, I don’t know which of these are actually important, but they don’t hurt so just install them.

sudo apt-get install build-essential cdbs fakeroot dh-make debhelper debconf libstdc++6 dkms libqtgui4 wget execstack libelfg0 dh-modaliases libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm byobu

Step 4

Install the AMD catalyst driver so your video cards can be recognized. Caution: Using the build-in FGLRX drivers did not work for me, this method is much more fool-proof. Note: The catalyst driver installer requires a GUI, so be sure to turn on X if you are working from SSH.

wget http://www2.ati.com/drivers/linux/amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip
unzip amd-driver-installer-catalyst-13.1-linux-x86.x86_64.zip
chmod +x amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run
sudo sh amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run

Step 5

After you install the AMD catalyst drivers and come back from rebooting, it is time to see if your GPUs are being detected properly.

First, we run some magic:

export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100

Then we probe aticonfig to see what it has.

This will list all the active devices.

sudo aticonfig --lsa

This will list all the devices and their respective fan speed — basically checking if you can read them.

sudo aticonfig --adapter=all --odgt

If that does not work, you can try one last command

sudo aticonfig --adapter=all --initial

Then reboot and try the first two aticonfig commands (including the magic commands) again to see if you get any results.

If the three commands above does not return to you all the cards you expected, or show any kind of errors, something is wrong. There is no need to go any further. Go back and see if you missed a step, or go try another tutorial.

Step 6

Go get a pre-built copy of cgminer from the author’s website:

http://ck.kolivas.org/apps/cgminer/

You are free to compile it yourself from the github source, but it’s a tedious process, so why bother.

Step 7

See if cgminer pick up all the same cards aticonfig does.

First run the magic (basically you always do this before you run anything that requires the graphic cards):

export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
export GPU_MAX_ALLOC_PERCENT=100

Then

./cgminer -ndevs

It should list all your cards.

If it does, then you are ready to mine. Configuring cgminer properly is whole another topic I won’t discuss here.