How to install AMD GPU drivers in Ubuntu

Linux and AMD graphics cards drivers are not always the best friends, specially for people that are new to this Linux world. In this post I’m gonna try to explain how to install the most recent drivers and overcome the most common errors. In my case, I had Elementary OS installed with an R9 380X and everything worked well. But then I bought a RX 6800 and it just didn’t work, no matter what I tried. Only one of my three monitors worked, hardware acceleration was off, couldn’t get more than 1024x768, etc. I thought it was a distro problem… So I installed Linux Mint 20.04 and…… same problem. So I wasted a few more hours trying stuff and then I got it to work. I’m gonna try to explain what I did so other people don’t need to waste hours of their lifes.

Before you start

Keep in mind that these steps may not work for every distro and every Ubuntu version. In my case I have Linux Mint 20.04 LTS, and it worked. We will update kernel, so, make sure you understand what that means and the risks associated with it before proceeding.

Remove all the old drivers

This is a must. If you are in a fresh install, skip this steps. If you aren’t, try and remove ALL the amdgpu and amdgpu-pro packages from your PC, depending on the version you have. You can do this by running:
amdgpu-uninstall or amdgpu-pro-uninstall

Download the new drivers

Go to the AMD website and download the latest Linux drivers for your GPU. Decompress it by running:
tar -Jxvf amdgpu-pro-20.45–1164792-ubuntu-20.04.tar.xz

Install the drivers

Run the install script:
./amdgpu-install

Time to update your kernel

Open THIS repository and open the latest version of the kernel available there. In my case it was 5.10. Now go inside that folder and then inside amd64 (example). You will download every .deb file there, except the ones that have low latency in their names. In the end you should end with 4 downloaded files. Download them all to a folder and then install them all by running:
sudo apt install /your-dir/*.deb

Remove amdgpu-dkms

You can now remove this package as you will not need it.
sudo apt remove amdgpu-dkms

Remove amdgpu blacklist

Open this file by running:
/etc/modprobe.d/blacklist-amdgpu.conf

Update the firmware

Go back to the folder that has the extracted driver you downloaded in the beginning and extract the firmware by running:
dpkg -x amdgpu-dkms-firmware_5.6.20.906300–1164792_all.deb tmp

Example output

Update initramfs

sudo update-initramfs -u

Reboot

Reboot and you are done, your drivers should be working now.