The AMD installation instructions for ROCm 5.2.1 state that ROCm is only compatible with Ubuntu 20.04

Can I still install and use it on Ubuntu 22.04?

2 Answers 2


Yes, I believe you can. Doing the following, I a least successfully installed ROCm 5.1.1 on the Ubuntu-based Pop!_OS 22.04. I am now able to run PyTorch computations on my GPU, an AMD RX 6800 XT.

I essentially followed this comment, with a bit of extras. See also that comment for reasons for some steps.

Some places below, you must replace 5.1.1 with the version you want.


We going to use a terminal. So open one. Create a directory to work in:

mkdir ~/ROCm && cd ~/ROCm

Update, then download the .deb file for amdgpu-install, and install it (link gotten from AMD):

sudo apt update
wget https://repo.radeon.com/amdgpu-install/22.20.1/ubuntu/focal/amdgpu-install_22.20.50201-1_all.deb
sudo apt-get install ./amdgpu-install_22.20.50201-1_all.deb

We now have to edit amdgpu-install:

sudo gedit /usr/bin/amdgpu-install 
  1. Pop!_OS is not listed as supported by amdgpu-install, so we add it: Search for ubuntu, and add |pop to the list (| reads "or").

  2. Search for linux-modules-extra and replace the entire function debian_build_package_list() with, on one line,

     function debian_build_package_list() { echo 'empty function'; }
  3. Save and quit

Python 3.8

Packages in the next steps require that we have also the older Python 3.8 installed. So:

sudo add-apt-repository --yes ppa:deadsnakes/ppa
sudo apt-get update
sudo apt install --yes python3.8

ROCm Repositories and Package Editing

Next, we add the desired ROCm repository. The link is relative to the ROCm version to be installed, so look up the base URL here.

echo 'deb [arch=amd64] <Release-1 specific rocm baseurl> ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list
sudo apt update

I used ROCm 5.1.1, so I used specifically

echo 'deb [arch=amd64] https://repo.radeon.com/rocm/apt/5.1.1 ubuntu main' | sudo tee /etc/apt/sources.list.d/rocm.list

The download the .deb file for the ROCm package:

apt download rocm-llvm5.1.1

Edit Package 1/2

We need to edit this package before it will install. So we unpack, unpack and edit (by <tab> I mean press Tab to autocomplete):

 ar x rocm-llvm<tab>
 tar xf control.tar.xz
 gedit control

In control, edit the Depends line to

Depends: python3, libc6, libstdc++6|libstdc++8, libstdc++-5-dev|libstdc++-7-dev|libstdc++-10-dev, libgcc-5-dev|libgcc-7-dev|libgcc-10-dev, rocm-core5.1.1

I.e., add |libstdc++-10-dev and |libgcc-10-dev in the appropriate positions.

Then repack:

tar c postinst prerm control | xz -c > control.tar.xz
ar rcs rocm-llvm5.1.1_14.0.0.22114.50101-48_amd64.deb debian-binary control.tar.xz data.tar.xz

Great! Now, we install the possible dependencies we just added, and rocm-core5.1.1:

sudo apt install libstdc++-10-dev libgcc-10-dev rocm-core5.1.1

Now the downloaded package installed for me with

sudo dpkg -i rocm-llvm<tab>


Edit Package 2/2

Now we download, identically edit, and repack another package, openmp-extras5.1.1:

mkdir openmp && cd openmp
apt download openmp-extras5.1.1
ar x openmp<tab>
tar xf control.tar.xz
gedit control

Edit Depends line, add |libstdc++-10-dev and |libgcc-10-dev as before. Save, close, repack, install a dependency, and then the package with:

tar c control | xz -c > control.tar.xz
ar rcs openmp-extras5.1.1_13.51.0.50101-48_amd64.deb debian-binary control.tar.xz data.tar.xz
sudo apt install rocm-device-libs5.1.1
sudo dpkg -i openmp<tab>

I hope that all went smoothly.

Install ROCm

Install ROCm with the usecases you need. Mine are ROCm and HIP. See amdgpu-install --help for options.

sudo amdgpu-install --rocmrelease=5.1.1 --usecase=rocm,hip --no-dkms


Now a final piece of setup: Add your user to the render and video groups:

sudo usermod -a -G render $LOGNAME
sudo usermod -a -G video $LOGNAME

and reboot.

Once rebooted, check that ROCm is loaded with


Hurra!, I hope, and time for cleaning:

rm -rf ~/ROCm

PyTorch Postscript

Note: Be sure that the ROCm version you installed is supported by Pytorch. At time of writing, Stable supports ROCm 5.1.1, Nightly supports 5.2. Check the PyTorch Start Locally page.

I needed ROCm for PyTorch, installed with

pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.1.1

I then got verification that I could use my GPU for computation by running

import torch
  • 1
    This works great! (I used version 5.2.1, and installed on Pop!_OS 22.0.4) in version 5.2.1 the Edit Package 2/2 step was not required, because that package doesn't depend on libstdc++ Could you communicate this fix to the package owner? Sep 14, 2022 at 22:55
  • @EricHartford Nice to know! Alas, I'm not affiliated with them, so I am in a worse position than you to communicate it (as I didn't try 5.2.1).
    – Rasmus
    Sep 15, 2022 at 10:51
  • @Snow : done, changed to just apt.
    – Rasmus
    Mar 29 at 11:04

Update: as of ROCm 5.3.0, support for Ubuntu 22.04 has been added.

Installation guide: https://docs.amd.com/bundle/ROCm-Installation-Guide-v5.3


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .