Sunday, August 21, 2016
Ethereum mining on Ubuntu Linux
For a couple months, I've been intending to do a blog post on mining with Ubuntu. Now that I've been able do make a static build of Genoil's ethminer, that process has become much easier. Since I have no Nvidia GPUs, this post will only cover how to mine with AMD GPUs like the R7 and R9 series.
The first step is to download a 64-bit Ubuntu 14.04 desktop release. I use the desktop distribution since it includes X11, although it is possible to use Ubuntu server and then install the X11 packages separately. I recommend installing Ubuntu without any GPU cards installed (use your motherboard's iGPU), in order to confirm the base system is working OK. Follow the installation instructions, and at step 7, choose "Log in automatically". This will make it easier to have your rig start mining automatically after reboot.
After the initial reboot, I recommend installing ssh server. It can be installed from the shell (terminal) with: "sudo apt-get install openssh-server -y". Ubuntu uses mDNS, so if you chose 'rig1' as the computer name during the installation, you can ssh to 'rig1.local' from other computers on your LAN.
Shutdown the computer and install the first GPU card, and plug your monitor into the GPU card instead of the iGPU video port. Most motherboards will default to using the GPU card when it is installed, and if not, there should be a BIOS setup option to choose between them. If you do not even see a boot screen, try plugging the card directly into the motherboard instead of using a riser. Also double-check your card's PCI-e power connections.
Once you are successfully booting into the Ubuntu desktop, edit /etc/init/gpu-manager.conf to keep gpu manager from modifying /etc/X11/xorg.conf. Then install the AMD fglrx video drivers: "sudo apt-get install fglrx -y". If the fglrx drivers installed successfully, running "sudo aticonfig --lsa" will show your installed card. Next, to set up your xorg.conf file, run "sudo rm /etc/X11/xorg.conf" and "sudo aticonfig --initial --adapter=all".
After rebooting, if the computer does not boot into the X11 desktop, ssh into the computer and verify that /etc/modprobe.d/fglrx-core.conf was created when the fglrx driver was installed. This keeps Ubuntu from loading the open-source radeon drivers, which will conflict with the proprietary fglrx drivers. For additional debugging, look at the /var/log/Xorg.0.log file.
Continue with installing the rest of your cards one at a time. Re-initialize your xorg.conf each time, by executing "sudo rm /etc/X11/xorg.conf" and "sudo aticonfig --initial --adapter=all". Reboot one more time, and then exeucte, "aticonfig --odgc --adapter=all". This will display all the cards and their core/memory clocks. If you are connecting remotely via ssh, you need to run, "export DISPLAY=:0" or you will get the "X needs to be running..." error. You can use aticonfig to change the clock speeds on your card. For example, "aticonfig --od-enable --adapter=2 --odsc 820,1500" will set card #2 to 820Mhz core and 1500Mhz memory (a good speed for most R9 380 cards). To simplify setting clock speeds on different cards, I created a script which reads a list of card types and clock rates from a clocks.txt file.
Once your cards are installed and configured, you can use my ethminer build:
tar xzf ethminer-1.1.9nr-OCL.tgz
Once you've confirmed that ethminer is working, you can edit the mine.sh script to use your own mining pool account. If you want your rig to start mining automatically on boot-up, edit your .bashrc and add "cd ethminer-nr" and "./mine.sh" to the end of the file.
Subscribe to: Post Comments (Atom)
What hash-rate advantage are you seeing over the the built-in ethminer in the C++ ethereum implementation?ReplyDelete
There has been little change to the OpenCL kernel since the fork from cpp-ethereum other than the on-GPU DAG generation, so hashrates are virtually identical. However support for stale share submits and stratum mode means that mining returns will be a few percent higher than with cpp-ethereum.Delete
Waiting for work package ...ReplyDelete
:-( Rejected in 64025 ms...
Had to delete the DAG files in ~/.ethash
Is that normal ? Or is it only because I switch from genoils ethminer to your binary ?
DAG files haven't been used since well before I created my fork from Genoil's. They're dynamically generated (you should see that in the startup output).Delete
Did you try the included mine.sh?
Yes I have tried the mine.shReplyDelete
Still getting that crazy Rejected in ms...
in between "Waiting for work package"
Don't know what the heck ?
When I do the next build I'll try to do a debug build as well that dumps the json messages from the pool.Delete
This comment has been removed by a blog administrator.ReplyDelete
Getting segmentation fault when trying to start the miner from SSH session instead of local console. Same problem with genoils miner. Any ideas ?ReplyDelete
You're probably getting some X error message before that. It happens if you do not have a X session logged in. That's why I said to choose "Log in automatically" when you setup Ubuntu.Delete
Thanks for posting the latest compiled ethminer-1.2.0nr-OCL.tgz. I'm using it on a headless ubuntu 16.04 system and its running great!ReplyDelete
I really like how it integrates the stratum and ethminer into one.
While I did some tweaks & bug fixes on the native stratum implementation, most of the work was done by Genoil.Delete
ok, cool. I'll follow Genoil's work and recompile if he updates. Thanks again.Delete