![如何纠正 apt/dpkg 安装/升级中的依赖项评估失败?](https://linux22.com/image/939584/%E5%A6%82%E4%BD%95%E7%BA%A0%E6%AD%A3%20apt%2Fdpkg%20%E5%AE%89%E8%A3%85%2F%E5%8D%87%E7%BA%A7%E4%B8%AD%E7%9A%84%E4%BE%9D%E8%B5%96%E9%A1%B9%E8%AF%84%E4%BC%B0%E5%A4%B1%E8%B4%A5%EF%BC%9F.png)
我最近从 Xenial 升级到了 Fossa,整个过程似乎进展顺利。.list
我的系统上没有引用 Xenial 的文件,Fossa 似乎运行正常。
今天,我发现我有一个可升级的软件包 ubuntu-advantage-tools,但它无法安装,因为它依赖于 distro-info,而 distro-info 不会被安装。在尝试找出原因时,似乎 distro-info 依赖于 distro-info-data,而 distro-info-data 不会被安装。原因是这是 distro-info-data 包我有已经是最新版本,大概是我最近升级操作系统的结果。这很合理,因为我的操作系统在各个方面都运行正常:显然,我拥有的 distro-info-data 包(版本0.46+18.04.sav0
)令人满意,并且x.yy
数字版本值高于 distro-info ( 0.39
) 指示的依赖关系以及 4 月份发布的最新版本 ( 0.43
)。
[Wed Jul 14-12:42:17]-[exit:100]-$> sudo apt install ubuntu-advantage-tools
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:
ubuntu-advantage-tools : Depends: distro-info but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
[Wed Jul 14-12:42:29]-[exit:100]-$> sudo apt install distro-info
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:
distro-info : Depends: distro-info-data (>= 0.39ubuntu1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
[Wed Jul 14-12:42:40]-[exit:100]-$> sudo apt install distro-info-data
Reading package lists... Done
Building dependency tree
Reading state information... Done
distro-info-data is already the newest version (0.46+18.04.sav0).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
因此,问题是这样的:为什么依赖性评估过程没有识别distro-info-data (0.46+18.04.sav0)
出满足 distro-info 声明的依赖性,distro-info-data (>= 0.39ubuntu1)
尽管事实上它显然确实满足?
此外,我该怎么做才能解决这个问题,以便将来能够顺利进行非手动升级安装,同时避免完全重新安装我的操作系统(这基本上是我在调查用最新的操作系统替换时所指出的distro-info-data (0.46+18.04.sav0)
)distro-info-data (0.43ubuntu1.5_all)
?
其他参考:
[Wed Jul 14-13:37:33]-[exit:0]-$> sudo apt show distro-info
Package: distro-info
Version: 0.23ubuntu1
Priority: optional
Section: devel
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Benjamin Drung <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 69.6 kB
Depends: distro-info-data (>= 0.39ubuntu1), libc6 (>= 2.7)
Suggests: shunit2 (>= 2.1.6)
Breaks: ubuntu-dev-tools (<< 0.133~)
Replaces: ubuntu-dev-tools (<< 0.127~)
Download-Size: 17.1 kB
APT-Sources: http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
Description: provides information about the distributions' releases
Information about all releases of Debian and Ubuntu. The distro-info script
will give you the codename for e.g. the latest stable release of your
distribution. To get information about a specific distribution there are the
debian-distro-info and the ubuntu-distro-info scripts.
[Wed Jul 14-13:39:22]-[exit:0]-$> sudo apt show distro-info-data
Package: distro-info-data
Version: 0.46+18.04.sav0
Status: install ok installed
Priority: important
Section: devel
Maintainer: Benjamin Drung <[email protected]>
Installed-Size: 18.4 kB
Breaks: distro-info (<< 1.0~)
Download-Size: unknown
APT-Manual-Installed: yes
APT-Sources: /var/lib/dpkg/status
Description: information about the distributions' releases (data files)
Information about all releases of Debian and Ubuntu. The distro-info script
will give you the codename for e.g. the latest stable release of your
distribution. To get information about a specific distribution there are the
debian-distro-info and the ubuntu-distro-info scripts.
.
This package contains the data files.
N: There are 2 additional records. Please use the '-a' switch to see them.
[Wed Jul 14-13:48:18]-[exit:0]-$> apt-cache policy distro-info-data distro-info
distro-info-data:
Installed: 0.46+18.04.sav0
Candidate: 0.46+18.04.sav0
Version table:
*** 0.46+18.04.sav0 100
100 /var/lib/dpkg/status
0.43ubuntu1.5 500
500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu focal-updates/main i386 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
500 http://security.ubuntu.com/ubuntu focal-security/main i386 Packages
0.43ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu focal/main i386 Packages
distro-info:
Installed: (none)
Candidate: 0.23ubuntu1
Version table:
0.23ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
[Wed Jul 14-14:15:46]-[exit:1]-$> dpkg -l | grep sav
ii distro-info-data 0.46+18.04.sav0 all information about the distributions' releases (data files)
ii glslang-tools 8.13.3763-0ubuntu1~18.04.sav0 amd64 OpenGL and OpenGL ES shader front end and validator -- tools
ii gnome-screensaver 3.6.1-11ubuntu4 amd64 Screensaver and screen lock formerly used in GNOME
ii logsave 1.45.5-2ubuntu1 amd64 save the output of a command in a log file
ii meson 0.55.1-1~18.04.sav0 all high-productivity build system
ii ninja-build 1.10.2-0ubuntu1~18.04.sav0 amd64 small build system closest in spirit to Make
ii python3-distro-info 1.0+18.04sav0 all information about distributions' releases (Python 3 module)
ii spirv-tools 2020.4-1~18.04.sav0 amd64 API and commands for processing SPIR-V modules
ii tzdata 2021a-0ubuntu0.20.04 all time zone and daylight-saving time data
ii x11proto-scrnsaver-dev 2019.2-1ubuntu1 all transitional dummy package
ii xscreensaver 5.42+dfsg1-1ubuntu1 amd64 Screensaver daemon and frontend for X11
ii xscreensaver-data 5.42+dfsg1-1ubuntu1 amd64 Screen saver modules for screensaver frontends
ii xscreensaver-data-extra 5.42+dfsg1-1ubuntu1 amd64 Extra screen saver modules for screensaver frontends
ii xscreensaver-gl 5.42+dfsg1-1ubuntu1 amd64 GL(Mesa) screen saver modules for screensaver frontends
ii xscreensaver-gl-extra 5.42+dfsg1-1ubuntu1 amd64 Extra GL(Mesa) screen saver modules for screensaver frontends
[Wed Jul 14-14:17:48]-[exit:0]-$> aptitude search ~o
i amdvlk - AMD Open Source Driver for Vulkan
i darling - Darling
i darling-dkms - Kernel module for Darling
i discord - Chat for Communities and Friends
i A gstreamer1.0-fluendo-mp3 - Fluendo mp3 decoder GStreamer 1.0 plugin
i A libnih1 - NIH Utility Library
i A libprocps6 - library for accessing process information from /proc
i A libssl1.0.0 - Secure Sockets Layer toolkit - shared libraries
i nomachine - Fast and secure remote access system
i A perl-modules-5.26 - Core Perl modules
i python-iniparse - access and modify configuration data in INI files (Python 2)
i python3.8.1-dev-dosk - python3.8.1-dev
i sc-controller - User-mode driver and GTK3 based GUI for Steam Controller
i tokentool - TokenTool
i A ureadahead - Read required files in advance
注意:Synaptic 包管理器识别出删除现有的 distro-info-data=0.46+18.04.sav0 包会产生某些级联结果:
[Wed Jul 14-14:17:54]-[exit:0]-$> grep -r "deb\ " /etc/apt/ --include=*.list
/etc/apt/sources.list:# deb cdrom:[Ubuntu 18.04.3 LTS _Bionic Beaver_ - Release amd64 (20190805)]/ bionic main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-updates main restricted
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-updates universe
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-updates multiverse
/etc/apt/sources.list:deb http://us.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
/etc/apt/sources.list:# deb http://archive.canonical.com/ubuntu bionic partner
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu focal-security main restricted
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu focal-security universe
/etc/apt/sources.list:deb http://security.ubuntu.com/ubuntu focal-security multiverse
/etc/apt/sources.list:deb https://dl.winehq.org/wine-builds/ubuntu/ focal main
/etc/apt/sources.list:# deb https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04/ ./
/etc/apt/sources.list.d/wine-obs.list:# deb http://download.opensuse.org/repositories/Emulators:/Wine:/Debian/xUbuntu_18.04 ./
/etc/apt/sources.list.d/teamviewer.list:deb https://linux.teamviewer.com/deb stable main
/etc/apt/sources.list.d/teamviewer.list:# deb https://linux.teamviewer.com/deb preview main
/etc/apt/sources.list.d/teamviewer.list:# deb https://linux.teamviewer.com/deb development main
/etc/apt/sources.list.d/lutris-team-ubuntu-lutris-bionic.list:deb http://ppa.launchpad.net/lutris-team/lutris/ubuntu focal main
/etc/apt/sources.list.d/microsoft-prod.list:deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main
/etc/apt/sources.list.d/amdvlk.list:# deb [arch=amd64,i386] http://repo.radeon.com/amdvlk/apt/debian/ bionic main
/etc/apt/sources.list.d/pcsx2-team-ubuntu-pcsx2-daily-bionic.list:deb http://ppa.launchpad.net/pcsx2-team/pcsx2-daily/ubuntu focal main
/etc/apt/sources.list.d/appimagelauncher-team-ubuntu-stable-focal.list:deb http://ppa.launchpad.net/appimagelauncher-team/stable/ubuntu focal main
/etc/apt/sources.list.d/dlech-ubuntu-keepass2-plugins-bionic.list:deb http://ppa.launchpad.net/dlech/keepass2-plugins/ubuntu focal main
/etc/apt/sources.list.d/google-chrome.list:deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
/etc/apt/sources.list.d/solaar-unifying-ubuntu-stable-bionic.list:deb http://ppa.launchpad.net/solaar-unifying/stable/ubuntu focal main
/etc/apt/sources.list.d/libratbag-piper-ubuntu-piper-libratbag-git-bionic.list:deb http://ppa.launchpad.net/libratbag-piper/piper-libratbag-git/ubuntu focal main
/etc/apt/sources.list.d/home:kozec.list:# deb http://download.opensuse.org/repositories/home:/kozec/xUbuntu_18.04/ /
/etc/apt/sources.list.d/dlech-ubuntu-keepass2-plugins-beta-focal.list:# deb http://ppa.launchpad.net/dlech/keepass2-plugins-beta/ubuntu focal main
/etc/apt/sources.list.d/arx-ubuntu-release-bionic.list:deb http://ppa.launchpad.net/arx/release/ubuntu focal main
/etc/apt/sources.list.d/jtaylor-ubuntu-keepass-bionic.list:deb http://ppa.launchpad.net/jtaylor/keepass/ubuntu focal main
/etc/apt/sources.list.d/team-xbmc-ubuntu-ppa-focal.list:deb http://ppa.launchpad.net/team-xbmc/ppa/ubuntu focal main
/etc/apt/sources.list.d/nodesource.list:deb https://deb.nodesource.com/node_15.x focal main
/etc/apt/sources.list.d/linuxuprising-ubuntu-guake-bionic.list:deb http://ppa.launchpad.net/linuxuprising/guake/ubuntu focal main
/etc/apt/sources.list.d/otto-kesselgulasch-ubuntu-gimp-bionic.list:deb http://ppa.launchpad.net/otto-kesselgulasch/gimp/ubuntu focal main
/etc/apt/sources.list.d/diesch-ubuntu-stable-focal.list:deb http://ppa.launchpad.net/diesch/stable/ubuntu focal main
/etc/apt/sources.list.d/dlech-ubuntu-keepass2-plugins-beta-bionic.list:# deb http://ppa.launchpad.net/dlech/keepass2-plugins-beta/ubuntu bionic main
/etc/apt/sources.list.d/savoury1-ubuntu-build-tools-bionic.list:# deb http://ppa.launchpad.net/savoury1/build-tools/ubuntu bionic main
/etc/apt/sources.list.d/takkat-nebuk-ubuntu-takkat-bionic.list:deb http://ppa.launchpad.net/takkat-nebuk/takkat/ubuntu focal main
/etc/apt/sources.list.d/xrdesktop-ubuntu-xrdesktop-focal.list:deb http://ppa.launchpad.net/xrdesktop/xrdesktop/ubuntu focal main
/etc/apt/sources.list.d/kisak-ubuntu-kisak-mesa-bionic.list:deb http://ppa.launchpad.net/kisak/kisak-mesa/ubuntu focal main
/etc/apt/sources.list.d/gregory-hainaut-ubuntu-pcsx2_official_ppa-focal.list:# deb http://ppa.launchpad.net/gregory-hainaut/pcsx2.official.ppa/ubuntu focal main
答案1
这萨夫软件包版本后缀表示第三方软件包起源。
在我们开始之前,请通过 备份您的包裹清单dpkg -l > ~/focal-list.txt
。
然后有很多关于之前添加的线索美味1Ubuntu 18.04 LTS 的 PPA。升级到 20.04 LTS 之前没有清除它,这很糟糕。
我们应该以以下方式破解它 - 我们将重新添加此存储库,然后通过 清除它ppa-purge
。
我们开始做吧:
sudo apt-get install ppa-purge
sudo add-apt-repository ppa:savoury1/build-tools
# the trick - switch PPA to 18.04 LTS (bionic)
sudo sed -i "s/focal/bionic/g" /etc/apt/sources.list.d/savoury1-ubuntu-build-tools-focal.list
sudo apt-get update
sudo ppa-purge ppa:savoury1/build-tools
并确认软件包版本降级。