Skip to content

Instantly share code, notes, and snippets.

@FCLC
Last active October 13, 2024 20:09
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.

@arfianda
Copy link

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

Thanks man!!! i follow your instruction and now everything works!

@Ciro23
Copy link

Ciro23 commented Jul 1, 2024

Using the --no-dkms flag did not solve the issue for me, as I still receive this error:

Building initial module for 6.9.3-76060903-generic
ERROR (dkms apport): kernel package linux-headers-6.9.3-76060903-generic is not supported
Error! Bad return status for module build on kernel: 6.9.3-76060903-generic (amd64)
Consult /var/lib/dkms/amdgpu/6.7.0-1787201.22.04/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)

@KelvinChung2000
Copy link

Using the --no-dkms flag did not solve the issue for me, as I still receive this error:

Building initial module for 6.9.3-76060903-generic
ERROR (dkms apport): kernel package linux-headers-6.9.3-76060903-generic is not supported
Error! Bad return status for module build on kernel: 6.9.3-76060903-generic (amd64)
Consult /var/lib/dkms/amdgpu/6.7.0-1787201.22.04/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)

I have got a similar problem. It looks like the first install with dkms will have setup something that make all subsequence install using dkms. Try sudo apt autoremove amdgpu-dkms first, then re do the install with --no-dkms

@Ciro23
Copy link

Ciro23 commented Oct 13, 2024

Using the --no-dkms flag did not solve the issue for me, as I still receive this error:

Building initial module for 6.9.3-76060903-generic
ERROR (dkms apport): kernel package linux-headers-6.9.3-76060903-generic is not supported
Error! Bad return status for module build on kernel: 6.9.3-76060903-generic (amd64)
Consult /var/lib/dkms/amdgpu/6.7.0-1787201.22.04/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)

I have got a similar problem. It looks like the first install with dkms will have setup something that make all subsequence install using dkms. Try sudo apt autoremove amdgpu-dkms first, then re do the install with --no-dkms

Thanks, I'll keep this in mind in case I'll need this again in the future. I gave up trying since I found out that I don't really need AMD proprietary drivers and I'm just fine with the already installed open source ones.

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