为什么我一开始安装 freeglut3-dev 时会遇到以下问题,我应该采取什么不同的做法?

为什么我一开始安装 freeglut3-dev 时会遇到以下问题,我应该采取什么不同的做法?

我在尝试安装 freeglut3-dev 时遇到了以下问题。我很好奇为什么我首先会遇到这个问题,如果有的话,我应该采取不同的做法。

这是 Debian 9.11,sources.list 位于这个问题的底部。

# apt-get install freeglut3-dev

The following packages have unmet dependencies:
 freeglut3-dev : Depends: libgl1-mesa-dev but it is not going to be installed or
                          libgl-dev
                 Depends: libglu1-mesa-dev but it is not going to be installed or
                          libglu-dev
E: Unable to correct problems, you have held broken packages.

所以我决定尝试找出自己的问题所在。

# apt-get install libgl1-mesa-dev

The following packages have unmet dependencies:
 libgl1-mesa-dev : Depends: mesa-common-dev (= 13.0.6-1+b2) but it is not going to be installed
                   Depends: libdrm-dev (>= 2.4.69) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

# apt-get install mesa-common-dev

The following packages have unmet dependencies:
 mesa-common-dev : Depends: libdrm-dev (>= 2.4.65) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

# apt-get install libdrm-dev

The following packages have unmet dependencies:
 libdrm-dev : Depends: libdrm2 (= 2.4.74-1) but 2.4.95-1~bpo9+1 is to be installed
E: Unable to correct problems, you have held broken packages.

# apt-get install libdrm2

libdrm2 is already the newest version (2.4.95-1~bpo9+1)

所以我安装了这个。

我尝试手动安装旧版本:

首先,我有旧版本可用吗?

# apt-cache policy libdrm2
libdrm2:
  Installed: 2.4.95-1~bpo9+1
  Candidate: 2.4.95-1~bpo9+1
  Version table:
 *** 2.4.95-1~bpo9+1 100
        100 /var/lib/dpkg/status
     2.4.74-1 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages

看起来是这样。来吧。

# apt-get install libdrm2=2.4.74-1
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  audacious-plugins-data compton-conf-l10n libaudcore3 libaudgui3 libaudtag2
  libc-ares2 libcddb2 libcue1 libdouble-conversion1 libdrm-common libevdev2
  libfluidsynth1 libglvnd0 libguess1 libinput-bin libinput10 libmaxminddb0
  libmms0 libmodplug1 libmtdev1 libneon27-gnutls libpcre16-3 libqt5core5a
  libqt5dbus5 libqt5network5 libsbc1 libsdl-ttf2.0-0 libsdl2-2.0-0
  libsidplayfp4 libsmi2ldbl libspandsp2 libwacom-bin libwacom-common libwacom2
  libwayland-server0 libwireshark-data libwireshark11 libwiretap8 libwscodecs2
  libwsutil9 libxatracker2 libxcb-icccm4 libxcb-image0 libxcb-keysyms1
  libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-xinerama0
  libxcb-xkb1 libxfont2 libxkbcommon-x11-0 qttranslations5-l10n
  wireshark-common x11-apps x11-session-utils xfonts-100dpi xfonts-75dpi
  xfonts-base xfonts-scalable xinit xserver-common xserver-xorg-legacy
Use 'apt autoremove' to remove them.
The following packages will be REMOVED:
  audacious audacious-plugins compton-conf libaudqt0 libegl-mesa0 libegl1
  libegl1-mesa libgbm1 libqgsttools-p1 libqt5gui5 libqt5multimedia5
  libqt5multimedia5-plugins libqt5multimediawidgets5 libqt5opengl5
  libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5x11extras5
  libwayland-egl1-mesa qt5-gtk-platformtheme virtualbox-5.2 wireshark
  wireshark-qt xorg xserver-xorg xserver-xorg-core xserver-xorg-input-all
  xserver-xorg-input-libinput xserver-xorg-input-wacom xserver-xorg-video-all
  xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-fbdev
  xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-qxl
  xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware
The following packages will be DOWNGRADED:
  libdrm2
0 upgraded, 0 newly installed, 1 downgraded, 39 to remove and 0 not upgraded.
Need to get 36.2 kB of archives.
After this operation, 209 MB disk space will be freed.
Do you want to continue? [Y/n] 
Get:1 http://deb.debian.org/debian stretch/main amd64 libdrm2 amd64 2.4.74-1 [36.2 kB]
Fetched 36.2 kB in 0s (153 kB/s)
(Reading database ... 336865 files and directories currently installed.)
Removing audacious (3.7.2-1+b1) ...
Removing audacious-plugins:amd64 (3.7.2-2.1) ...
Removing compton-conf (0.2.1-2) ...
Removing libaudqt0:amd64 (3.7.2-1+b1) ...
Removing xorg (1:7.7+19) ...
Removing xserver-xorg (1:7.7+19) ...
Removing xserver-xorg-video-all (1:7.7+19) ...
Removing xserver-xorg-video-vmware (1:13.2.1-1+b1) ...
Removing xserver-xorg-video-vesa (1:2.3.4-1+b2) ...
Removing xserver-xorg-input-all (1:7.7+19) ...
Removing xserver-xorg-input-libinput (0.23.0-2) ...
Removing xserver-xorg-video-qxl (0.1.4+20161126git4d7160c-1) ...
Removing xserver-xorg-video-nouveau (1:1.0.13-3) ...
Removing xserver-xorg-input-wacom (0.34.0-1) ...
Removing virtualbox-5.2 (5.2.34-133893~Debian~stretch) ...
Removing libwayland-egl1-mesa:amd64 (18.2.8-2~bpo9+1) ...
Removing xserver-xorg-video-amdgpu (1.2.0-1+b1) ...
Removing libqt5multimedia5-plugins:amd64 (5.7.1~20161021-2) ...
Removing libqgsttools-p1:amd64 (5.7.1~20161021-2) ...
Removing wireshark (2.6.7-1~deb9u1) ...
Removing wireshark-qt (2.6.7-1~deb9u1) ...
Removing libqt5multimediawidgets5:amd64 (5.7.1~20161021-2) ...
Removing libqt5multimedia5:amd64 (5.7.1~20161021-2) ...
Removing libqt5opengl5:amd64 (5.7.1+dfsg-3+deb9u1) ...
Removing libqt5printsupport5:amd64 (5.7.1+dfsg-3+deb9u1) ...
Removing libqt5svg5:amd64 (5.7.1~20161021-2+b2) ...
Removing libqt5widgets5:amd64 (5.7.1+dfsg-3+deb9u1) ...
Removing libqt5x11extras5:amd64 (5.7.1~20161021-2) ...
Removing qt5-gtk-platformtheme:amd64 (5.7.1+dfsg-3+deb9u1) ...
Removing xserver-xorg-video-ati (1:7.8.0-1+b1) ...
Removing xserver-xorg-video-fbdev (1:0.4.4-1+b5) ...
Removing xserver-xorg-video-intel (2:2.99.917+git20161206-1) ...
Removing xserver-xorg-video-radeon (1:7.8.0-1+b1) ...
Removing xserver-xorg-core (2:1.19.2-1+deb9u5) ...
Removing libqt5gui5:amd64 (5.7.1+dfsg-3+deb9u1) ...
Removing libegl1-mesa:amd64 (18.2.8-2~bpo9+1) ...
Removing libegl1:amd64 (1.1.0-1~bpo9+1) ...
Removing libegl-mesa0:amd64 (18.2.8-2~bpo9+1) ...
Removing libgbm1:amd64 (18.2.8-2~bpo9+1) ...
dpkg: warning: downgrading libdrm2:amd64 from 2.4.95-1~bpo9+1 to 2.4.74-1
(Reading database ... 335466 files and directories currently installed.)
Preparing to unpack .../libdrm2_2.4.74-1_amd64.deb ...
Unpacking libdrm2:amd64 (2.4.74-1) over (2.4.95-1~bpo9+1) ...
Processing triggers for mime-support (3.60) ...
Processing triggers for desktop-file-utils (0.23-1) ...
Setting up libdrm2:amd64 (2.4.74-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...
Processing triggers for shared-mime-info (1.8-1+deb9u1) ...
Unknown media type in type 'all/all'
Unknown media type in type 'all/allfiles'
Processing triggers for glx-alternative-mesa (0.8.8~deb9u2) ...
update-alternatives: warning: forcing reinstallation of alternative /usr/lib/mesa-diverted because link group glx is broken
update-alternatives: warning: skip creation of /usr/lib/x86_64-linux-gnu/libEGL.so.1 because associated file /usr/lib/mesa-diverted/x86_64-linux-gnu/libEGL.so.1 (of link group glx) doesn't exist
Processing triggers for hicolor-icon-theme (0.15-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...

好的,那么它删除了所有这些软件包,其中一些非常重要,而不重新安装它们?当我在历史记录中查找 apt 时,这一点得到了证实。

我想我会手动安装它们,希望它不会在此过程中升级 libdrm2 ...

# apt-get install audacious-plugins-data compton-conf-l10n libaudcore3 libaudgui3 libaudtag2 libc-ares2 libcddb2 libcue1 libdouble-conversion1 libdrm-common libevdev2 libfluidsynth1 libglvnd0 libguess1 libinput-bin libinput10 libmaxminddb0 libmms0 libmodplug1 libmtdev1 libneon27-gnutls libpcre16-3 libqt5core5a libqt5dbus5 libqt5network5 libsbc1 libsdl-ttf2.0-0 libsdl2-2.0-0 libsidplayfp4 libsmi2ldbl libspandsp2 libwacom-bin libwacom-common libwacom2 libwayland-server0 libwireshark-data libwireshark11 libwiretap8 libwscodecs2 libwsutil9 libxatracker2 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxfont2 libxkbcommon-x11-0 qttranslations5-l10n wireshark-common x11-apps x11-session-utils xfonts-100dpi xfonts-75dpi xfonts-base xfonts-scalable xinit xserver-common xserver-xorg-legacy

然而,现在我被告知这些已经是最新版本了。

此时,我不确定发生了什么事。

不管怎样,我现在可以安装 freeglut3-dev,它不再抱怨了。

我不确定我是否真的知道自己在做什么,并且可能已经接近破坏我的系统了。

我的来源列表:

deb http://deb.debian.org/debian/ stretch main contrib non-free
deb-src http://deb.debian.org/debian/ stretch main contrib non-free

deb http://security.debian.org/debian-security stretch/updates main contrib non-free
deb-src http://security.debian.org/debian-security stretch/updates main contrib non-free

# stretch-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian/ stretch-updates main contrib non-free

# Virtualbox
deb http://download.virtualbox.org/virtualbox/debian stretch contrib non-free

答案1

这就是问题的根源:

# apt-cache policy libdrm2
libdrm2:
  Installed: 2.4.95-1~bpo9+1
  Candidate: 2.4.95-1~bpo9+1
  Version table:
 *** 2.4.95-1~bpo9+1 100
        100 /var/lib/dpkg/status
     2.4.74-1 500
        500 http://deb.debian.org/debian stretch/main amd64 Packages

这表明您libdrm2在某个时刻从 Stretch 向后移植进行了安装,并且您的存储库中不再配置向后移植。

当你跑的时候

apt-get install libdrm2=2.4.74-1

你要求apt-get降级libdrm2。在这种情况下,apt-get不会自行降级相关软件包;它验证生成的依赖关系,并且删除不再满足依赖关系的任何包。在这种情况下,您从向后移植安装的其他软件包以及依赖于libdrm22.4.74 以上版本的软件包将被删除:libegl1等等。依赖于这些软件包的软件包也将被删除;这包括xserver-xorg-core。该过程将继续,直到没有任何软件包具有不满足的依赖关系......

你并没有破坏你的系统;这样做需要额外的确认。您apt-get install没有做任何特别有用的事情,因为您给了它现在是自动删除的候选包的列表;这些软件包仍然安装。要撤消删除,您应该安装已删除的软件包:

The following packages will be REMOVED:
  audacious audacious-plugins compton-conf libaudqt0 libegl-mesa0 libegl1
  libegl1-mesa libgbm1 libqgsttools-p1 libqt5gui5 libqt5multimedia5
  libqt5multimedia5-plugins libqt5multimediawidgets5 libqt5opengl5
  libqt5printsupport5 libqt5svg5 libqt5widgets5 libqt5x11extras5
  libwayland-egl1-mesa qt5-gtk-platformtheme virtualbox-5.2 wireshark
  wireshark-qt xorg xserver-xorg xserver-xorg-core xserver-xorg-input-all
  xserver-xorg-input-libinput xserver-xorg-input-wacom xserver-xorg-video-all
  xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-fbdev
  xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-qxl
  xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware

相关内容