Ethereum GPU cryptocurrency mining with Ubuntu 20.04 / AMD OpenCL Compute in Linux

Jose Ignacio Martinez
6 min readAug 25, 2020

Update March, 2022: Please do not follow this guide if you plan to mine only, you will save loads of time by going into a free to start solution like Hive OS or mmpOS operative systems, they based on Linux and is by far the most stable, efficient and simple way of mining today, even if you are mining only overnight ;)

Howdy! :) I just wanted to write my own story of frustration and success while doing Ethereum GPU cryptocurrency mining. I’ve been doing this as a hobby for a few years now, and I think it’s time to give some advice back to the community.

Ethereum cryptocurrency logo

I’ll be covering most of the process from scratch, including:

  • Software involved (OS, GPU drivers, Ethereum wallet and mining clients)
  • Hardware needed (AMD Radeon RX4XX/5XX, Vega 56/64, VII, 5XXX, for Ethereum ≥4GB)

Most of the tutorials out there are pretty old and do not cover updated software, so lets start describing what I already did without much luck. For the fun part, jump straight into “Hands on”.

Windows 10 is a good option to start due you are probably familiar with it, and also software and drivers are quite easy to install/use, however is not open-source, not secure and could be quite unstable for long-term mining (yeah, thanks windows update). So instead of covering Windows, ill be describing how to do this with an open-source operative system (yeah, thanks Linux).

Initially I tested the good old Ubuntu 16.04, with several AMDGPU-PRO compatible drivers (17.40–483984, 17.40–492261 and 18.40–673869). None of those worked properly with old+new cards connected. I mean for my old Radeon RX 570 only, worked like a charm, but was very buggy along a RX 580/590 and 5700 XT. Including but not limited to poor hashrate, full fans speed, overheating, video crash, “drm failed testing IB on ring” errors, black screens and reboots. Ubuntu 18.04 was fine with amdgpu-pro-18.40–673869 and RX 570, but wont even boot the ISO with newer cards in place. So with not much alternative, I gave the latest Ubuntu release a try. According to the official AMD support driver website is supported, so why not?

Hands on

So this will be the first step, download Ubuntu 20.04.01 ISO and deploy the ISO file into a USB drive, DVD, memory card, anything that holds the ISO and can be booted by your motherboard. If you are using a USB device, I recommend using Rufus create the boot drive, is simple and effective.

My current mining rig is not dedicated, I use it for work and gaming, also I don't like dual-boot for this purpose, so my setup use a USB drive to host the OS. Any flash drive≥2GB should work, of course you can use dual-boot, another hard drive or any other storage, Linux is very flexible and tolerant. Now install Ubuntu Server, nothing special about the setup, I avoided all the extra software and the only optional component installed was the SSH server for remote access. Reboot and login.

Some people will recommend to do a full apt update && apt upgrade, I don't. Any change in the kernel may broke the drivers setup and will be very hard to go back to the original state. Also during the OS install, if a internet connection is configured, security updates will apply on-the-fly safely.

Drivers

At this point you will need the AMD GPU PRO driver, you could download from AMD support website (make sure is the Linux driver for Ubuntu 20.04.1) and them move it into Ubuntu, or download directly from your console using the following command.

wget https://drivers.amd.com/drivers/linux/amdgpu-pro-20.30-1109583-ubuntu-20.04.tar.xz --referer https://support.amd.com

Now we need to extract the file and install the drivers, note that we are installing legacy drivers with the rocm component and in headless mode.

*** ROCm is the open-compute platform, we may not needed but I recommend have it just in case, many tools related with cryptomining use it.

tar -Jxvf amdgpu-pro-20.30-1109583-ubuntu-20.04.tar.xz
cd amdgpu-pro-20.30-1109583-ubuntu-20.04/
./amdgpu-pro-install -y --opencl=legacy,rocm --headless

Once installation has completed, reboot and login again.

Mining clients

I will assume at this point that you are aware that there’s endless cryptocurrencies available to mine using GPUs, therefor there’s many mining clients; Close and open-source, multi-coins, dual miners, with and without a developer fee (devfee). Is not easy to pick your first GPU mining client, but in simplification I’ll explain how to use two miner clients that I use to mine Ethereum.

The first one, EthMiner is the official open-source mining client without any devfee and the second one is PhoenixMiner, a more advanced mining client that have devfee of 0.65%. This means that every 90 minutes the miner will mine for its developers, for 35 seconds. Why two clients? Well, it’s good to have an alternative, compare performance, and also PhoenixMiner allow us to mine Ethereum with 4GB GDDR video cards, while this is not possible now with EthMiner due DAG size.

Download and install clients, create scripts and edit them could be very challenging for most people, specially from a terminal. So, for easy to use and also move a bit faster, I created a public repository with the clients, tools and the scripts to run your mine operation in no time. To be able to clone and use this repository, make sure you have git installed first, then clone it locally with the second command.

sudo apt update && sudo apt install git -y
git clone https://github.com/sur1v/ethereum-quickstart.git

Now the the repository has been cloned, let’s get into and test our recently installed drivers.

cd ethereum-quickstart
./start_ethminer.sh

If everything goes as planned you should see the DAG generation and the miner slowly starting to work, also your video card(s) should soon start speeding they fans. Let it mine for like 15 mins to stabilize hash-rate and take notes of the speeds per card (MH/s). You can interrupt this with Ctrl+C.

Now run PhoenixMiner, wait for another 15 minutes and compare speeds.

./start_phoenixminer.sh

A small increase in hashrate (>2 MH/s) compared with ethminer, will make worth using PhoenixMiner even with the devfee (bigger profit).

ethminer in action with Radeon RX570 and RX590
Don’t worry about the CUDA error, both mining clients support mixed cards (NVIDIA)

Ethereum pool and wallet

Now that we have the hardware (GPUs) and software (mining clients) working together, we need to move to the wallet and pool. This is not specifically for Ethereum, every cryptocurrency miner require this information. The wallet is the final destination of your profit (cryptocoins) and the pool is a massive amount of workers (miners) working together to resolve the blockchain problems.

To create a wallet I recommend skip using website or 3rd parties, they are not safe. My choice for Ethereum is create the wallet direct into the blockchain using Geth, the Ethereum node client. You can follow up the instructions here. Make sure to store the private key and password in a safe place, this will allow you to use or move your cryptocoins later. One thing that is public is your wallet, is a string that looks like this (starts with 0x):

0xc4a02f2683d45dad7efb5bd29909b9e4d27eddf7

The pool act as a proxy, helping many miners to work together against the problem, to have a reward even if you mining power (hashrate) is very small. I’ve been mining with Nanopool for many years now, is very stable and have worldwide servers. Another nice things about pools, with your address you will be able to see the current workers and they hashrate and rewards, they do payments to wallets every 0.1 ethereum collected.

Mine using your wallet

Now you can mine on any pool with your wallet, so is time to edit the script and replace your wallet, this could be done with any text editor or forking the repository and changing the address (and pool if you are not using Nanopool).

If this worked for you, mine to my wallet for a bit :) also accepting donations to 0xc4a02f2683d45dad7efb5bd29909b9e4d27eddf7. Thanks!

--

--

Jose Ignacio Martinez

The Chilean Patagon. Cloud engineer, mountain and kayak guide, crypto-miner, gamer and wannabe DJ!