Skip to content

Instantly share code, notes, and snippets.

@FCLC
Last active April 26, 2024 00:12
Show Gist options
  • Save FCLC/8c1f4d28d65a2e6d40b82f82c8fe4e08 to your computer and use it in GitHub Desktop.
Save FCLC/8c1f4d28d65a2e6d40b82f82c8fe4e08 to your computer and use it in GitHub Desktop.
Installing amdgpu-pro on popOS to enable OpenCL, ROCm and HIP

currently out of date as of September 2022, needs a fresh update

TLDR; edit the amdgpu-install script to add pop as supported debian distribution, comment out check for linux-modules-extra-[versions] since they're provided by linux-modules [per Jeremy Solle of System_76], then run with --no-dkms

3 EDIT: 4 things need to be done.

Problem 1) Pop!_OS not valid install target "Unsupported OS: /etc/os-release ID 'pop'" The issue as of now is that amdgpu-install doesnt recognize pop as a valid installation candidate. Solution is to add pop as a valid target in the amdgpu-install script.

As of Dec 1 2021: change line 241 to include | pop Pop!_OS will then be seen as a valid installation target

Problem 2) No linux-modules-extra package available

Package linux-modules-extra-5.15.5-76051505-generic is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'linux-modules-extra-5.15.5-76051505-generic' has no installation candidate

Pop!_OS includes what would normally be in linux modules extra in the standard linux-modules package, then marks linux-modules-extra as a virtual package [see https://twitter.com/jeremy_soller/status/1466061665548390402?s=20]

Solution is to remove the check by commenting out lines 360-363 Edit:the lines may have moved depending on version. You're loocking for the lines referencing linux-modules-extra

Problem 3) DPKG error kernel package not supported

ERROR (dkms apport): kernel package linux-headers-5.15.5-76051505-generic is not supported
Error! Bad return status for module build on kernel: 5.15.5-76051505-generic (amd64)
Consult /var/lib/dkms/amdgpu/5.11.32-1337797/build/make.log for more information.
dpkg: error processing package amdgpu-dkms (--configure):
 installed amdgpu-dkms package post-installation script subprocess returned error exit status 10
Errors were encountered while processing:
 amdgpu-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)

DKMS isnt needed, we're better off using the in kernel module already provided

Solution is to use the --no-dkms flag at install time

EDIT:2022/03/24

Problem 4) With the move from Hirsute to Impish, some repositories are no longer available and will cause the building of rocm-llvm to fail. The missing packages on a near vanilla instalation are: python-six, libgcc-5 series and libgcc-7 series.

As of now the best way to deal with this is to add the legacy LTS repositories from 18.04 LTS which have all missing packages to our apt sources and proceed that way.

Edit /etc/apt/sources.list and add the line deb http://mirrors.kernel.org/ubuntu bionic main universe

sudo apt update

Then run the command as before with the relevant options.

As always this isnt fully sanctioned and supported by AMD or System76 (creators and maintaners of Pop!_OS) but being as this is downstream Debian/Ubuntu you shouldn't run into any issues. No guarentees, but it seems fine on my end.

@kaydeejay
Copy link

I've been using an old version of blender because I can render with opencl, which disappeared from newer versions.
I was able to successfully get opencl running without conflicts by following this guide.

Newer versions of blender use HIP. Will following this guide allow me to do render with newer blender versions?

Also, I'm running pop 22.04 so I will also probably run into the insecure-repositories problem, is there another fix for that or is allowing insecure repos still the way to solve?

@FCLC
Copy link
Author

FCLC commented Jul 23, 2022

I've been using an old version of blender because I can render with opencl, which disappeared from newer versions. I was able to successfully get opencl running without conflicts by following this guide.

Newer versions of blender use HIP. Will following this guide allow me to do render with newer blender versions?

Also, I'm running pop 22.04 so I will also probably run into the insecure-repositories problem, is there another fix for that or is allowing insecure repos still the way to solve?

depends partially on if your GPU has proper HIP support.

the RX 5000 series has no HIP support at all

@kaydeejay
Copy link

I've been using an old version of blender because I can render with opencl, which disappeared from newer versions. I was able to successfully get opencl running without conflicts by following this guide.
Newer versions of blender use HIP. Will following this guide allow me to do render with newer blender versions?
Also, I'm running pop 22.04 so I will also probably run into the insecure-repositories problem, is there another fix for that or is allowing insecure repos still the way to solve?

depends partially on if your GPU has proper HIP support.

the RX 5000 series has no HIP support at all

Good to know, I'm using a RX 5600xt. Guess I'll just stick with old blender and opencl. Thank you!

@FCLC
Copy link
Author

FCLC commented Jul 25, 2022

Seems there's a new issue now as of 25/07/2022:

Python breaks when trying to run/install if you're also trying to install ROCm/HIP libraries

Looking into this now

@hanzy1110
Copy link

hanzy1110 commented Aug 14, 2022

Hi! I think I've run into the same python issue in Pop 22.04
Here's the output of amdgpu-install:

The following packages have unmet dependencies:
python3-six : Breaks: libpython-stdlib (< 2.7.18) but 2.7.15rc1-1 is to be installed
Breaks: python-minimal (< 2.7.18) but 2.7.15
rc1-1 is to be installed
python3-yaml : Breaks: libpython-stdlib (< 2.7.18) but 2.7.15rc1-1 is to be installed
Breaks: python-minimal (< 2.7.18) but 2.7.15
rc1-1 is to be installed
rocm-gdb : Depends: libpython3.8 but it is not installable
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

Any news?
Edit: properly followed the guide and the error changed

@limzykenneth
Copy link

The instructions in this comment works for me in setting up ROCm and eventually also running tensorflow through it. Further up the same thread, the advice on installing python 3.8 through deadsnakes also helped address the python dependency as well.

Running Pop 22.04 with RX6800, tested working all the way to installing tensorflow-rocm and importing it into python. Haven't tried running full ML code yet (it probably will work?) but it is the furtherest I got to getting ROCm to work on 22.04.

@siebtel
Copy link

siebtel commented Oct 28, 2022

Have it worked? @limzykenneth
For me, I had a problem installing it because of the kernel, mine is 6.x.x, and the supported one is up to 5.13

@limzykenneth
Copy link

It's tested and working fully for me, running pytorch and tensorflow without problems using GPU acceleration.

@Calcium3d
Copy link

Is there still no support for HIP rendering in blender on 5000 series?

@FCLC
Copy link
Author

FCLC commented Jan 5, 2023

Is there still no support for HIP rendering in blender on 5000 series?

If you're willing to build HIP yourself from source, then yes, Blender HIP can work on 5k series

@sajibsrs
Copy link

I was able to run both OpenCL and HIP on my RX 5500 XT (Pop!_OS)

@hanzy1110
Copy link

hanzy1110 commented Jan 15, 2023 via email

@sajibsrs
Copy link

sajibsrs commented Jan 15, 2023

First followed this tutorial. After that I had working OpenCL. Then I ran sudo apt-get install amdgpu-lib rocm-opencl-runtime rocm-hip-runtime. Reboot was not required at this point. That's it. Everything worked without a problem. I've tested blender render with HIP.

@arawup
Copy link

arawup commented Feb 9, 2023

First followed this tutorial. After that I had working OpenCL. Then I ran sudo apt-get install amdgpu-lib rocm-opencl-runtime rocm-hip-runtime. Reboot was not required at this point. That's it. Everything worked without a problem. I've tested blender render with HIP.

Can confirm that this works.

Warning shows up in:

  • Flatpak

Detects GPU(selectable in System):

  • PPA (when trying to render it will warn: HIP hipcc compiler not found. Install HIP toolkit in default location)

Renders(fully works):

  • tar
  • Snap

GPU: Radeon 5700
#wget link is from wget https://repo.radeon.com/amdgpu-install/ As sometimes the driver page isn't up to date. Also, the Radeon repo did have connection issues when I tried wget from it, just try it at another time.

wget https://repo.radeon.com/amdgpu-install/22.40/ubuntu/jammy/amdgpu-install_5.4.50401-1_all.deb --output-document ~/Desktop/amdgpu-install.deb

chmod u+x ~/Desktop/amdgpu-install.deb
sudo apt install ~/Desktop/amdgpu-install.deb
sudo sed -i 's/ID=pop/ID=ubuntu/g' /etc/os-release

sudo amdgpu-install --usecase=opencl --no-dkms
sudo usermod -a -G video $LOGNAME
sudo usermod -a -G render $LOGNAME
sudo apt install opencl-headers ocl-icd-libopencl1 clinfo -y

sudo sed -i 's/ID=ubuntu/ID=pop/g' /etc/os-release
clinfo | grep -i opencl
sudo apt-get install amdgpu-lib rocm-opencl-runtime rocm-hip-runtime -y
# rebooted

@ju8crafter-jaXnein
Copy link

Hello, Ive been trying to install ROCm/HIP for quite some time now to enable Blender rendering and tensorflow for my 7900xtx, but i didnt have any luck yet.
Im not sure if this here is the right place but maybe someone got an idea what to do next anyway.

On my current try i managed to install it properly at first glance using amdgpu-install --no-dkms --usecase=rocm with the most recent version of amdgpu-install (6.0.60002-1718217.22.04). But when it is installed the system wont start properly anymore, first i see the normal grey screen then a glitchy screen and after that the "Oh no!" screen comes. After reading the comment from doc_willis on this reddit post from someone with a similar issue, i enabled gdm debug and looked through the journal journalctl | grep gdm and found stuff like MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) (zink apparently could also not be found). After looking i found the stuff though under /usr/lib/x86_64-linux-gnu/dri so i tried what happens when having a symlink /usr/lib/dri -> /usr/lib/x86_64-linux-gnu/dri but that resulted in a different error.
pretty much this
After fixing that i got the previous ones again but slightly different, now it complained about a missing symbol or something
libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: undefined symbol: amdgpu_va_get_start_addr (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri) and from here i didnt know how to continue, so i went back into recovery mode and did amdgpu-install --uninstall to get rid of it all and make my system work normally again.

Now my questions are has anyone experienced such breaking aswell, if anyone sees a mistake in my doings, has an idea how to fix this properly or if we have to wait for another pop os update to make it work again, as apparently according to the comment from gordesky1 (mentioned reddit post) it worked until a recent update broke it.

Im thankful for any idea/suggestion that might make it finally work.

neofetch:
OS: Pop!_OS 22.04 LTS x86_64
Host: X670E Taichi
Kernel: 6.6.10-76060610-generic
Uptime: 8 mins
Packages: 3371 (dpkg), 24 (flatpak)
Shell: bash 5.1.16
Resolution: 1920x1080, 1920x1080
DE: GNOME 42.5
WM: Mutter
WM Theme: Pop
Theme: Pop-dark [GTK2/3]
Icons: Pop [GTK2/3]
Terminal: gnome-terminal
CPU: AMD Ryzen 9 7900X (24) @ 5.733GH
GPU: AMD ATI 03:00.0 Device 744c
GPU: NVIDIA GeForce RTX 3060 Lite Has
Memory: 5437MiB / 63410MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment