Hi!

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:

yaourt amdgpu-pro

mon-19-sep-184230

Alright, to get the drivers let’s type:

yaourt -S amdgpu-pro

or also:

yaourt amdgpu-pro

and then press 1 and enter (to install the package n°1 which is amdgpu-pro)

mon-19-sep-184259

If you want to modify the installation, do it now by modifying the PKGBUILD

mon-19-sep-184304

or proceed with the installation

mon-19-sep-184308

it will download the main package and all the required dependencies

mon-19-sep-184325

mon-19-sep-184448

press enter to continue the installation

mon-19-sep-184614

now it’s going to replace some packages, if it finds some broken dependencies the installation won’t continue

mon-19-sep-184627

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)

mon-19-sep-184745

now you can relaunch the installation and proceed

mon-19-sep-185140

DONE! the AMDGPU-PRO drivers are installed!

mon-19-sep-185215

you can now reboot

mon-19-sep-185502

and check the new drivers specifications (OpenGL 4.5) by typing:

glxinfo|grep Op

mon-19-sep-185628

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

mon-19-sep-190003

mon-19-sep-190831

we can now redirect this output to a file, that I’m going to place in a specific directory

mon-19-sep-185900

mon-19-sep-191027

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:

yaourt -Rdd

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

mon-19-sep-192416mon-19-sep-192431

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

mon-19-sep-192526

Noice!!!

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

mon-19-sep-192752
mon-19-sep-192757

And now I just need to make this file executable and launch it!

mon-19-sep-193128mon-19-sep-193143

An error will probably appear, because some of the given packages may not have been installed.

mon-19-sep-193148

Ok, no problem! To remove them let’s list the file with its lines’ numbers, like this:

cat -b amdgpu-pro-uninstaller

mon-19-sep-220059mon-19-sep-220106

and remove the unwanted lines with sed (-i variable to modify the file):

sed -e '14d;47d;48d' amdgpu-pro-uninstaller

mon-19-sep-220337mon-19-sep-220342

That’s it, you can now launch the file!

mon-19-sep-193245

uninstall AMDGPU-PRO, and install the previous packages

mon-19-sep-193316mon-19-sep-193321mon-19-sep-193324

Cool! you can now reboot and recheck the current driver:

mon-19-sep-193709

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

mon-19-sep-223643

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

mon-19-sep-223319

and make it executable!

TA SALÜDE!

Advertisements