$ 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.
我可以强制它使用我的新版本吗?我有什么遗漏的吗?sudo aptitude install libdrm-dev
显示我当前的版本较新:
$ 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/?]
[我的建议]通过自动降级安装的依赖项
aptitude
来安装libdrm-dev
我想通了,这有效:用于
aptitude
降级依赖项。只是命令:
运行后
sudo aptitude install libdrm-dev
,选择no
它的提案toKeep the following packages at their current version
,并选择yes
它说它会的提案Remove the following packages
,,Install the following packages
和Downgrade the following packages
。然后再次选择yes
显示: 的位置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/?]
。就是这样!它(稍微)降级了一些软件包,并且现在安装得很好!细节:
这是完整的命令和输出(我将在下面解释)。我用一些标记标记了输入
n
、y
、 和 的位置:y
<======
注意未满足的依赖关系。正如你所看到的,它说它需要 libdrm2 版本 2.4.101-2,但我安装了版本 2.4.107-8ubuntu1~20.04.2 等。奇怪的是,我的版本对它来说太新了。
因此,
aptitude
首先提出解决方案:我强烈要求
n
拒绝该解决方案。然后它会提出一个更好的解决方案来降级依赖项并执行安装。我选择y
该选项。那我y
以后还得重新选择。完成后,您可以看到常规
sudo apt install libdrm-dev
程序现在也可以正常工作,表明libdrm-dev
已经成功安装!:完毕!
现在我可以返回到在 Ubuntu 20.04 上安装 displaylink-driver,这样我就可以使用我的新双 4k 60 Hz USB-A 适配器!请参阅我的答案:USB to HDMI adapter that Works with Ubuntu。
替代方案:如何
libdrm
从源代码构建和安装最新版本这并不能完全回答我的问题,但以下是如何
libdrm
从源代码构建的方法:源代码在这里: https: //gitlab.freedesktop.org/mesa/drm
在此处获取最新的标记版本:https ://gitlab.freedesktop.org/mesa/drm/-/tags
下载并解压。
请参阅自述文件中的“编译”说明: https: //gitlab.freedesktop.org/mesa/drm
跑步:
构建和安装只花了 20 秒。它安装到
/usr/local/include/libdrm
.