Ubuntu apt install for i386 packages is removing necessary packages

Published:

I’m writing this blog from memory, so please excuse a lot of pseudo output, and possibly missed steps.

So, I was trying to install vulkan drivers for Spore. Specifically libgl1-mesa-dri:i386 mesa-vulkan-drivers mesa-vulkan-drivers:i386, but it’s also relevant to libdrm-amdgpu1 libdrm2 libdrm-amdgpu1:i386 libdrm2:i386 and probably other packages too.

It was trying to remove a lot of important stuff. Something like this:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  your will to live
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  xorg, ubuntu, sudo rm -rf --no-preserve-root /, there was like 150 packages, you get it

Or like this:

mesa-vulkan-drivers:i386 won't be installed because libdrm-amdgpu1:i386 (>= 2.4.110) or whatever

At first, I’ve upgraded the ubuntu from 20.04 to 22.04, but it didn’t help.

Figuring out why

So, first off, we’re going to install aptitude and apt-forktracer.

Now let’s try installing with aptitude

$ sudo aptitude install mesa-vulkan-drivers:i386
The following packages have unmet dependencies:
 mesa-vulkan-drivers:i386 : Depends: libdrm-amdgpu1 (>= 2.4.110) but it is not going to be installed
                        Depends: libdrm2 (>= 2.4.110) but it is not going to be installed
continue/quit/whatever

Hey! That’s more useful than apt!

Now let’s see the output of apt-forktracer

*other stuff...*
libdrm-amdgpu1 (2.4.110~~git20160413.62652~ubuntu14.04.1)
libdrm2 (2.4.110~~git20160413.62652~ubuntu14.04.1)
libdrm-radeon1 (2.4.110~~git20160413.62652~ubuntu14.04.1)
libdrm-nouveau2 (2.4.110~~git20160413.62652~ubuntu14.04.1)
libdrm-intel1 (2.4.110~~git20160413.62652~ubuntu14.04.1)
libdrm-common (2.4.110~~git20160413.62652~ubuntu14.04.1)
*other stuff...*

and apt-cache policy libdrm-amdgpu1

libdrm-amdgpu1:
  Installed: 2.4.110~~git20160413.62652~ubuntu14.04.1
  Candidate: 2.4.110~~git20160413.62652~ubuntu14.04.1
  Version table:
 *** 2.4.110~~git20160413.62652~ubuntu14.04.1 100
        100 /var/lib/dpkg/status
     2.4.110-1ubuntu1 500
        500 http://ru.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages

and apt-cache policy libdrm-amdgpu1:i386

libdrm-amdgpu1:i386:
  Installed: (none)
  Candidate: 2.4.110
  Version table:
     2.4.110-1ubuntu1 500
        500 http://ru.archive.ubuntu.com/ubuntu focal-security/main i386 Packages

Well, isn’t that odd? We have some local packages, but they’re only for amd64.

So, that’s probably why it isn’t installing. Let’s try fixing it.

You can also use aptitude why-not and aptitude why. They’re pretty nice utilities for debugging.

Solution

The solution for me was to downgrade the packages from this local git version, to the repository one.

$ sudo apt-get install libdrm2=2.4.110-1ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  your will to live
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
  xorg, ubuntu, sudo rm -rf --no-preserve-root /, there was like 150 packages, you get it

Nope, that’s not it. Let’s try another one first

$ sudo apt-get install libdrm-radeon1=2.4.110-1ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be DOWNGRADED:
  libdrm-radeon1

Repeat this for a few packages…

Now try the first one again

$ sudo apt-get install libdrm2=2.4.110-1ubuntu1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be DOWNGRADED:
  libdrm2

Much better!

Repeat this until you’ve “downgraded” all of the offending packages.

And now, try installing the drivers again:

$ sudo apt install mesa-vulkan-drivers:i386
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libdrm-amdgpu1:i386 libdrm2:i386 libvulkan1:i386 mesa-vulkan-drivers:i386

There we go! I hope this was helpful to you.