AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1487369
Accepted
Gabriel Staples
Gabriel Staples
Asked: 2023-09-29 12:05:35 +0800 CST2023-09-29 12:05:35 +0800 CST 2023-09-29 12:05:35 +0800 CST

无法在 Ubuntu 20.04 上安装“libdrm-dev”,因为它需要比我拥有的依赖项更旧的依赖项

  • 772
$ 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/?] 

apt
  • 1 1 个回答
  • 34 Views

1 个回答

  • Voted
  1. Best Answer
    Gabriel Staples
    2023-09-29T12:28:49+08:002023-09-29T12:28:49+08:00

    [我的建议]通过自动降级安装的依赖项aptitude来安装libdrm-dev

    我想通了,这有效:用于aptitude降级依赖项。

    只是命令:

    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
    

    运行后sudo aptitude install libdrm-dev,选择no它的提案to Keep 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<======

    $ 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/?] n                           <=================
    The following actions will resolve these dependencies:
    
          Remove the following packages:                                                    
    1)      mesa-va-drivers [21.2.6-0ubuntu0.1~20.04.2 (now)]                               
    2)      va-driver-all [2.7.0-2 (focal, now)]                                            
    
          Install the following packages:                                                   
    3)      libllvm9 [1:9.0.1-12 (focal)]                                                   
    
          Downgrade the following packages:                                                 
    4)      libdrm-amdgpu1 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]            
    5)      libdrm-intel1 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]             
    6)      libdrm-nouveau2 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]           
    7)      libdrm-radeon1 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]            
    8)      libdrm2 [2.4.107-8ubuntu1~20.04.2 (now) -> 2.4.101-2 (focal)]                   
    9)      libegl-mesa0 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]       
    10)     libgbm1 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]            
    11)     libgl1-mesa-dri [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]    
    12)     libglapi-mesa [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]      
    13)     libglx-mesa0 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]       
    14)     libosmesa6 [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)]         
    15)     mesa-vdpau-drivers [21.2.6-0ubuntu0.1~20.04.2 (now) -> 20.0.4-2ubuntu1 (focal)] 
    16)     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                          <=================
    

    注意未满足的依赖关系。正如你所看到的,它说它需要 libdrm2 版本 2.4.101-2,但我安装了版本 2.4.107-8ubuntu1~20.04.2 等。奇怪的是,我的版本对它来说太新了。

    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
    

    因此,aptitude首先提出解决方案:

         Keep the following packages at their current version:
    1)     libdrm-dev [Not Installed] 
    

    我强烈要求n拒绝该解决方案。然后它会提出一个更好的解决方案来降级依赖项并执行安装。我选择y该选项。那我y以后还得重新选择。

    完成后,您可以看到常规sudo apt install libdrm-dev程序现在也可以正常工作,表明libdrm-dev已经成功安装!:

    $ 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.
    

    完毕!

    现在我可以返回到在 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

    跑步:

    meson builddir/  # prep a folder
    time sudo ninja -C builddir/ install  # build and install
    

    构建和安装只花了 20 秒。它安装到/usr/local/include/libdrm.

    • 0

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve