In the second installment of our DIY litecoin mining guide, we’ll look at how to install and configure Linux to properly mine with your GPUs at optimal settings. Don’t be dissuaded if you’ve never used Linux before—our step-by-step guide makes it easy.
Linux has a few advantages over Windows, including the ability to install to a USB stick (which means you don’t need a harddrive), lesser hardware requirements (you can get by just fine with less than 4GB of RAM), and simpler remote administration capabilities. Best of all, Linux is free! However, be aware that if you’d like to undervolt your GPUs to save power, Windows might be a better choice for you (update 10/2013: no longer true!).
If you missed the hardware portion of our guide, make sure to check it out first. Otherwise, read on.
Build a Litecoin Mining Rig, part 2: Linux Setup
So you’ve decided to use Linux to run your mining rig—a fine choice! If you’re still a bit nervous because you’ve a complete Linux newbie, don’t be. Simply follow the step-by-step instructions exactly as they’re written, and you’ll be fine. Even if you’ve never done anything like this before, you should be up and running in about an hour.
Step 1: Configure BIOS settings
Before we even get to Linux, make sure your mining computer’s BIOS settings are in order. Power on your computer, and press the “delete” key a few times immediately after power on. You should end up in the BIOS configuration area. Do the following, then save & exit:
- Change power options so that the computer automatically turns itself on whenever power is restored. The reason for this is two-fold: first, it’ll make sure that your miner automatically starts up after a power outage. Second, it makes powering the computer on much easier if you don’t happen to have a power switch connected to the motherboard.
- Make sure that your USB stick is first in the boot-up order (you may need to have a USB stick attached).
- Disable all components that you don’t plan to use. This will save a little bit of power, and since your miner will likely be running 24/7, it’ll add up. For me, that meant disabling onboard audio, the SATA controller, the USB 3.0 ports (I only had a 2.0 USB stick), the Firewire port, and the serial port.
Step 2: Install Xubuntu Desktop to your USB stick
Xubuntu is a lightweight version of Ubuntu, a popular Linux distribution. Most other distros should work just fine, but be aware that the GPU drivers require the presence of Xorg, which means server distros that don’t have a GUI will not work properly.
- Download the Xubuntu Desktop x64 v12.10 installation image.
- You’ll need to either burn the installation image onto a CD, or write the image to a second USB stick. If you use a CD, you’ll need to temporarily hook up a CD-ROM drive to your mining rig for the installation (make sure you temporarily enable your SATA controller if you disabled it in step 1!).
- Once you have the installation media prepared, you’re ready to install Xubuntu to the blank USB stick on your miner. Make sure your blank USB stick is inserted into a USB port on your mining, and then boot into your installation media. The Xubuntu installer should appear.
- Make sure to click the “auto-login” box towards the end of the installer; otherwise take all of the default installation options.
- If you’re using a USB stick that is exactly 8GB, the installer may complain about the default partition sizes being too small. Create a new partition table with these settings: 5500mb for root (/), 315mb for swap, and the remaining amount for home (/home). If you’re using a USB stick larger than 8GB, you will not have to do this.
- When the installation is complete, you should automatically boot into the Xubuntu desktop. Make sure to remove your installation media.
Step 3: Install AMD Catalyst drivers
Open a terminal session by mousing over the bottom center of the screen so that a list of icons appears. Click on “terminal” (it looks like a black box).
- Type the following commands (press “enter” at the end of each line and wait for Linux to finish doing it’s thing):
sudo apt-get install fglrx-updates fglrx-amdcccle-updates fglrx-updates-dev sudo aticonfig --lsa sudo aticonfig --adapter=all --initial sudo reboot
- After your computer reboots, you can verify that everything worked by typing:
sudo aticonfig --adapter=all --odgt
- If you see all of your GPUs listed, with “hardware monitoring enabled” next to each, you’re good to go.
Important: you may need to have something plugged into each GPU to prevent the OS from idling it. You can plug 3 monitors into your 3 GPUs, but that isn’t very practical. The easiest option is to create 3 dummy plugs, and leave them attached to your GPUs. They’ll “trick” the OS into believing that a monitor is attached, which will prevent the hardware from being idled. Check out how to create your own dummy plugs.
If you ever add or remove GPUs to your rig later, you’ll need to re-run this command: sudo aticonfig --adapter=all --initial
Step 4: Install SSH, Curl, and package updates
- Install SSH by typing:
sudo apt-get install openssh-server byobu
With SSH installed, you can unplug the keyboard/mouse/monitor (put dummy plugs into all GPUs, though) from your miner, and complete the rest of the installation from your desktop computer. Simply download Putty onto your desktop, run it, and enter the IP address of your mining rig. That should bring up a remote terminal session to your miner, which is more or less just like sitting at the keyboard in front of it.
If you plan to manage your mining rig remotely over the internet, you’ll need to forward port 22 on your router to your miner. Make sure that you use a strong Xubuntu password!
Setup should be quicker from this point, as now you can simply copy text from this webpage (highlight it and press control-C) and then paste it into your Putty session by simply right-clicking anywhere inside the Putty window. Neat, eh?
- Install Curl and package updates by typing (or copying & pasting into Putty) the following commands:
sudo apt-get install curl sudo apt-get update sudo apt-get upgrade
Step 5: Install cgminer
Cgminer is the mining software we’ll be using. If the first command doesn’t work, you’ll need to check out the cgminer website and make a note of the current release version. Substitute that in the commands below.
Update: Cgminer 3.7.2 is the last version to support scrypt—do not use any version after that! In addition, depending on which version you choose to use, you may receive an error complaining about libudev.so.1 when you try to run cgminer—you can find the fix for that here.
- Type the following:
wget http://ck.kolivas.org/apps/cgminer/2.11/cgminer-2.11.4-x86_64-built.tar.bz2 tar jxvf cgminer-2.11.4-x86_64-built.tar.bz2
- If everything was uncompressed successfully, we can delete the downloaded archive; we don’t need it anymore:
rm *.bz2
- Now check if cgminer detects all of your GPUs properly:
cd cgminer-2.11.4-x86_64-built export DISPLAY=:0 export GPU_USE_SYNC_OBJECTS=1 ./cgminer -n
Step 6: Create cgminer startup script
We’re almost done—now we just need to create a few simple scripts to control cgminer.
- If you’re still in the cgminer directory from the previous step, first return to your home directory:
cd ..
- Type the following to create a new file with nano, a Linux text editor:
sudo nano mine_litecoins.sh
- Type the following into nano (note where the places you need to substitute your own usernames!) :
#!/bin/sh export DISPLAY=:0 export GPU_MAX_ALLOC_PERCENT=100 export GPU_USE_SYNC_OBJECTS=1 cd /home/YOUR_XUBUNTU_USERNAME/cgminer-2.11.4-x86_64-built ./cgminer --scrypt -I 19 --thread-concurrency 21712 -o stratum+tcp://coinotron.com:3334 -u USERNAME -p PASSWORD
- Save the file and quit nano, then enter the following:
sudo chmod +x mine_litecoins.sh
Note that the cgminer settings we’re using in our mine_litecoins.sh script correspond to a good starting point for Radeon 7950 series GPUs. If you followed our hardware guide, these settings will give you good hashrates. If you’re using another type of GPU, you’ll want to use Google to find optimal cgminer settings for it.
Also note that you’ll need to create an account at one of the litecoin mining pools, and plug your username and password into the script (the -u and -p parameters). I have Coinotron in there as an example, but there are quite a few to choose from.
Step 7: Create auto-start scripts
We want cgminer to automatically start mining whenever the rig is powered on. That way, we keep mining losses to a minimum whenever a power outage occurs, and we don’t have to worry about manually starting it back up in other situations.
- Type the following to create a new script and open it in nano:
sudo nano miner_launcher.sh
- Enter the following text into the editor (substitute your Xubuntu username where shown!):
#!/bin/bash DEFAULT_DELAY=0 if [ "x$1" = "x" -o "x$1" = "xnone" ]; then DELAY=$DEFAULT_DELAY else DELAY=$1 fi sleep $DELAY su YOUR_XUBUNTU_USERNAME -c "screen -dmS cgm /home/YOUR_XUBUNTU_USERNAME/mine_litecoins.sh"
- Save and quit nano, and then type:
sudo chmod +x miner_launcher.sh
- Now we need to call our new script during startup; we do that by adding it to /etc/rc.local. Type the following to open /etc/rc.local in nano:
sudo nano /etc/rc.local
- Add the following text, right above the line that reads “exit 0” (substitute your own username!):
/home/YOUR_XUBUNTU_USERNAME/miner_launcher.sh 30 &
Step 8: Create an alias to easily check on cgminer
We’re essentially done at this point, but you’ll probably want to manually SSH into your miner from time to time to manually check on your GPU temperatures & hashrates, etc. Creating an alias will make that easy.
- Type:
sudo nano .bashrc
- Scroll to the end of the file, and then add this text above the line that reads “# enable programmable completion…”
alias cgm='screen -x cgm'
- Save and quit out of nano.
That’s it—you’re done! You’ll probably want to test everything now. The easiest way to do that is to close your Putty session and power down your miner. Turn it back on and the following should happen:
- Your miner should boot into Xubuntu. This may take about a minute, depending on the speed of your USB stick.
- 30 seconds after Xubuntu has loaded, cgminer will automatically start and begin mining. You’ll probably notice the fans on your GPUs spin up when this happens.
- You should be able to SSH into your miner at any time and type cgm to bring up the cgminer screen. To close the screen (and leave cgminer running), type control-A, then control-D.
- If you ever need to start cgminer manually (because you quit out of it, or kill it, etc), simply type ./miner_launcher.sh
Congratulations—you have your own headless linux litecoin miner!
The next section of our guide covers setup under Windows, and then we take a look at optimizing cgminer settings for better performance.
We’ге a group of volunteers aոd oρening a neա scheme іn
ouг community. Your site offered սs wwith valuable info to ѡork on.
You’ve done an impressive jjob and ourr entire community will bе
thankful tо you.
Check օut my blog: finanmce [Jeana]
I got an error posting a comment about how to do Steps 7 and 8 using systemd (Arch Linux), so I took a snapshot of it: http://i.imgur.com/tcJGgfs.jpg
Got Xubuntu 13.04 working and now I’m mining. However, I had to remove (1) of the (3) cards to get the rig to boot without freezing on the blue Xubuntu logo screen. I’m mining at around 1.1Mh/s so it would be great if I can add the 3rd card and get the rig to work. Any ideas on pulling this off? Has anyone else had a similar issue?
DumDum, I’d also love to know the answer to this. It may be that a redownload of the drivers and/or cgminer will correct some little failing that is causing it. It may even be that it is a problem in Xubuntu that a fresh install might cure. Being unsure of the cause, I suggest you do downloads of the easy parts. First, the drivers, then fully power off the rig, then back and do the ati….initial comand, then cd into your cgminer directory, do the “export Display and GPU_USE.” commands, then the “./cgminer -n” to see if cgminer sees all three. If Xubuntu is freezing still when you power on, I suggest a full fresh install. I know it is tedious, but I’ve had success from stubbornly reinstalling several times until finally I get a working system. Linux and downloading just seem to have many quirky ways of getting “bent”. For example, I’ve installed and not been able to go into some parts of the desktop, then installed again from the SAME flash stick, and had it all working.
Good Luck and don’t quit until it’s going right for you!
I had all sorts of problems with newer versions of xubuntu not installing, then seeming to install but breaking. Once It appeared to install, cgminer would hash about 20KH/s lower than my first rig with the same hardware. Eventually, when I added the fifth GPU to each rig, I took cryptobadger’s advice and cloned the first USB, then changed the host name, username, password, ssh port and miner worker details her presto, a new, completely installed second rig with the same performance as the first.
I am helping a mate at work do the same thing of my ISO. I’ll just change it to his details and he will have his version of my miner.
Download problems like that can usually be prevented by verifying the ISO with theses steps
https://help.ubuntu.com/community/HowToMD5SUM
Using Ubuntu 12.04 cgminer 2.11 asrock 990 extreme 4.Amd Sempron.
Hey so I used the fglrx updates for asus 290. When I do aticonfig it says no devices are detected. I then went and installed the drivers via amd ati and they are causig ./miner_launcher.sh to not work.
Is there a limit on text size of posts here? I’ve got my question down to 1149 characters but it still fails.
Cheers
jarsudsco
So, a strange one here…
I’ve been running my rig with 2x Sapphire 7950’s connected directly to the motherboard. I’ve had to run GPU 0 at an Intensity of no more than 14 as it was getting to hot (GPU 1 was fine at 20) and CGMiner would hang. Even after weeks of playing with settings I couldn’t get CGMiner to run for more than a few hours without a reboot.
I’ve now put GPU 0 on a riser and can run it at an Intensity of 20 and temp doesn’t go above 72…but now I’ve had to lower the Intensity of GPU 1 (!) to 16 or else CGMiner hangs after a very short time.
Spent a couple of days tweaking settings and my optimum for this setup (2x 7950 – only one on a riser) is;
-I 19,16 -g 1 -w 256 –thread-concurrency 24000 -engine 1000,1000 –gpu-memclock 1500,1500 –gpu-vddc 1.169,1.169 –gpu-powertune 20,20 –temp-target 78 –auto-fan
Very stable now and running at a total hashrate of 1.1-1.2 Mh/s so I’m happy and will order 2 more riser cables and get this 3rd GPU hashing
Hi CatLikeFelix, I am using the same cards as you with a ASrock 970EX4 mobo. I have three cards each in two rigs all with power risers and am using almost the same script as what you listed. My temps on the three cards in each rig average around 78C. each but it varies constantly as does the hash rate which is between 590 to 630 with WU: combined at around 1650 to 1700 each rig. Sometimes it goes above that for a short time on the pool and then drops off again.
My question is why do you have two intensities, two engine speed, two memory clock and two voltage settings in your script. Is that so you can assign different settings to individual cards? Does it work for that. I do not see an example of that in CryptoBadger’s configuration but I have seen it on some other sites discussing mining set ups.
Hey Edwardf. Yeah – exactly. It just made it easier to tweak settings when the 2 cards were direct in the mobo. I have the same mobo as you and when you plug card 1 directly into it it takes a hell of a lot of heat from the central chipset on the board so had to lower card 1’s Intensity more than card 2’s to get the best results. And even now with one riser I need to keep card 2 lower than card 1 (again, I’m talking Intensity rating here)
Have ordered 2 more riser cables (wanted to find a local French supplier and make sure the riser was good quality first instead of taking a punt and ordering all of them together)
Like I say – I’m just happy now that the rig is stable (has run for over 30hrs with no hiccups) and card temps are 70ish for the card on the riser cable and 72ish for the one still directly in the mobo.
CatLikeFelix,
Thanks for the reply. That is good to know because my cards are all reacting differently at times and I have finally gotten to stable set up but could use the multiple settings to tweak each card for better performance. I had not given it much thought before and was not sure it would work. I will try it on my rigs when a card begins to act up. I am going to add a fourth card to one rig this week as a test run.
The Xubuntu loading screen got stuck after doing this:
sudo apt-get install curl
sudo apt-get update
sudo apt-get upgrade
What can it be the problem?
I think maybe the partition of my USB stick?
i got 5500 for root, 315 for swap, 300 for efi boot and the rest for home…
is the 300 for efi boot are ok?
do I need more?
Is it required?
do i need /boot?
Sorry for the multiple questions, im a noob in this.
Please help.
[…] start mining automatically – in case of power outage, for instance – follow Step 7 from CryptoBadgers‘ guide, which also details how to make your rig headless if you don’t wish to leave it […]
Hey gents /ladies
My mining rig using Ubuntu has just stopped all of a sudden! When I power on I just get a black screen with no signal detected.
It might be my monitor going faulty though because it’s stopped working on the dvi cable but works on a standard VGA cable!
I can get into my mb BIOS though but it just won’t boot into Ubuntu. I have 3 graphics cards in the rig, any help appreciated.
Phil g.
When I use the commands to check if cgminer detects my gpu’s I get the following.
“-bash: ./cgminer: No such file or directory”
These are the commands I’m using.
cd cgminer-3.7.2
export DISPLAY=:0
export GPU_USE_SYNC_OBJECTS=1
./cgminer -n
Somehow this version seems to be broken. Check out my post earlier where I left a dropbox link to the version called cgminer-3.7.2-x86_64-built.tar.bz2.
No idea why, but the version on Con Kolivas’ site no longer creates a directory called cgminer.
Or send me an email to airbornerescue at hotmail dot com.
I had the incorrect version of 3.7.2. Have the correct one now and cgminer is up and running.
What is the upper limit as far as number of GPU’s that one can install on one PC using Linux as the OS? I’ve seen pic’s of 5&6 but if one had additional PCI slots could it go as high as 7 or 8?
Curious..
[BTW, thanks for the great How-To writeup’s!]
[…] initially tried using cryptobadger’s linux xubunto 12.10 setup. However, I couldn’t get it to recognize more than 2 cards for the […]
Hi,
I can´t start cgminer on boot automatically.
I have Ubuntu 13.10 + cgminer 3.7.2
I followed your recommendation without success. (Step 7: Create auto-start scripts) neither common user nor root user.
Making some tests, I replaced cgminer command with “top” command, and in that case, works fine.
If I run launch-cgminer-sh script manually, works good.
How I can trace this error?
Thanks in advance.
Pablo
Dum dum
I had the same problem, with 3 out of 3 cards plugged in Ubuntu would not boot just black screen. I removed suspect card which kept going dead in cgminer and it worked. I’ve sent it back for a replacement as it must be shagged.
Try running one of the cards at a time to see if they work individually.
To the above_ I’ve heard that 6 or more GPUs in mining rig is a no go as it causes instability? I’m going for 4 maybe 5 Max.
Btw in more building another rig with MSI r290 of gaming edition cards and I was thinking of using that BAMT. Had anyone used it it’s supposed to be a lot simpler than Ubuntu etc?
Cheers.
,.,x
,,
I have been having issues with grub and so on!!
so left the rig mining litecoin for a week alls good decided to restart the rig as i wanted to move it and had Grub Problems starting it back up ( looked on google and did the fix with the live disk )
then wanted to mining a different coin so changed the start up script to mine doge rebooted and this time is would not even reconise an linux operating system so i and have just ended up formatting and starting again this needed to do this now 3 times maybe i am just stupid
question is have i done something wrong? / or is there an easy way to end the miner and change it to mine a different coin with out restarting as when its running its fine.
thanks for reading and helping me out
i will make a small donation if this stops me having problems as its driving me mad wife has started giving me rum!!!
CJ, my approach is to hit “Q” key while in cgm screen, cgminer will stop mining. Then I change the url in nano mine_litecoins.sh, then use command “./miner_launcher” which restarts cgminer. the cgm screen should now show your miner working in the new pool.
Alternatively, hitting “P” while in the cgm screen will take you into pool management, where you can enter additional pool addresses, choose management strategies (failover, round robin, which url you want the miner working at now, etc). You can switch pools here without even closing cgminer. Good Luck!
Thanks Ezpacer
I will have a play around later when i get a chance most helpful
CJ
I have four Sapphire 7950 cards on powered risers. All four are recognized in the bios, by the ati driver and by cgminer. I am running Xubuntu 12.10 and cgminer-3.7.2-x86_64-built.
Cards ‘0’ and ‘1’ are the only two hashing but only at about 288 Kh/s each. Cards ‘2’ and ‘3’ are showing ‘OFF’ in cgminer. I tried turning them on but they will hash at zero Kh/s.
I tried swapping card ‘0’ with card ‘3’ with the same result. I then tried swapping the powered risers with ‘0’ and ‘3’ and again get the same result.
So two questions. Why is the hash rate so low on the cards that are hashing and why are two of the cards not doing any hashing?
One more question. GPU ‘0’ is at a temp of approx. 64.0 C while the other three cards are between 26 and 27 C with GPU ‘1’ being the lowest. cgminer is reporting cards 1, 2 and 3 with zero activity even though card 1 is hashing at 288 Kh/s.
Try sudo aticonfig -f –adapter=all –initial
Reboot
cd cgminer
./cgminer -n
If all the cards are listed with no errors, you should be good to go.
I am getting an error.
[2014-02-14 20:59:34] Platform 0 devices: 4
[2014-02-14 20:59:34] 0 Tahiti
[2014-02-14 20:59:34] 1 Tahiti
[2014-02-14 20:59:34] 2 Tahiti
[2014-02-14 20:59:34] 3 Tahiti
[2014-02-14 20:59:34] ADL Initialisation Error! Error -1!
[2014-02-14 20:59:34] 4 GPU devices max detected
I wonder if I should re-install the ati drivers?
Angus, It couldn’t hurt to re-install the drivers. You can uninstall with this command:
sudo apt-get remove fglrx-updates fglrx-amdcccle-updates fglrx-updates-dev
And then re-install again. Good luck!
Rig’s been running fine but suddenly I cannot start CGMiner. Won’t start on start up and if I type “cgm” I get this; “There is no screen to be attached matching cgm”
Any ideas? What’s happened?
CatlikeFelix,
Were you able to get the “no screen attached” problem solved?
If so, please help! Much appreciated!!
I have installed ssh and it is working……kind of. I can not see my gpu temps or change any settings other than intensity. I have created the alias cgm=’screen -x cgm’ . When I ssh into the computer and type cgm it give me “There is no screen to be attached matching cgm”. Does anyone know how to fix this?
Dabomb,
If you have connected via SSH using Putty and you receive that message it would indicate that cgminer is not actually running. You could try to type in “./ miner_launcher.sh” first. If that does not work try “sudo reboot”. If that fails, then manually restart the rig. Once you are into cgminer you should see all the cards with temp, Kh/s, etc. Then if you want to make any changes you press “G” then you will see the options for making changes. Press “C”, enter the card # you wish to make changes to, then the change letter, etc. However, I find that the best way to make changes is to do it in the cgminer script by pressing CTRL+A, CRTL+D, sudo nano mine_litecoins.sh, enter password, make changes, then type sudo chmod +x mine_litecoins.sh, enter, then do sudo reboot. Every so often I find that xubuntu does not start as it should or cgminer does not start so I have to shut the rig down manually and restart at the rig itself.
I have connected via SSH using PuTTY and I see the kH/s (they are up to normal levels). For some reason I can not see the temps. and if I hit “G” then it takes me to the next menu, like normal, but it leaves out the “C” for change option.
I navigate to my cgminer folder via terminal
cd /home/username/Downloads/cgminer
then,
./cgminer
This brings up cgminer as it should but leaves me with the problem that has been stated.
Thanks in advance for the help, let me know if I am just missing something you said.
Ok so maybe this is the easier way to go. What if I connect a monitor to my mining rig, open terminal, start ./cgminer, then unplug the monitor. Can I then SSH into the rig via PuTTY and view/change settings in that terminal window that is already open?
I am new to SSH and PuTTY and appreciate any help.
Da Bomb, were you able to get the “no screen attached” challenge solved?
I am really looking to solve this and get this running, please help me! Thanks!
FYI guys I built another mining rig with msi r9 290 gaming cards and used BAMT. It was a piece of cake!
After downloading the ISO image to my pc and then writing it to my usb stick I just plugged it into my rig and that was it!
Only thing I had to do was change the pools in cgminer.conf and it was up and mining! Didnt even have to touch any settings for my GPUs.
No messing about with driver, SSH, SDk etc its already done. The only problem I had was I couldnt connect to the internet with version 1.3 so started again with the beta version 1.5 and job done.
I am using gigabyte H77 D3H MB and intel celeron. Early days but Its been running all day so far at 839kh/s per card and you can also connect remotley to it using windows remote desktop connection.
Oh I forgot the link!
https://litecointalk.org/index.php?topic=2924.0
Hi guys,
I wanted to know if its possible to install the
Radeon Sapphire R 7950 3 GB GDDR5 with Boost
on the Xubunto 12.10? I do not know what to type in the Black Box to get them start.. Or can i download it online? Because on the Radeon Website, there are only Windows devices..
Thanks for your help