$ sudo apt install libdrm-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libdrm-dev : Depends: libdrm2 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is to be installed
Depends: libdrm-intel1 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is to be installed
Depends: libdrm-radeon1 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is to be installed
Depends: libdrm-nouveau2 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is to be installed
Depends: libdrm-amdgpu1 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is to be installed
E: Unable to correct problems, you have held broken packages.
Can I force it to use my newer versions? Is there something I'm missing? sudo aptitude install libdrm-dev
shows me my current versions are newer:
$ sudo aptitude install libdrm-dev
The following NEW packages will be installed:
libdrm-dev{b}
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 126 kB of archives. After unpacking 658 kB will be used.
The following packages have unmet dependencies:
libdrm-dev : Depends: libdrm2 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is installed
Depends: libdrm-intel1 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is installed
Depends: libdrm-radeon1 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is installed
Depends: libdrm-nouveau2 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is installed
Depends: libdrm-amdgpu1 (= 2.4.101-2) but 2.4.107-8ubuntu1~20.04.2 is installed
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) libdrm-dev [Not Installed]
Accept this solution? [Y/n/q/?]
[What I recommend] Use
aptitude
to installlibdrm-dev
by automatically downgrading your installed dependenciesI figured it out, and this worked: use
aptitude
to downgrade dependencies.Just the commands:
After running
sudo aptitude install libdrm-dev
, chooseno
to its proposal toKeep the following packages at their current version
, and chooseyes
to its proposal where it says it willRemove the following packages
,Install the following packages
, andDowngrade the following packages
. Then chooseyes
again where it says:0 packages upgraded, 2 newly installed, 13 downgraded, 5 to remove and 0 not upgraded. Need to get 33.4 MB of archives. After unpacking 140 MB will be freed. Do you want to continue? [Y/n/?]
. That's it! It downgrades (slightly) some packages, and installs just fine now!Details:
Here is the full command and output (I'll explain it below). I've marked where I entered
n
,y
, andy
, with some<======
markers:Notice the unmet dependencies. As you can see, it says that it needs libdrm2 version 2.4.101-2, but I have version 2.4.107-8ubuntu1~20.04.2 installed, etc. My version is, oddly enough, too new for it.
So,
aptitude
first proposes a solution to:I press
n
to reject that solution. It then proposes a better solution to downgrade the dependencies and perform the install. I choosey
for that option. Then I must choosey
again later.Once done, you can see that the regular
sudo apt install libdrm-dev
works just fine now, too, showing thatlibdrm-dev
is already successfully installed!:Done!
And now I can go back to Installing displaylink-driver on Ubuntu 20.04, so I can use my new dual 4k 60 Hz USB-A adapter! See my answer here: USB to HDMI adapter that works with Ubuntu.
Alternative: how to build and install the latest
libdrm
from sourceThis doesn't answer my question exactly, but here's how to build
libdrm
from source:The source code is here: https://gitlab.freedesktop.org/mesa/drm
Get the latest tagged release here: https://gitlab.freedesktop.org/mesa/drm/-/tags
Download and extract it.
See the "Compiling" instructions in the readme: https://gitlab.freedesktop.org/mesa/drm
Run:
It only took 20 seconds to build & install. It installs into
/usr/local/include/libdrm
.