How To Build a 6 GPU Zcash Headless Mining Rig on Ubuntu 16.04 Using Claymore

Rolf Versluis
Jan 12, 2017 · 10 min read

Bitcoin is getting all the press, and Bitcoin mining can be profitable. But the equipment is noisy, expensive, and hard to get. If you want to get started in crypto-currency, and have a little bit of technical knowhow, I recommend you build a GPU mining rig first.

GPU mining rigs are just as profitable as Bitcoin mining, the products are easy to purchase, and the GPU cards have a 2 year warranty in case you burn them out. They are multipurpose, and can be used to mine many different crypto-currencies. These will usually pay for themselves in one year, including the cost of electricity. After that you are making money.

I’ve been building mining rigs using Ubuntu linux for a while now. I really like the AMD RX480 cards, and recently moved my Ethereum miners to using Claymore’s mining code. I wanted to mine Zcash also, and found that the AMD R9 Fury cards were better than the AMD RX480's.

The first miners I built for Zcash used the SilentArmy miner for Ubuntu. It was good, but Claymore’s Windows version was 3 times as fast! I moved the machines to Windows 10 and ran the Claymore miner. Fabulous performance, no problems.

Except I don’t like Windows 10. When I need to check on the miner, or reboot it, I want to be able to SSH to it directly, make the change, and be done. Windows was rebooting at inconvenient times for updates, and I hated having to VPN in and get a GUI going with NoMachine just to make a change.

So when Claymore came out with a Linux version of the Zcash miner, I was very happy. I built a new 6 GPU mining rig and got things going. It works really well. It’s set up to run headless on Ubuntu 16.04 LTS with the latest AMD drivers. This same basic setup can be used to mine for Ethereum and Monero also.

Check out the Stats — 2055 Hash/second. This box uses 7 amps at 240 VAC — 1600 Watts of power. In January of 2016, this box generates $250/month of Zcash, and uses about $50/month of electricity, for a net of $200/month, or $2400 per year. First year mining pays for itself, then it’s making you money.

Plug that into the Equihash numbers at Coinwarz, and you’ll see Zcash comes out pretty good.

Equipment list — Links are to Newegg or Amazon or Parallel Mining product page

  1. Motherboard — BIOSTAR TB85 LGA 1150 Intel B85 SATA 6Gb/s USB 3.0 ATX Motherboards — Intel — $71
  2. Processor — Intel Celeron G1820 Processor 2.7GHz 5.0GT/s 2MB LGA 1150 CPU BX80646G1820 — $43
  3. Memory — Kingston HyperX FURY 8GB Kit (2x4GB) 1600MHz DDR3 CL10 DIMM — Black (HX316C10FBK2/8) — $49
  4. SSD — KingDian 2.5" 7mm SATA III 6Gb/s Internal Solid State Drive SSD for Desktop PCs Laptop ( 60GB ) — $30
  5. Case — ParallelMiner BAREBONE — ALL ALUMINIUM 6.1 GPU OPEN AIR MINING CASE — $120
  6. Power Supply 1 — Antec High Current Pro 1300W ATX12V/EPS12V Power Supply HCP-1300 Platinum — $260
  7. Power Supply 2 — Build this out of these 3 parts:
  1. PCI-E Risers — ELEGIANT PCI-E USB 3.0 Cable Express 1X to 16X Extension Cable — Mining Dedicated Graphics Card Extension Cable Adapter with SATA Cable for PC Desktop Laptop — qty 6 at $11 — $66
  2. GPU’s — SAPPHIRE NITRO Radeon R9 Fury 100379NTOC+SR 4GB 4096-Bit HBM TRI-X OC+ (UEFI) Video Card — qty 6 at $260 — $1550
  3. ATX power switch — PC Case Red Green LED Lamp ATX Power Supply Reset HDD Switch Lead 20" — $10

Total Cost for Bill of Materials — $2270

Build Notes:

I used an MSI board in the video, and the Biostar on a different build. I like the Biostar better because it does not require any messing around with BIOS. It just works. And it costs less.

Buy twice as many PCI-E risers as you think you will need. I’ve tried 3 different brands, and usually half of the risers will be bad and won’t work. Most of the time the GPU card will stop working due to a bad risers after a few hours or a day. This latest batch had some that had electric shorts that prevented the PC from starting!

You may want to buy two of the HP power supplies also.

As an option, you can buy AMD RX480 graphics cards instead of Fury’s. The RX480’s use less power, and work better for mining Ethereum and Monero. Most of my mining rigs use AMD RX480’s. Here is one I like a lot:

XFX Radeon RS RX 480 DirectX 12 RX-480P836BM 8GB 256-Bit GDDR5 PCI Express 3.0 CrossFireX Support Video Card

I always forget something when I build the machine. Here’s some basic instructions for the most efficient order of operations. The idea is to get a basic computer built, troubleshoot any potential issues, install the operating system and application, then build the rest of the machine.

  1. Assemble the Case
  2. Put the CPU, CPU fan, and memory on the motherboard. Plug in the fan.
  3. Attach the ATX switches and LED’s to the power header.
  4. Plug the SATA cable into the motherboard.
  5. Put the motherboard in the case on the already attached rubber offsets.
  6. Attach the Antec power supply to the right side of the case. Use the screws that came in the box. Attach power cables from the Antec power supply to the Motherboard, CPU power, SSD.
  7. Attach the HP power supply and X5 board to the left side of the case. Use the bottom two fan screws from the HP power supply.
  8. Screw in one of the PCI-X Riser cards, plug it into the PCI-E slot closest to the processor, and plug in power from the power supply.
  9. Attach a keyboard, mouse, and HDMI monitor to the machine.
  10. Plug the power cord into the Antec power supply, turn on the power switch.
  11. Press the ATX power button. The machine should boot.

If it doesn’t boot, this is the time to do basic troubleshooting. Don’t add any more graphics cards until later after the operating system is installed. The motherboard has a VGA connector if you want to connect a monitor directly to it. Just make sure there are no graphics cards plugged in if you use the onboard video.

Install Ubuntu 16.04 LTS Server
Do a standard install using all the defaults , include OpenSSH on installation
After install, login with your username and password
Get ip address with

ifconfig

Go to your PC, ssh to the Ubuntu machine, and do the rest of the setup from your PC so you can copy and paste the commands. I prefer to SSH from Bash shell, but Putty is a good client also.

Install some basics

sudo apt update
sudo apt install git screen vim nmap ncdu busybox inxi links unzip python

Change colors in the VIM editor. If you don’t like VIM, use nano instead.

vim .vimrc

Add in new file .vimrc

:color desert

Improve the bash shell

vim .bashrc

In the file .bashrc
change #force_color_prompt=yes
to

force_color_prompt=yes

add this at the end:

LS_COLORS=$LS_COLORS:'di=0;36:' ; export LS_COLORS

Upgrade the operating systems in a screen:

screen -S upgrade
sudo apt dist-upgrade

ctrl-a d to get back

Not sure why Ubuntu locks one IP address into itself when it first gets an IP address. But it does. So that needs to be changed.
Step 1: Disable the default Firmware inherited names.
Edit your /etc/default/grub

sudo vim /etc/default/grub

Change the line from
GRUB_CMDLINE_LINUX_DEFAULT=””
to

GRUB_CMDLINE_LINUX_DEFAULT="text"

Change the line from
GRUB_CMDLINE_LINUX=””
to

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

make it take effect

sudo update-grub

Step 2: Create the persistent file /etc/udev/rules.d/70-persistent-net.rules as root and fill them.

sudo vim /etc/udev/rules.d/70-persistent-net.rules

Paste this into the new file you just created:

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
# # You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.
# PCI device lan Device
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:yy:XX:yy:XX:yy", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="ethX"
# PCI device Wlan Device
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:yy:XX:yy:XX:yy", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="wlanX"

Edit the network interfaces:

sudo vim  /etc/network/interfaces

Change device names to eth0 so it reads:

# The primary network interface
auto eth0
iface eth0 inet dhcp

Look up your hardware device name (MAC address) with

ifconfig

example:

HWaddr 4c:cc:6a:67:57:07

Go to your DHCP server and map your preferred IP address to the hardware address. You’re on your own for that one.
Check in the screen to make sure the update is finished

screen -r

When the update is finished REBOOT

sudo reboot

ssh to box using the new IP address you assigned in your DHCP server!
If you didn’t, then it should be at the same address as before. If you can’t find it, login to the terminal at the computer, type

ifconfig

if you only have a loopback address of 127.0.0.1 then run the DHCP client to get an ip address you can ssh to

sudo dhclient

and redo the network fix.

Copy 3 files from PC to server
AMD Linux Ubuntu Driver 16.50
AMD OpenCL SDK 3.0
Claymore’s ZCash AMD GPU Miner v11.0 (Windows/Linux)
Install AMD driver

tar xf amdgpu-pro-16.50-362463.tar.xz
cd amdgpu-pro-16.50-362463/
sudo ./amdgpu-pro-install

Install AMD SDK

tar xf AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2
sudo ./AMD-APP-SDK-v3.0.130.136-GA-linux64.sh

Add user to video group

sudo usermod -a -G video $LOGNAME

Check amdgpu driver status

sudo apt install clinfo
sudo clinfo
sudo clinfo | grep compute

REBOOT

Install xorg

sudo apt install xorg  xserver-xorg-legacy xserver-xorg-video-dummy

Edit the config file for xorg-legacy:

sudo vim /etc/X11/Xwrapper.config

delete the last line:
allowed_users=console
insert at end of file:

allowed_users=anybody
needs_root_rights=yes

Create a new file for operating without a monitor connected to box:

sudo vim /etc/X11/xorg.conf

create new file xorg.conf:

Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen8" 0 0
EndSection

Section "Files"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "built-ins"
EndSection

Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "ShadowFB" # [<bool>]
#Option "DefaultRefresh" # [<bool>]
#Option "ModeSetClearScreen" # [<bool>]
Identifier "Card8"
Driver "dummy"
VideoRam 16384
EndSection

Section "Monitor"
Identifier "Monitor8"
HorizSync 15.0-100.0
VertRefresh 15.0-200.0
Modeline "1600x900" 33.92 1600 1632 1760 1792 900 921 924 946
EndSection

Section "Screen"
Identifier "Screen8"
Device "Card8"
Monitor "Monitor8"
SubSection "Display"
Viewport 0 0
Depth 24
Virtual 1600 900
EndSubSection
EndSection

Make sure X works for user on login

vim .bashrc

Add the following at end of .bashrc

export DISPLAY=:0

Change /etc/profile to make it work

sudo vim /etc/profile

# add the following at end of /etc/profile:

export XAUTHORITY=~/.Xauthority

Set variables when user calls X

vim .xinitrc

create new file .xinitrc:

#!/bin/bash
DISPLAY=:0 && xterm -geometry +1+1 -n login

Install dependency:

sudo apt install libcurl3

Prepare Claymore binary

mv Claymore\'s\ ZCash\ AMD\ GPU\ Miner\ v10.0\ Beta\ -\ LINUX\ -\ Catalyst\ 15.12-16.x.tar.gz claymore10
tar xf claymore10
cd claymore10

Create a start script

vim mine.sh

Create new file:

#!/bin/sh
xinit &
sleep 5
#export GPU_FORCE_64BIT_PTR=1
#export GPU_MAX_HEAP_SIZE=100
#export GPU_USE_SYNC_OBJECTS=1
#export GPU_MAX_ALLOC_PERCENT=100
#export GPU_SINGLE_ALLOC_PERCENT=100

./zecminer64

Make it executable

chmod +x mine.sh

Update config.txt file. Use your own zcash address if you prefer in the zwal setting.

-zpool us1-zcash.flypool.org:3333
-zwal t1TGP8AzTBjS3kxxXQNPqmpBQjWaTLFhEKZ.rigz
-zpsw x
-di 0123456
#-tt 75
#-i 6
#-logfile /home/user/log/lognoappend

Enter a screen

screen -S mining

run the miner

./mine.sh

Watch and see if anything breaks. This could be an error code, hardware freeze, or something else.

If it goes well, great! Go on to the next step. To exit the screen and keep the miner running when you log out of your session, type a Ctrl-a, followed by just the key d.

ctrl-a d

Then exit your ssh session with

exit

If there is a problem, it is usually:

  • riser hardware problem
  • power cable or power supply problem
  • resource contention. If this happens, turn off unneeded service in the BIOS. First turn off sound, then serial port.

Add one riser and GPU at a time, boot, and make sure it works. First power 3 of the cards from the Antec power supply. Then power the other 3 cards with the HP power supply. Quick way to see if Ubuntu recognizes the board is with

lspci | grep VGA

or

sudo clinfo | grep compute

This box is going to pull 15 amps at 110 VAC. Be careful with your breakers. The power supplies run more efficiently at 200+ volts. If you have the option to supply your miner with more than 200VAC, do it.

Best of luck — let me know if you have comments or questions on this build.

Rolf Versluis


Originally published at Block Operations.

Block Operations

Making money with Bitcoin and Altcoin mining

    Rolf Versluis

    Written by

    Techie, Sales Guy, Business Owner. Former US Navy Submarine Officer. Co-Founder and Executive Adviser for Horizen Cryptocurrency

    Block Operations

    Making money with Bitcoin and Altcoin mining