Headless Linuxcoin

From LinuxCoin Wiki
Jump to: navigation, search

A Step-by-Step Headless LinuxCoin by gopher

A good step-by-step guide for a noob, especially to someone who've tried to figure this magic and as a result, got lost in the sea of inaccurate and incomplete guides, almost the way I did…


Introduction

After going through number of "How-To's" and "Guides" I've found on the Internet, then reading through hundreds of forum pages, I found myself less wise, tremendously confused, and far from being able to put together this seemingly simple Linux system – LinuxCoin. After a week of sleepless nights, rereading through cryptic notes of the other (they claimed those to be complete) guides, I've finally got it working.

That’s when I decided to compile my own guide, targeting the noobs (like me) with hope that this will save someone the head-scratching I had to do. Please note, this guide is based on a certain release of LinuxCoin and most definitely will not be accurate if used with any consecutive releases.


Thanks and gratitude to saving someone time and efforts can be expressed by sending fractions of BTC to 18KusJBxwh4WyV9t72q1WFppwoVxTs2BeB


Contents


Requirements

Before attempting to build a BTC mining machine, you must ensure that you understand what is required:

  1. Account with a mining pool
  2. Create miners (a.k.a. workers) – one miner per GPU
  3. 64-bit computer system - CPU, MOBO, RAM, PSU, CASE
  4. ATI 4xxx - 6xxx series graphics card(s) – depending on your MOBO, CASE and PSU
  5. 4GB USB flash-drive
  6. unetbootin-win-549 - download it here
  7. linuxcoin-v0.2.1b.iso - download it here
  8. live-rw persistent file (2GB) - download it here


Create LIVE-ISO on a USB flash-drive

  1. Assemble the 64-BIT computer system, install the cheapest 64-bit CPU you can buy in it, install 2 x 1GB memory sticks (again, cheapest you can find), install the ATI card(s), don't forget to connect the PCI-e power cables, power-it on, set the BIOS to boot from USB and the power option to "last state”
  2. Quick format the USB flash-drive with FAT32, now is the time to label it something meaningful, i.e. LinuxCoin
  3. Using unetbootin, install the live-iso onto the formatted flash-drive, set 128MB for the Ubuntu reboot-files (only if you wondered...)
  4. When finished, don't reboot your PC as unetbootin asks you, instead remove the USB flash-drive, re-insert it, then copy the live-rw persistent file into the root of the USB flash-drive
  5. Now you have the LinuxCoin live-iso ready on the USB flash-drive - it comes pre-loaded with
  • Latest ATI drivers
  • Latest ATI SDK
  • Aticonfig
  • AMDOverdriveCTRL
  • Python
  • Poclbm
  • Phoenix

All these components pre-installed will make your life so-much-easier and allow you to dive into configuring the system straight away.

You can boot the computer using the freshly loaded USB flash-drive and see if everything loads OK. Don't worry about the error messages you see during the boot - I guess the author of LinuxCoin has had too much on his plate lately to worry about perfection - the truth is this distro works as it is and at the end of the day, it does the job it is designed to do.

The only thing left now is to configure the system to default boot into persistent mode, accept the ATI SDK license (once-off), set the AMDOverdriveCTRL application to clock each card at the desired parameters, write the script needed to start the miner(s) with one command, and set it to start on boot - quite a list of items to do, but the end result justifies it - you will end up with a "headless" LinuxCoin that you can leave unattended.


Accept ATI SDK License

  1. Boot from the newly created USB flash-drive
  2. Select "System Tools" > "ATI SDK License"
  3. Read it (I mean scroll down until the end), accept it, confirm the registration.

Edit Configs & Create .SH Files

  • The next few steps will be done through the Terminal window - select "Accessories" > "Root Terminal

Change boot menu to one option

  1. Now we will change the syslinux.cfg file so to boot by default into LinuxCoin persistent without the need to select any menu item, aka "headless"
    cd /live/image
    nano syslinux.cfg
  2. Change the menu title (third line) to something more meaningful like "--- LinuxCoin 0.2.1b ---", replace the section under the "label unetbootdefault" with the one you will find under "label ubnentry2" and then delete the remainder sections - don't worry, you will not need them in the future anyway (you can leave perhaps the memory test menu item…). Appending "noprompt" to the "append initrd=..." line will stop the prompt to remove the usb stick when halting or rebooting.
    default menu.c32
    prompt 0
    menu title --- LinuxCoin 0.2.1b ---
    timeout 4
    label unetbootindefault
    menu label --> LinuxCoin (persistent)
    kernel /live/vmlinuz
    append initrd=/live/initrd.img boot=live config quiet splash persistent rw vga=791 persistent
    label ubnentry0
    menu label --> Memory Stress Test (loop)
    kernel /isolinux/memtest.bin
    append initrd=/ubninit - persistent
  3. "Ctrl+x", "y", "Enter"

Determine Active Cards

  1. Now we will determine how many active cards (and their IDs) there are in this system before attempting to create the miner's shell script
    AMDOverdriveCtrl -i0
  2. Scroll-up and see how many adapters are "active" and note their numbers (i.e. 0,4,8,12) - you will need to insert those numbers info the appropriate "AMDOverdriveCtrl" lines (i.e. i0, i4, i8, i12) in the next script.
  3. Now we will create a script that will overclock the cards and start all your miners with a single shell command:
    sudo touch /usr/local/bin/startminers.sh
    sudo chmod 755 /usr/local/bin/startminers.sh
    sudo nano /usr/local/bin/startminers.sh
  4. Type the following into the file:
    #!/bin/bash
    sudo aticonfig --od-enable
    sudo AMDOverdriveCtrl -i0 &
    sudo AMDOverdriveCtrl -i4 &
    sudo AMDOverdriveCtrl -i8 &
    sudo AMDOverdriveCtrl -i12 &
    cd /opt/miners/phoenix/
    ./phoenix.py -u http://user1:pass1@bitcoins.lc:8080 -k poclbm DEVICE=0 BFI_INT VECTORS AGGRESSION=5 &
    sleep 2
    ./phoenix.py -u http://user2:pass2@bitcoins.lc:8080 -k poclbm DEVICE=1 BFI_INT VECTORS AGGRESSION=5 &
    sleep 2
    ./phoenix.py -u http://user3:pass3@bitcoins.lc:8080 -k poclbm DEVICE=2 BFI_INT VECTORS AGGRESSION=5 &
    sleep 2
    ./phoenix.py -u http://user4:pass4@bitcoins.lc:8080 -k poclbm DEVICE=3 BFI_INT VECTORS AGGRESSION=5 &
  5. "Ctrl+x", "y", "Enter"

Alternate aticonfig script (tested on 0.2.1b on HD69XX)

The script below you can use to start your miners. it loops through a set amount of times and starts your miners in separate terminals, the more cards you have, the more numbers you put in the loop. for eg; for 3 cards you would append the following.

 for i in 0 1 2;

and for 5 cards

 for i in 0 1 2 3 4 5;

The terminal windows will be titled 'Miner1', 'Miner2', etc. here's a mock configuration to help you get to grips.

 WORKSIZE=256
 AGGRESSION=11
 FANSPEED=80
 USERNAME=zarren@spry.com
 PASSWORD=password
 URL=pit.deepbit.net
 PORT=8332

You can create a file with nano

 sudo nano /usr/local/bin/start_miners

Here's the script !!

 #!/bin/bash 
 #globals
 WORKSIZE=<your_worksize>
 AGGRESSION=<you_aggression>
 FANSPEED=<your_fanspeed>
 USERNAME=<your_username>
 PASSWORD=<your_password>
 URL=<your_url>
 PORT=<your_port>
 #time to start mining 
#setup cards
sudo aticonfig --od-enable sudo aticonfig --odsc="925,300" --adapter=all sudo aticonfig --odcc --adapter=all #lets go
cd /opt/miners/phoenix/ for i in 0 1; do DISPLAY=:0.$i sudo aticonfig --pplib-cmd="set fanspeed 0 $FANSPEED" x-terminal-emulator --title=Miner$i -e python ./phoenix.py -v -u http://$USERNAME:$PASSWORD@$URL:$PORT -k phatk \ WORKSIZE=$WORKSIZE AGGRESSION=$AGGRESSION VECTORS BFI_INT FASTLOOPS=false DEVICE=$i & sleep 3 done

save by pressing "Ctrl+x", "y", "Enter"

That's it, you're done with this section - remember this is just an aticonfig alternative to AMDOverdriveCtrl in case you prefer command line - next section is the same.

If you are running this script for the first time and the terminal windows are just starting and disappearing, you are probably getting the following error:

 FATAL kernel error: Failed to load OpenCL kernel

If so, then just manually run the x-terminal-emulator command using sudo one time. Then, kill it, and your script should start working correctly.

Create Auto start Script

  1. Now we will create an auto-start script, one that will start the startminers.sh script at start
    sudo touch /home/user/auto.sh
    sudo chmod 755 /home/user/auto.sh
    sudo nano /home/user/auto.sh
  2. Type the following into the file:
    #!/bin/bash
    xhost +
    echo $DISPLAY > /home/user/.display
    lxterminal --command "/usr/local/bin/startminers.sh"
  3. "Ctrl+x", "y", "Enter"

Remember xhost + is unsafe. If your just running as a mining setup your ok but don't leave this set if you have coins saved.

Configure System to use Auto-start file

  1. Now we will configure the system to start that "auto.sh" script when the desktop loads
    cd /home/user/.config
    mkdir autostart
    sudo chmod 755 /home/user/.config/autostart
    sudo nano /home/user/.config/autostart/auto.desktop
  2. Type the following into the file:
    [Desktop Entry]
    Type=Application
    Name=coin
    Exec=lxterminal --command "/home/user/auto.sh"
    Terminal=true
  3. "Ctrl+x", "y", "Enter"

Overclocking parameters

  1. Now we are ready to tune the Overclocking parameters individually for each card
    cd /usr/local/bin
    startminers.sh
  2. A terminal session will open and (in this case) four instances of the AMDOverdriveCtrl will open on the desktop - just drag them separate so you can work in each of them.
  3. Select "Overdrive"
  4. Slide the parameter selectors to your liking (in each Low-Med-High section), when ready, press "Set" and "Save defaults"
  5. Move to the next card's AMDOverdriveCtrl instance and repeat

Finishing Up

  1. With all cards set, the machine is ready - fully configured - if you followed this document to the letter and did not made too many spelling or syntax errors in the shell scripts, the thing should work 100%
  2. Click on the On/Off red button in the bottom-right corner, then select reboot.
  3. Wait for the message that says you need to remove the USB flash-drive (DON'T DO THAT!) just press "Enter"


That's it - hopefully the machine will boot nicely without requiring any interaction and go straight into mining using the overclocked settings, earning you some BTCs in the process.

Spend them wisely or keep them for a better day – that might just be the best investment you’ve ever made! If you have any comments, you can find me at the forum.bitcoing.org - I am gopher

Personal tools