由于未满足依赖关系,无法通过 apt 安装软件包

由于未满足依赖关系,无法通过 apt 安装软件包

在新安装的 Ubuntu 22.04 机器上,我尝试安装libgstreamer-plugins-base1.0-dev软件包。首先我运行sudo apt update && sudo apt full-upgrade,然后:

$ sudo apt sudo apt install libgstreamer-plugins-base1.0-dev
Reading package lists... Done
Building dependency tree... Done
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:
 libgbm-dev : Depends: libgbm1 (= 22.0.1-1ubuntu2) but 22.0.5-0ubuntu0.1 is to be installed
 libudev-dev : Depends: libudev1 (= 249.11-0ubuntu3) but 249.11-0ubuntu3.6 is to be installed
E: Unable to correct problems, you have held broken packages.

现在,如果我尝试手动安装依赖项:

$ sudo apt install libgbm1
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgbm1 is already the newest version (22.0.5-0ubuntu0.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

此外,手动安装请求的版本会删除很多已经安装的软件包,这不是我想要的:

$ sudo apt install libgbm1=22.0.1-1ubuntu2
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  apg apturl-common cheese-common dctrl-tools dkms docbook-xml evolution-data-server-common gir1.2-accountsservice-1.0 gir1.2-adw-1 gir1.2-dbusmenu-glib-0.4
  gir1.2-dee-1.0 gir1.2-gck-1 gir1.2-gcr-3 gir1.2-gdm-1.0 gir1.2-geoclue-2.0 gir1.2-gnomebluetooth-3.0 gir1.2-graphene-1.0 gir1.2-gtk-4.0 gir1.2-gweather-3.0
  gir1.2-javascriptcoregtk-4.0 gir1.2-json-1.0 gir1.2-nm-1.0 gir1.2-nma-1.0 gir1.2-rsvg-2.0 gir1.2-soup-2.4 gir1.2-unity-7.0 gir1.2-upowerglib-1.0 gkbd-capplet
  gnome-bluetooth-3-common gnome-control-center-faces gnome-session-common gnome-shell-common gstreamer1.0-pipewire gstreamer1.0-plugins-ugly i965-va-driver
  imagemagick-6-common intel-media-va-driver liba52-0.7.4 libabsl20210324 libaom3 libass9 libatomic1:i386 libavcodec58 libavutil56 libayatana-appindicator3-1
  libayatana-ido3-0.4-0 libayatana-indicator3-7 libbs2b0 libbsd0:i386 libcamel-1.2-63 libchromaprint1 libclutter-1.0-common libcodec2-1.0 libcogl-common
  libcolord-gtk1 libdav1d5 libdbusmenu-gtk3-4 libdc1394-25 libdca0 libde265-0 libdecor-0-0 libdecor-0-plugin-1-cairo libdouble-conversion3 libdrm-amdgpu1:i386
  libdrm-nouveau2:i386 libdrm-radeon1:i386 libdrm2:i386 libdvdnav4 libdvdread8 libebackend-1.2-10 libebook-1.2-20 libebook-contacts-1.2-3 libecal-2.0-1
  libedata-book-1.2-26 libedata-cal-2.0-1 libedataserver-1.2-26 libedit2:i386 libelf1:i386 libexpat1:i386 libfaad2 libffi8:i386 libfftw3-double3 libflite1
  libfluidsynth3 libfreeaptx0 libfreerdp-client2-2 libfreerdp-server2-2 libfreerdp2-2 libgdm1 libgl-dev libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386 libgles2
  libglu1-mesa libglu1-mesa-dev libglvnd0:i386 libglx-dev libglx-mesa0:i386 libglx0:i386 libgme0 libgnome-bluetooth-3.0-13 libgnomekbd-common libgnomekbd8 libgsm1
  libgsound0 libgssdp-1.2-0 libgstreamer-plugins-bad1.0-0 libgupnp-1.2-1 libgupnp-av-1.0-3 libgupnp-dlna-2.0-4 libgupnp-igd-1.0-4 libharfbuzz-icu0 libheif1 libhyphen0
  libicu70:i386 libigdgmm12 libilmbase25 libinput-bin libinput10 libinstpatch-1.0-2 libjavascriptcoregtk-4.0-18 libjxr-tools libjxr0 libkate1 libldacbt-enc2
  liblilv-0-0 libllvm13:i386 liblqr-1-0 libltc11 libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra libmagickwand-6.q16-6 libmanette-0.2-0 libmd0:i386 libmd4c0
  libmediaart-2.0-0 libmfx1 libmjpegutils-2.1-0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmplex2-2.1-0 libmtdev1 libnice10 libnvidia-cfg1-515
  libnvidia-common-515 libnvidia-compute-515:i386 libnvidia-decode-515 libnvidia-decode-515:i386 libnvidia-egl-wayland1 libnvidia-encode-515 libnvidia-encode-515:i386
  libnvidia-extra-515 libnvidia-fbc1-515 libnvidia-fbc1-515:i386 libnvidia-gl-515:i386 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr25
  libopengl0 libopenh264-6 libopenmpt0 libopenni2-0 libphonenumber8 libprotobuf23 libpthread-stubs0-dev libqrencode4 libqt5concurrent5 libqt5core5a libqt5dbus5
  libqt5network5 libqt5sql5 libqt5sql5-sqlite libqt5test5 libqt5xml5 librest-0.7-0 librygel-core-2.6-2 librygel-db-2.6-2 librygel-renderer-2.6-2 librygel-server-2.6-2
  libsdl2-2.0-0 libsensors5:i386 libserd-0-0 libshine3 libsidplay1v5 libsnappy1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libsoup-gnome2.4-1 libspandsp2 libsratom-0-0
  libsrt1.4-gnutls libsrtp2-1 libstdc++6:i386 libswresample3 libsysmetrics1 libva-drm2 libva-x11-2 libva2 libvdpau1 libvncserver1 libvo-aacenc0 libvo-amrwbenc0
  libvulkan-dev libvulkan1:i386 libwayland-client0:i386 libwildmidi2 libwinpr2-2 libwoff1 libx11-6:i386 libx11-dev libx11-xcb1:i386 libx264-163 libx265-199
  libxatracker2 libxau-dev libxau6:i386 libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-present0:i386
  libxcb-randr0:i386 libxcb-render-util0 libxcb-res0 libxcb-shm0:i386 libxcb-sync1:i386 libxcb-xfixes0:i386 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb-xv0
  libxcb1:i386 libxcb1-dev libxcvt0 libxdmcp-dev libxdmcp6:i386 libxext-dev libxext6:i386 libxfixes3:i386 libxfont2 libxkbcommon-x11-0 libxklavier16 libxml2:i386
  libxnvctrl0 libxshmfence1:i386 libxslt1.1 libxss1 libxvidcore4 libxvmc1 libxxf86vm1:i386 libzbar0 libzvbi-common libzvbi0 libzxingcore1 mesa-va-drivers
  mesa-vdpau-drivers mesa-vulkan-drivers:i386 mobile-broadband-provider-info mutter-common network-manager-gnome nvidia-compute-utils-515 nvidia-dkms-515
  nvidia-kernel-common-515 nvidia-kernel-source-515 nvidia-prime nvidia-settings ocl-icd-libopencl1 policykit-1-gnome power-profiles-daemon python3-debconf
  python3-debian python3-macaroonbakery python3-nacl python3-protobuf python3-pymacaroons python3-rfc3339 qt5-qmake qt5-qmake-bin qtbase5-dev-tools qtchooser
  qttranslations5-l10n rygel screen-resolution-extra sgml-data switcheroo-control timgm6mb-soundfont update-notifier-common va-driver-all vdpau-driver-all x11-apps
  x11-session-utils x11-xkb-utils x11proto-dev xbitmaps xcvt xdg-dbus-proxy xfonts-base xfonts-encodings xfonts-scalable xfonts-utils xinit xinput xorg-sgml-doctools
  xserver-common xserver-xephyr xserver-xorg-legacy xtrans-dev xwayland yelp-xsl zenity-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  policykit-1-gnome
The following packages will be REMOVED:
  apturl evolution-data-server gdm3 gir1.2-mutter-10 gir1.2-webkit2-4.0 gnome-control-center gnome-initial-setup gnome-online-accounts gnome-remote-desktop
  gnome-session-bin gnome-shell gnome-shell-extension-appindicator gnome-shell-extension-desktop-icons-ng gnome-shell-extension-ubuntu-dock gnome-startup-applications
  gnome-user-docs gstreamer1.0-clutter-3.0 gstreamer1.0-gl gstreamer1.0-plugins-bad libcheese-gtk25 libcheese8 libclutter-1.0-0 libclutter-gst-3.0-0
  libclutter-gtk-1.0-0 libcogl-pango20 libcogl-path20 libcogl20 libedataserverui-1.2-3 libegl-dev libegl-mesa0 libegl1 libgoa-backend-1.0-1 libgstreamer-gl1.0-0
  libmutter-10-0 libnvidia-gl-515 libqt5gui5 libqt5opengl5 libqt5opengl5-dev libqt5printsupport5 libqt5svg5 libqt5widgets5 libwebkit2gtk-4.0-37 libyelp0
  nautilus-share nvidia-driver-515 qt5-gtk-platformtheme qtbase5-dev ubuntu-desktop ubuntu-desktop-minimal ubuntu-docs ubuntu-release-upgrader-gtk ubuntu-session
  update-manager update-notifier 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-nvidia-515 xserver-xorg-video-qxl xserver-xorg-video-radeon xserver-xorg-video-vesa xserver-xorg-video-vmware yelp zenity
The following NEW packages will be installed:
  policykit-1-gnome
The following packages will be DOWNGRADED:
  libgbm1
0 upgraded, 1 newly installed, 1 downgraded, 73 to remove and 0 not upgraded.

这是我的合适来源:

$ cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | grep -v ^#
cat: '/etc/apt/sources.list.d/*.list': No such file or directory

deb http://at.archive.ubuntu.com/ubuntu/ jammy main restricted


deb http://at.archive.ubuntu.com/ubuntu/ jammy universe

deb http://at.archive.ubuntu.com/ubuntu/ jammy multiverse


deb http://security.ubuntu.com/ubuntu jammy-security restricted main
deb http://security.ubuntu.com/ubuntu jammy-security universe
deb http://security.ubuntu.com/ubuntu jammy-security multiverse

输出如下update

$ sudo apt upgrade 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
Try Ubuntu Pro beta with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ sudo apt update
Hit:1 http://at.archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://security.ubuntu.com/ubuntu jammy-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

那么我该如何解决这个依赖问题呢?

答案1

您的输出显示您已启用jammyjammy-security存储库。很好,

但不幸的是,jammy-updates失踪了。

重新启用jammy-updates后您的问题就会消失。

相关内容