01 Jun 2021

Setup an AMD RX6800(XT)/RX6900 on Ubuntu 20.10

This is an opinionated guide on how I set up my computer which runs on an AMD Ryzen 7 5800X as well as an AMD RX6800 GPU. There are few guides out there that cover the topic of setting up systems with AMD GPUs, but I found none to my liking.

Mostly my idea of a stable system and which PPAs to use differs from other authors’ - their basics were correct though and I learned a lot by reading their articles and guides. So I decided to write down my own guide in the hopes, that someone may benefit from that.

You are responsible for any damage inflicted to your computer by following this guide! I can not be held responsible for broken computers and limbs, nor for any world ending catastrophes!

Prerequisite

  1. fresh install of Ubuntu 20.10 Groovy Gorilla (this may perhaps work similarly with Hirsute, but I did not yet test it)
  2. a basic understanding of what Linux is and how Ubuntu can be configured
  3. basic terminal skills - you need to edit files and install packages
  4. Internet connection
  5. time and a beverage of your choice (remember: hydration is important)
  6. having read this guide in its entirety at least once - having it understood would be beneficial

It’s best to copy’n’paste these commands instead of reading and writing them to avoid any typos and missing spaces. But first read through them thoroughly to make sure I did not make any mistakes that may delete stuff you intend to keep.

I strongly recommend to first read this guide at Level1Techs Forum by Wendell, which explains most aspects in a very good and understandable way.

Installing tools and utilities

This chapter will mostly prepare the system for what is to come thereafter. At any time during these steps you can stop and quit. Worst case you will have some tiny tools on your computer you may not need.

sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y install software-properties-common ppa-purge

Install Xanmod kernel

This will install a more recent kernel - 5.12.8 at the time of writing - built by the great folks over at xanmod.org. If you are interested in the reasoning for this step please visit the Level1Techs Forum where all the background has been explained by their member “Wendell” very well.

The only thing my opinion is differing is that I wish to have a system, where I do not need to remember to upgrade any package every few weeks/months. So I’m trying to use constantly updated package repositories instead of the Ubuntu Linux Archive.

echo 'deb http://deb.xanmod.org releases main' \
  | sudo tee /etc/apt/sources.list.d/xanmod-kernel.list
wget -qO - https://dl.xanmod.org/gpg.key \
  | sudo apt-key --keyring /etc/apt/trusted.gpg.d/xanmod-kernel.gpg add -
sudo apt-get update
sudo apt-get install -y linux-xanmod-edge xanmod-repository

# you may instead need to install `intel-microcode` and `iucode-tool` with Intel CPU
sudo apt-get install -y amd64-microcode 

I experimented with the Liquorix kernel as well. Though I do not remember exactly why I preferred Xanmod, I believe it had something to do with performance while I tested with Phoronix Test Suite. But you mileage may vary depending on your CPU, mainboard, RAM, disk, … - so perhaps you get over there and have a look at it for yourself?

Install newer Mesa

As the aforementioned Level1Techs Forum suggests to use Oibaf’s PPA, I initially did so, too. Not long after I found the constant updates of the repository annoying enough to search for a more conservative alternative.

And found it in the form of Kisak’s kisak-mesa fresh PPA. Kisak does not use the latest Git - as Oibaf does - but uses the latest stable release of mesa.

Kisak’s PPA is still updated every now and then (weekly, monthly - something like that), but not daily - or even multiple times a day.

sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt-get update
sudo apt-get -y dist-upgrade

# not sure if this is needed, may be installed automatically as dependency of mesa_21.1.*
sudo apt-get -y install llvm-12

Install AMDVLK

The readme at GPUOpen’s AMDVLK and the package description itself talks about Ubuntu 18.04, but apparently it still works with 20.10

echo 'deb [arch=amd64] http://repo.radeon.com/amdvlk/apt/debian/ bionic main' \
  | sudo tee /etc/apt/sources.list.d/amdvlk-repo.list
wget -qO - https://repo.radeon.com/amdvlk/apt/debian/amdvlk.gpg.key \
  | sudo apt-key --keyring /etc/apt/trusted.gpg.d/amdvlk-repo.gpg add -
sudo apt-get update
sudo apt-get -y install amdvlk

If you encounter any problems, you should remove this package and rather build it yourself by following their installation instructions

Almost done

Now before we reboot, we need to make sure the amdgpu kernel module is not blacklisted.

Look at /etc/modprobe.d/blacklist-radeon.conf and /etc/modprobe.d/blacklist-amdgpu.conf to make sure the module name is either commented or the file missing completely.

Reboot

Now finally you can reboot your computer.

Cleanup

After that we can cleanup any stock kernel:

sudo apt purge --auto-remove \
  linux-headers \
  linux-headers-5.8.\* \
  linux-headers-generic \
  linux-image \
  linux-image-5.8.\* \
  linux-image-generic \
  linux-modules-5.8.\*

Important notes

Right now, there are two vulkan drivers installed in parallel, which is totally fine. Per default AMDVLK is used, but if you wish to use RADV, you need to explicitly set an env variable before starting a vulkan client:

# running with RADV:
AMD_VULKAN_ICD=RADV vulkaninfo

# if you prefer to set AMDVLK explicitly:
AMD_VULKAN_ICD=AMDVLK vulkaninfo

Done

Congratulations, you did it to the end of this post.

What’s next? I plan on creating a post about what I installed after that. My rig is mostly gaming and streaming related, but also contains a few tools around coding and scripting.

So if you are interested in these topics: stay tuned!