Headless Linux Litecoin miner setup

Headless Linux Litecoin miner setup

Headless-Linux-Litecoin-miner-setup-03

Linux is advantageous over Windows, including the ability to boot from a USB drive, meaning lesser hardware requirements, and simpler remote connection capabilities. Linux being an open source operating system comes free of charge. In this tutorial, we will guide you on how to install and configure Linux to mine Litecoin with your GPU at optimal settings. First time Linux users do not have to worry as we will guide you through step by step and I assure you that you will have your mining rig running in no time.

 

In case you are not familiar with Litecoin yet, it is a decentralized online peer-to-peer currency that is known as crypto-currency in the digital world. It runs on the vast network of its users and utilize cryptography to secure transactions. The mathematical problem in each block is difficult to solve, but once a valid solution is given, new Litecoin would be created and that is the only way new Litecoins are generated. Litecoin mining is so called beecause it resembles the mining of other commodities.

 

How to setup USB Xubuntu for Litecoin mining

If you’re still nervous about Linux, don’t be. Simply follow the step-by-step instructions, and you’ll be able to setup your own Linux mining rig soon.

 

Step 1 : Download files

You will need a few files to get started, so let’s download them all here :

Password : rumorscity

 

Step 2 : BIOS settings

Before we proceed, make sure your mining computer’s BIOS settings are in order. Power on your computer, and press the delete key a few times before it loads the startup screen. That should get you into the BIOS configuration. Make the following changes, then save and exit:

  • Edit the power options so that the computer automatically switches on whenever power is restored so that your miner will automatically start up after a power outage.
  • Make sure that your USB drive is first in the boot-up order. You may need to have a thumb drive plugged in order for it to be detected.
  • Since your miner will be likely running all the time, in order to save up power, disable all components that you don’t plan to use. For instance, disable the onboard audio, the SATA controller, the Firewire port, and the serial port.

Step 3 : Getting ready Xubuntu installation file

  • Extract both of the files you have downloaded in Step 1.
  • Install Linux Live USB Creator.
  • Launch Linux Live USB Creator and write the image file xubuntu-12.10-desktop-amd64.iso to the second thumb drive (8GB and above). You may also write it to a CD.
  • Once you have the installation media prepared, you’re ready to install Xubuntu to the blank thumb drive on your miner.

 

Step 4 : Install Xubuntu

  • Insert a blank thumb drive into a USB port of your mining rig, and then boot into your installation media (either the thumb drive or CD with image written). The Xubuntu installer would appear
  • Follow the installation instructions and select default settings except for the final part where you need to click the auto login box.
  • If you are using a thumb drive that is exactly 8GB, the installer may display a message that the default partition size is too small. Create a new partition with the following settings : 5500MB for root (/), 315MB for swap, and the balance for home (/home). If you are using a thumb drive that is larger than 8GB, you don’t have to do this.
  • Once the installation is complete, it would automatically boot into Xubuntu desktop. Remember to eject your installation media.

 

Step 5 : Install AMD Catalyst drivers

Okay, once booted into the Xubuntu screen means that you have successfully installed a USB bootable Linux. Next step is to install and update the drivers. Keep with us and you’ll have your headless Linux mining rig in a moment. The user interface of Xubuntu should be quite similar to Windows. Move your mouse down over the bottom center of the screen so that a list of icons appear. Click on an icon that looks like a black box which is the Terminal.

  • Type in the following commands and press enter at the end of each line. Wait for Linux to finish processing :

    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 have rebooted, you can confirm that everything worked by typing this code :

    sudo aticonfig --adapter=all --odgt

  • If you can see all of your GPUs listed, and hardware monitoring enabled, everything is working correctly.

Important: Your OS may idle the GPU if it is not connected to a monitor. You may plug a monitor to each of your GPU, but it is not very practical. The easiest solution is to create a dummy plug for each of your GPU and attach it to the GPU. This will trick the OS into believing that a monitor is attached, and prevent the hardware from being idled. If you are having this problem, check out this post on How to create dummy plugs for your Graphics Cards.

 

Step 6 : Install SSH, Curl and package updates

  • Install SSH by keying in this code :

    sudo apt-get install openssh-server byobu

With SSH installed, you can continue the rest of the steps from your desktop computer. You can disconnect the keyboard, mouse and monitor (with dummy plugs attached to all GPUs) from your mining rig. Run PuTTY which you have downloaded in Step 1, and enter the IP address of your mining rig, which would bring up a remote Terminal session, and it is just like you are sitting in front of the mining rig.

Headless-Linux-Litecoin-miner-setup-01

If you intend to manage your mining rig remotely over the internet, you may do so by forwarding port 22 on your router to the mining rig. Make sure that you have a strong password for Xubuntu.

 

Setup should be much easier from here onwards, as you can simply copy commands from here, by highlighting and press Ctrl+C and then paste it into your PuTTY session by right-clicking inside the PuTTY window.

  • Install Curl and package updates by typing (or paste it into PuTTY) the following code :

    sudo apt-get install curl

    sudo apt-get update

    sudo apt-get upgrade

 

Step 7 : Install CGMiner

Install the mining software, CGMiner which would be the final program to install. We are almost done. If the first command doesn’t work you can check out the official CGMiner website and take note of the current release version. Replace it with the command below.

 

CGMiner 3.7.2 is the last version to support Scrypt mining, so do not use any version after that. Additionally, some versions may give you an error message about libudev.so.1 when you run CGMiner. You can find the fix on the bottom of this post.

  • Key in the following code :

    wget http://ck.kolivas.org/apps/cgminer/2.11/cgminer-2.11.4-x86_64-built.tar.bz2

    tar jxvf cgminer-2.11.4x86_64-built.tar.bz2

  • After everything was decompressed successfully, you can proceed to delete the downloaded archive as we won’t be needing it anymore :

    rm *.bz2

  • Now check whether CGMiner detects all your GPU :

    cd cgminer-2.11.4x86_64-built

    export DISPLAY=:0

    export GPU_USE_SYNC_OBJECTS=1

    ./cgminer -n

 

Step 8 : Create CGMiner startup script

We will be done with the configurations with just a few more settings to control CGMiner.

  • If you are still at CGMiner directory from the previous step, return to your home directory with this code:

    cd ..

  • Type the following code to create a new file with the Linux text editor, Nano :

    sudo nano mine_litecoins.sh

  • type the following into Nano (remember to key in your username and password, where applicable) :

    export DISPLAY=0

    export GPU_MAX_ALLOC_PERCENT=0

    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.WORKER -p PASSWORD

  • Save the file and exit from Nano, then key in the following code :

    sudo chmod +x mine_litecins.sh

Note that the CGMiner configurations that we key into the mine_litecoins.sh script is a good starting point for Radeon 7950 GPU. For other GPU, you may need to enter a different optimal settings for it.

 

Also note that you will need to create an account at a litecoin mining pool, and enter your password and username into the script. I have put in coinotron as an example, there are quite a few other pools to choose from.

 

Step 9 : Create auto-start scripts

I will guide you on how to setup the CGMiner to automatically start whenever the mining rig is powered on. This way, we don’t have to worry about manually starting it back up when there is a power outage.

  • Open a new script in Nano with the following code :

    sudo nano miner_launcher.sh

  • Enter the following text into Nano, replacing your Xubuntu username where applicable :

    #!/bin/hash

    DEFAULT_DELAY=0

    if [ "x41" = "x" -o "x41" = "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 the file and exit from Nano, then key in the following code :

    sudo chmod +x miner_launcher.sh

  • We need to call the new script during startup by adding it to /etc/rc.local. Use this code to open /etc/rc.local in Nano :

    sudo nano /etc/rc.local

  • Add the following text into Nano, right above the line that reads exit 0, replacing your Xubuntu username where applicable :

    /home/YOUR_XUBUNTU_USERNAME/miner_launcher.sh 30 &

We have practically finished configuring the mining rig at this point. You can manually SSH into the miner from time to time to check on the hashrate or GPU temperatures. Actually, there is an easier way by creating an alias. I will show you how to create an alias in the next step.

 

Step 10 : Create an alias to easily check on CGMiner

  • Key in this code :

    sudo nano .bashrc

  • Scroll all the way to the end of the file, and right above the line that reads #enable programmable completion.., add this text in :

     alias cgm='screen -x cgm'

  • Save the file and exit from Nano.

Congratulations! You should have your mining rig up and running now. If you want to test whether everything works, the easiest way is to turn off your mining rig and turn it back on. The rest should be handled automatically by itself. Just sit back and give yourself a pat on the back and watch while your miner works automatically :

  • Your mining rig should boot into Xubuntu, which will take awhile, depending the speed of your thumb drive.
  • Once Xubuntu has loaded, in 30 seconds time the CGMiner will begin mining automatically. You will notice the GPU fan speed increasing when this happens.
  • You will be able to SSH into your miner at any time by typing cgm to bring up the CGMiner screen. Type Ctrl+A, then Ctrl+D to close the monitoring screen with your miner still mining.
  • In case you need to manually start CGMiner, just type ./miner_launcher.sh.

 

CGMiner prompted an error while loading shared library file: libudev.so.1

Some of the version of CGMiner might give you this error message error while loading shared libraries:libudev.so.1: cannot open shared object file: No such file or directory. Run the following code to fix this error :
sudo ln -s /lib/x86_64-linux-gnu/libudev.so.0 /lib/x86_64-linux-gnu/libudev.so.1
If that doesn’t work, you can try this:
sudo ln -s /lib/x86_64-linux-gnu/libudev.so.0.13.0 /lib/x86_64-linux-gnu/libudev.so.1

Headless-Linux-Litecoin-miner-setup

Did you remember to share this with your friends?
  • EasyMine

    HI Justin
    can u advise on the r9 290/ 290x on a headless setup
    2gbRam/ 8gb usb3.0 suitable for all the software?
    no hdd would save good coins per setup

    • shadowin1126

      You would be able to get off with 4GB RAM on Linux, compared to 8GB RAM on Windows. So i would increase the RAM a bit. The 8GB USB Drive is enough for both BAMT and Xubuntu, whichever you decide to use.

  • Hanybv

    Hey there, Need help from you guys, I have an Asus R9 280x OC Edition, Im pretty happy with it, getting around 756 khs/s . I set up my rig on a 16gb USB ubuntu 12.04 and its working flawlessly. My problem is with coding UBUNTU to start the .sh file when the pc starts, in the article the author chose XUbuntu, I have no idea how to make a similar file to add to my startup. So please if anyone knows how to do that I will apreciate it a lot. Thanks 😉

    • shadowin1126

      It is the same for Ubuntu. Follow step 9 to create your start up script.

  • nodenine

    Hello,

    After following these steps. I go to run the script and it does not notice all my gpus. Gives me some weird OpenCL error. Now when I test to see that all 3 are working with the aticonfig stuff they are all there.

    I am also having a hard time getting the auto launch to work. There are no errors.. it just doesn’t work.

  • shay

    will it work the same with Xubuntu 13.10?

  • choody

    ok got stuck on step 5 after putting first command and installing all the drivers putting next one and I’m getting:
    No supported adapters detected

    Got R9 290x
    4GB DDR3
    Asrock H81 BTC Pro
    Intel G3220

    Running on Kingston 16GB stick

    Please Help.

  • daniel m

    Hey, I am stuck on Step 3:
    Do you have a good video showing this program setup?

  • John Callanan

    Having all sorts of problems with Xbuntu hanging on a black screen on the reboot after updating the AMD Catalyst drivers. I’ve tried the various kernel options (nomodeset, radeon.modeset=0) and still unable to boot after the initial post-install boot. Using 3x Sapphire 7950s and a Gigabyte Mobo. Any suggestions> Different distro, perhaps?

    • Christopher Rygh

      Hi John

      I’m having the same problems – after the AMD catalyst drivers update and reboot the screen goes black.

      I’ve reinstalled and repeated the process MANY times, but with the same results – black screen. I’ve followed the cryptobagder guide, which is essentially the same as on this site. I’m using 3 x 7950 Sapphire GPUs and an Asus mobo (as used in the cryptobagder guide)

      Please share if you’ve been able to solve this great mystery!