How to Install AMD OpenCL GPU Drivers on Ubuntu 20.04 for Miners | Jan 2022

How to solve one of life's greatest mysteries, installation of AMD drivers on Linux.

Update: April 2022. A new and much simpler method for Debian 11 OpenCL drivers has been released. Click here to view it.

UPDATE: January 2022 The whole method still works but the recommended distros that i have personally tested that work are 20.04 and Debian Bullseye. Start with a server image and add a desktop if you need to AFTER you have tested that the drivers have installed correctly from following this guide.

UPDATE: December 2021 – Those using Plasma desktop will find they have problems, especially when using Kubuntu for instance. Best to switch to a different distro like Xubuntu or anything that doesn’t use plasma desktop until a fix is released. I have been waiting a few days myself and still no fix.

Installing drivers on Linux can be an absolute disaster waiting to happen. You install the drivers and you get either a black screen or the system will simply refuse to boot. I have tried absolutely every way to install them and i almost always have problems. (bare with me and i promise in the end you will have a solution and an understanding why so you will never have problems with AMD drivers on Linux again)

If you google “how to install AMD drivers on Linux” you will inevitably get led down the wrong path and there is no clear and easy way out of that rabbit hole of disasters.

The problem is all the guides are meant for users wanting to game on their system not mine Ethereum so that’s where the first problem arises because you will see everywhere that the AMD drivers are already installed to the kernel, which they are BUT the part you need to mine is not there because AMD did not include the OpenCL drivers in the kernel driver.

Type the command below and see for yourself, you will see the card is recognised and drivers have been loaded.

sudo lshw -c video

So now you can see how we can easily be led down the wrong path, are they installed or not?.

Driver Installation: Updated Feb 2022

First and foremost. You want to be on the latest version of Linux with the latest kernel. At the time of writing the details are:-

  • Ubuntu 21.04 (Kubuntu) EDIT Use Any Ubuntu 20.04 or Debian Bullseye!
  • Kernel: 5.11 or 5.10
  • AMD RX 580 8GB STRIX

You may read online that older drivers are the best option but this is outdated information. All we need to do is install the OpenCL package on its own, without any of the other addons.

First lets install a couple of packages:

sudo apt install build-essential dkms

From here we need to download the drivers from AMD Official Website and unzip the package.

Let’s get an older version of the drivers because we only need the OpenCL component.

wget https://drivers.amd.com/drivers/linux/amdgpu-pro-20.40-1147286-ubuntu-20.04.tar.xz --referer https://www.amd.com/en/support/kb/release-notes/rn-amdgpu-unified-linux-20-40

Use wget with the code above to download to a terminal, you can also visit the link below to download manually.

https://www.amd.com/en/support/previous-drivers/graphics/radeon-500-series/radeon-rx-500-series/radeon-rx-580

Unzip the tar. You may need to install the unzip tools with apt install xz-utils

tar -xJpf amdgpu-pro-*.tar.xz
Change into the created directory
cd amdgpu-pro-20.40-1147286-ubuntu-20.04

Now you can proceed with the command to install.

./amdgpu-pro-install -y --opencl=pal,legacy,rocm --headless

What this command does is install just the OpenCL driver so you can get your cards mining again on the latest OS! EDIT: It is advised to use Ubuntu 20.04 or Debian Bullseye at the current time.

If that doesn’t work for you and you get errors regarding dkms you can use the no-dkms flag.

./amdgpu-install -y --opencl=pal,legacy,rocr --no-dkms --headless

We can install clinfo to check if OpenCL is installed use

sudo apt install clinfo

and you should be greeted with something like the below

Number of platforms                               1
  Platform Name                                   AMD Accelerated Parallel Processing
  Platform Vendor                                 Advanced Micro Devices, Inc.
  Platform Version                                OpenCL 2.1 AMD-APP (3302.5)
  Platform Profile                                FULL_PROFILE
  Platform Extensions                             cl_khr_icd cl_amd_event_callback cl_amd_offline_devices 
  Platform Extensions function suffix             AMD
  Platform Host timer resolution                  1ns

  Platform Name                                   AMD Accelerated Parallel Processing
Number of devices                                 1
  Device Name                                     Ellesmere
  Device Vendor                                   Advanced Micro Devices, Inc.
  Device Vendor ID                                0x1002
  Device Version                                  OpenCL 2.0 AMD-APP (3302.5)

Congratulations, you can get back to mining again.

UPDATE: As an added extra you can also install the Wattman alternative for overclocking. The software is called Corectl and you can get it on GitLab

sudo add-apt-repository ppa:ernstp/mesarc
sudo apt-get update

Then unlock power controls by adding “amdgpu.ppfeaturemask=0xffffffff” to your grub file

first do

sudo nano /etc/default/grub

We need to add "amdgpu.ppfeaturemask=0xffffffff" to the line that starts with GRUB_CMDLINE_LINUX_DEFAULT and add it in like below

GRUB_CMDLINE_LINUX_DEFAULT="quick splash amdgpu.ppfeaturemask=0xffffffff"

Update the grub with

sudo update-grub

Reboot

sudo reboot

We can now install correctrl

sudo apt install corectrl

Now we can control the overclocking voltages and speeds

Below is a picture of corectl stats, if your GPU stats look like this you should change your thermal paste. As i quickly found out soon after posting this.

Corectl graphical user interface
CoreCtl GUI

Here is an image of my GPU stats AFTER applying new thermal paste. 😂

corectl proper image
Corectl main GUI after applying new thermal paste.

Corectl will ask for root password every time on boot, you can disable this by following the instructions on the corectl setup page HERE

Share This Guide!