[What I recommend] Use aptitude
to install libdrm-dev
by automatically downgrading your installed dependencies
I figured it out, and this worked: use aptitude
to downgrade dependencies.
Just the commands:
sudo aptitude install libdrm-dev
# then choose these options:
n # do NOT leave things as-is
y # DO downgrade dependencies
y # Do continue with the install
After running sudo aptitude install libdrm-dev
, choose no
to its proposal to Keep the following packages at their current version
, and choose yes
to its proposal where it says it will Remove the following packages
, Install the following packages
, and Downgrade the following packages
. Then choose yes
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
, and y
, with some <======
markers:
$ 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:
libdrm-dev [Not Installed]
Accept this solution? [Y/n/q/?] n <=================
The following actions will resolve these dependencies:
Remove the following packages:
mesa-va-drivers [21.2.6-0ubuntu0.1~20.04.2 (now)]
va-driver-all [2.7.0-2 (focal, now)]
Install the following packages:
libllvm9 [1:9.0.1-12 (focal)]
Downgrade the following packages:
libdrm-amdgpu1 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]
libdrm-intel1 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]
libdrm-nouveau2 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]
libdrm-radeon1 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]
libdrm2 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]
libegl-mesa0 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
libgbm1 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
libgl1-mesa-dri [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
libglapi-mesa [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
libglx-mesa0 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
libosmesa6 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
mesa-vdpau-drivers [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
mesa-vulkan-drivers [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]
Accept this solution? [Y/n/q/?] y <=================
The following packages will be DOWNGRADED:
libdrm-amdgpu1 libdrm-intel1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libegl-mesa0 libgbm1 libgl1-mesa-dri libglapi-mesa libglx-mesa0 libosmesa6 mesa-vdpau-drivers mesa-vulkan-drivers
The following NEW packages will be installed:
libdrm-dev libllvm9{a}
The following packages will be REMOVED:
i965-va-driver{u} intel-media-va-driver{u} libigdgmm11{u} mesa-va-drivers{a} va-driver-all{a}
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/?] y <=================
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.
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
So, aptitude
first proposes a solution to:
Keep the following packages at their current version:
1) libdrm-dev [Not Installed]
I press n
to reject that solution. It then proposes a better solution to downgrade the dependencies and perform the install. I choose y
for that option. Then I must choose y
again later.
Once done, you can see that the regular sudo apt install libdrm-dev
works just fine now, too, showing that libdrm-dev
is already successfully installed!:
$ sudo apt install libdrm-dev
[sudo] password for gabriel:
Reading package lists... Done
Building dependency tree
Reading state information... Done
libdrm-dev is already the newest version (2.4.101-2).
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
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 source
This 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:
meson builddir/ # prep a folder
time sudo ninja -C builddir/ install # build and install
It only took 20 seconds to build & install. It installs into /usr/local/include/libdrm
.