Today I want to show you guys an easy way to manage and switch between the open source drivers (amdgpu) and the proprietary AMD drivers AMDGPU-PRO.
I’m going to use “yaourt” to make things easier, but you can use “makepkg” too.
The installation process is super easy, but the removal can be a bit tricky, let’s check it out:
There is a AUR package that provides all we need to have the drivers up and running.
This package is a container for many other packages as it can be seen by typing:
Alright, to get the drivers let’s type:
yaourt -S amdgpu-pro
and then press 1 and enter (to install the package n°1 which is amdgpu-pro)
If you want to modify the installation, do it now by modifying the PKGBUILD
or proceed with the installation
it will download the main package and all the required dependencies
press enter to continue the installation
now it’s going to replace some packages, if it finds some broken dependencies the installation won’t continue
if this is your case, you need to manually remove the problematic package/s with:
sudo pacman -Rdd package-name
this will uninstall only the selected package, leaving a missing dependency (it will shows up later)
now you can relaunch the installation and proceed
DONE! the AMDGPU-PRO drivers are installed!
you can now reboot
and check the new drivers specifications (OpenGL 4.5) by typing:
Alright, it was quite easy, wasn’t it?
But now it become quite problematic to properly uninstall all the package using yaourt.
By running “yaourt -R” the amdgpu-gpu package gets removed, but there are many other packages that are going to stay installed on the system (same story when running -Rc or -Rsn).
To solve this issue we can create a script that will remove all these packages and also install the packages needed by the open source drivers!
We can get a list of the packages installed by amdgpu-pro by running:
yaourt -Ssq amdgpu-pro
we can now redirect this output to a file, that I’m going to place in a specific directory
now we can start modify the file to be able to tell yaourt to remove all those packages.
But instead of using nano, I’m using a software called “sed”, so that I’m able to do more complicated stuff with a single command, such as adding a character at the end of every line.
First I’m adding a line on top of everything else, that is going to be a yaourt command to remove the specific packages, like I did before with the broken dependency:
to add this as the first line of the file I type:
sed '1i yaourt -Rdd' amdgpu-pro-uninstaller
the command is only shown on the terminal, to actually write it to the file I need to add -i as variable:
sed -i '1i yaourt -Rdd' amdgpu-pro-uninstaller
Alright! Now to get a script like that to run as command i need to add a backslash at the end of every line. On a file like that it would be easy to do this operation with a text-editor, but imagine on a file with thousand of lines.. It would be a pain :)
I want the file to look like this:
... libdrm-amdgpu-pro-dev \ libdrm-amdgpu-pro-tools \ libdrm2-amdgpu-pro \ libegl1-amdgpu-pro \ ...
To do so I type:
sed 's/$/ \\\/' amdgpu-pro-uninstaller
Now i just need to add a line at the end that will re-install the packages needed by the previous driver (-i variable to modify the file).
sed 'a$ && sudo pacman -S xf86-video-amdgpu-pro mesa-libgl lib32-mesa-libgl' amdgpu-pro-uninstaller
And now I just need to make this file executable and launch it!
An error will probably appear, because some of the given packages may not have been installed.
Ok, no problem! To remove them let’s list the file with its lines’ numbers, like this:
cat -b amdgpu-pro-uninstaller
and remove the unwanted lines with sed (-i variable to modify the file):
sed -e '14d;47d;48d' amdgpu-pro-uninstaller
That’s it, you can now launch the file!
uninstall AMDGPU-PRO, and install the previous packages
Cool! you can now reboot and recheck the current driver:
ps. you can also apply all these commands in a single command too:
first check what lines you need to delete:
yaourt -Ssq |cat -b
then apply the modifications to a dedicated file:
yaourt -Ssq amdgpu-pro |sed -e '12d;45d;46d' -e '1i yaourt -Rdd' |sed -e 's/$/ \\ /' -e '$a && sudo pacman -S xf86-video-amdgpu mesa-libgl lib32-mesa-libgl' >amdgpu-pro-uninstaller
and make it executable!