18.04 → 20.04 升级失败:“E:无法纠正问题,您持有损坏的软件包。”

18.04 → 20.04 升级失败:“E:无法纠正问题,您持有损坏的软件包。”

我正在尝试将 Ubuntu 更新到 20.04,但每次执行时都会中止

$ sudo do-release-upgrade

输出为:

$ sudo do-release-upgrade
Checking for a new Ubuntu release
Get:1 Upgrade tool signature [1.554 B]                                                                                                                                                  
Get:2 Upgrade tool [1.342 kB]                                                                                                                                                           
Fetched 1.344 kB in 0s (0 B/s)                                                                                                                                                          
authenticate 'focal.tar.gz' against 'focal.tar.gz.gpg' 
extracting 'focal.tar.gz'

Reading cache

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit ...                                                                                              
Fetched 64,4 kB in 0s (0 B/s)                                                                                                                                                           
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Checking for installed snaps

Calculating snap size requirements

Updating repository information

Third party sources disabled 

Some third party entries in your sources.list were disabled. You can 
re-enable them after the upgrade with the 'software-properties' tool 
or your package manager. 

To continue please press [ENTER]

Get:1 ...
                                                                              
Fetched 40,6 MB in 6s (6.708 kB/s)                                                                                                                                                      

Checking package manager
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Calculating the changes

Calculating the changes

Could not calculate the upgrade 

An unresolvable problem occurred while calculating the upgrade. 

This was likely caused by: 
* Unofficial software packages not provided by Ubuntu 
Please use the tool 'ppa-purge' from the ppa-purge 
package to remove software from a Launchpad PPA and 
try the upgrade again. 

If none of this applies, then please report this bug using the 
command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal. If 
you want to investigate this yourself the log files in 
'/var/log/dist-upgrade' will contain details about the upgrade. 
Specifically, look at 'main.log' and 'apt.log'. 


Restoring original system state

Aborting
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

main.log 状态

$ cat /var/log/dist-upgrade/main.log
2020-09-30 16:21:06,928 DEBUG Using 'DistUpgradeViewText' view
2020-09-30 16:21:06,980 DEBUG enable dpkg --force-overwrite
2020-09-30 16:21:07,016 DEBUG creating statefile: '/var/log/dist-upgrade/apt-clone_system_state.tar.gz'
2020-09-30 16:21:14,394 DEBUG lsb-release: 'bionic'
2020-09-30 16:21:14,395 DEBUG _pythonSymlinkCheck run
2020-09-30 16:21:14,395 DEBUG openCache()
2020-09-30 16:21:14,396 DEBUG quirks: running PreCacheOpen
2020-09-30 16:21:14,396 DEBUG running Quirks.PreCacheOpen
2020-09-30 16:21:15,760 DEBUG Comparing 4.15.0-117 with 
2020-09-30 16:21:15,761 DEBUG Comparing 4.15.0-118 with 4.15.0-117
2020-09-30 16:21:16,033 DEBUG /openCache(), new cache size 100547
2020-09-30 16:21:16,033 DEBUG need_server_mode(): run in 'desktop' mode, (because of pkg 'ubuntu-desktop')
2020-09-30 16:21:16,033 DEBUG checkViewDepends()
2020-09-30 16:21:16,034 DEBUG running doUpdate() (showErrors=False)
2020-09-30 16:21:19,829 DEBUG openCache()
2020-09-30 16:21:21,156 DEBUG Comparing 4.15.0-117 with 
2020-09-30 16:21:21,156 DEBUG Comparing 4.15.0-118 with 4.15.0-117
2020-09-30 16:21:21,506 DEBUG /openCache(), new cache size 100547
2020-09-30 16:21:21,506 DEBUG doPostInitialUpdate
2020-09-30 16:21:21,507 DEBUG quirks: running focalPostInitialUpdate
2020-09-30 16:21:21,507 DEBUG running Quirks.focalPostInitialUpdate
2020-09-30 16:21:23,560 DEBUG Snap core18 is installed
2020-09-30 16:21:23,860 DEBUG Snap gnome-3-34-1804 is installed
2020-09-30 16:21:23,862 DEBUG Snap gnome-3-34-1804 is not tracking the release channel
2020-09-30 16:21:24,068 DEBUG Snap gtk-common-themes is installed
2020-09-30 16:21:24,376 DEBUG Snap snap-store is installed
2020-09-30 16:21:24,376 DEBUG Snap snap-store is not tracking the release channel
2020-09-30 16:21:24,682 DEBUG Snap gnome-3-28-1804 is installed
2020-09-30 16:21:24,683 DEBUG Snap gnome-3-28-1804 is not tracking the release channel
2020-09-30 16:21:24,902 DEBUG Snap gnome-calculator is installed
2020-09-30 16:21:25,089 DEBUG Snap gnome-characters is installed
2020-09-30 16:21:25,298 DEBUG Snap gnome-logs is installed
2020-09-30 16:21:28,247 DEBUG MetaPkgs: ubuntu-desktop
2020-09-30 16:21:36,258 DEBUG Foreign: audio-recorder com.github.babluboy.nutty containerd.io contractor docker-ce docker-ce-cli google-chrome-stable icu-devtools keepassxc krita krita-data libapache2-mod-php libapache2-mod-php5.6 libapache2-mod-php7.0 libapache2-mod-php7.1 libapache2-mod-php7.2 libapache2-mod-php7.3 libapache2-mod-php7.4 libdrm-amdgpu1 libdrm-amdgpu1:i386 libdrm-common libdrm-intel1 libdrm-intel1:i386 libdrm-nouveau2 libdrm-nouveau2:i386 libdrm-radeon1 libdrm-radeon1:i386 libdrm2 libdrm2:i386 libegl-dev libegl-mesa0 libegl1 libegl1-mesa libegl1-mesa-dev libgbm1 libgd3 libgl-dev libgl1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-dri:i386 libgl1-mesa-glx libgl1-mesa-glx:i386 libgl1:i386 libglapi-mesa libglapi-mesa:i386 libgles-dev libgles1 libgles2 libgles2-mesa-dev libglvnd-dev libglvnd0 libglvnd0:i386 libglx-dev libglx-mesa0 libglx-mesa0:i386 libglx0 libglx0:i386 libgranite-common libgranite5 libicu-dev libicu65 libidn2-0 libllvm10 libllvm10:i386 libnorm1 libopengl-dev libopengl0 libpcre16-3 libpcre2-8-0 libpcre3 libpcre3-dev libpcre32-3 libpcre3:i386 libpcrecpp0v5 libpython-stdlib libpython2-stdlib libsodium23 libssl1.1 libwayland-egl1-mesa libxatracker2 libxml2 libxml2-utils libzip4 libzmq5 mesa-va-drivers mesa-vdpau-drivers mesa-vulkan-drivers mesa-vulkan-drivers:i386 meson obs-studio openssl peek php php-apcu php-apcu-bc php-cli php-common php-curl php-gd php-igbinary php-intl php-ldap php-mbstring php-mysql php-redis php-soap php-sqlite3 php-xml php-xmlrpc php-zip php5.6 php5.6-bcmath php5.6-cli php5.6-common php5.6-curl php5.6-gd php5.6-json php5.6-mbstring php5.6-mysql php5.6-opcache php5.6-readline php5.6-soap php5.6-xml php5.6-zip php7.0 php7.0-bcmath php7.0-bz2 php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-gmp php7.0-intl php7.0-json php7.0-mbstring php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-pgsql php7.0-readline php7.0-soap php7.0-xml php7.0-zip php7.1 php7.1-bcmath php7.1-bz2 php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-gmp php7.1-intl php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-pgsql php7.1-readline php7.1-soap php7.1-xml php7.1-zip php7.2 php7.2-bcmath php7.2-cli php7.2-common php7.2-curl php7.2-gd php7.2-json php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-soap php7.2-xml php7.2-zip php7.3 php7.3-cli php7.3-common php7.3-curl php7.3-gd php7.3-intl php7.3-json php7.3-ldap php7.3-mbstring php7.3-mysql php7.3-opcache php7.3-readline php7.3-soap php7.3-xml php7.3-xmlrpc php7.3-zip php7.4 php7.4-cli php7.4-common php7.4-curl php7.4-gd php7.4-intl php7.4-json php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-soap php7.4-sqlite3 php7.4-xml php7.4-xmlrpc php7.4-zip python python-httplib2 python-minimal python2 python2-minimal python3-httplib2 shotcut spotify-client xserver-xorg-video-amdgpu xserver-xorg-video-ati xserver-xorg-video-intel xserver-xorg-video-nouveau xserver-xorg-video-radeon yarn
2020-09-30 16:21:36,258 DEBUG Obsolete: gifski gitkraken ocenaudio oracle-java8-installer oracle-java8-set-default rambox screamingfrogseospider
2020-09-30 16:21:36,259 DEBUG updateSourcesList()
2020-09-30 16:21:36,278 DEBUG rewriteSourcesList() with mirror_check
2020-09-30 16:21:36,278 DEBUG ['ubuntu-minimal', 'ubuntu-standard']
2020-09-30 16:21:36,278 DEBUG Checking pkg: ubuntu-minimal
2020-09-30 16:21:36,286 DEBUG Checking pkg: ubuntu-standard
2020-09-30 16:21:36,292 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic main restricted'
2020-09-30 16:21:36,292 DEBUG verifySourcesListEntry: deb http://archive.ubuntu.com/ubuntu focal main restricted
2020-09-30 16:21:36,292 DEBUG url_downloadable: http://archive.ubuntu.com/ubuntu/dists/focal/Release
2020-09-30 16:21:36,292 DEBUG s='http' n='archive.ubuntu.com' p='/ubuntu/dists/focal/Release' q='' f=''
2020-09-30 16:21:36,501 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal main restricted' updated to new dist
2020-09-30 16:21:36,501 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted'
2020-09-30 16:21:36,502 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-updates main restricted' updated to new dist
2020-09-30 16:21:36,502 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic universe'
2020-09-30 16:21:36,502 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal universe' updated to new dist
2020-09-30 16:21:36,502 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-updates universe'
2020-09-30 16:21:36,503 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-updates universe' updated to new dist
2020-09-30 16:21:36,503 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic multiverse'
2020-09-30 16:21:36,503 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal multiverse' updated to new dist
2020-09-30 16:21:36,503 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse'
2020-09-30 16:21:36,503 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-updates multiverse' updated to new dist
2020-09-30 16:21:36,503 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse'
2020-09-30 16:21:36,504 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse' updated to new dist
2020-09-30 16:21:36,504 DEBUG examining: 'deb http://archive.canonical.com/ubuntu bionic partner'
2020-09-30 16:21:36,504 DEBUG verifySourcesListEntry: deb http://archive.canonical.com/ubuntu focal partner
2020-09-30 16:21:36,504 DEBUG url_downloadable: http://archive.canonical.com/ubuntu/dists/focal/Release
2020-09-30 16:21:36,505 DEBUG s='http' n='archive.canonical.com' p='/ubuntu/dists/focal/Release' q='' f=''
2020-09-30 16:21:36,703 DEBUG entry 'deb http://archive.canonical.com/ubuntu focal partner' updated to new dist
2020-09-30 16:21:36,704 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-security main restricted'
2020-09-30 16:21:36,704 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-security main restricted' updated to new dist
2020-09-30 16:21:36,704 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-security universe'
2020-09-30 16:21:36,704 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-security universe' updated to new dist
2020-09-30 16:21:36,704 DEBUG examining: 'deb http://archive.ubuntu.com/ubuntu bionic-security multiverse'
2020-09-30 16:21:36,705 DEBUG entry 'deb http://archive.ubuntu.com/ubuntu focal-security multiverse' updated to new dist
2020-09-30 16:21:36,705 DEBUG examining: 'deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable'
2020-09-30 16:21:36,708 DEBUG entry '# deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,708 DEBUG examining: 'deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main'
2020-09-30 16:21:36,712 DEBUG entry '# deb https://dl.winehq.org/wine-builds/ubuntu/ focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,712 DEBUG examining: 'deb http://ppa.launchpad.net/bablu-boy/nutty/ubuntu bionic main'
2020-09-30 16:21:36,715 DEBUG entry '# deb http://ppa.launchpad.net/bablu-boy/nutty/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,716 DEBUG examining: 'deb http://ppa.launchpad.net/kritalime/ppa/ubuntu bionic main'
2020-09-30 16:21:36,719 DEBUG entry '# deb http://ppa.launchpad.net/kritalime/ppa/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,719 DEBUG examining: 'deb http://ppa.launchpad.net/ondrej/php/ubuntu bionic main'
2020-09-30 16:21:36,722 DEBUG entry '# deb http://ppa.launchpad.net/ondrej/php/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,722 DEBUG examining: 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main'
2020-09-30 16:21:36,726 DEBUG entry '# deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,726 DEBUG examining: 'deb http://ppa.launchpad.net/peek-developers/stable/ubuntu bionic main'
2020-09-30 16:21:36,729 DEBUG entry '# deb http://ppa.launchpad.net/peek-developers/stable/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,729 DEBUG examining: 'deb http://repository.spotify.com stable non-free'
2020-09-30 16:21:36,732 DEBUG entry '# deb http://repository.spotify.com stable non-free # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,733 DEBUG examining: 'deb http://ppa.launchpad.net/haraldhv/shotcut/ubuntu bionic main'
2020-09-30 16:21:36,735 DEBUG entry '# deb http://ppa.launchpad.net/haraldhv/shotcut/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,735 DEBUG examining: 'deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu bionic main'
2020-09-30 16:21:36,738 DEBUG entry '# deb http://ppa.launchpad.net/audio-recorder/ppa/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,738 DEBUG examining: 'deb http://ppa.launchpad.net/phoerious/keepassxc/ubuntu bionic main'
2020-09-30 16:21:36,741 DEBUG entry '# deb http://ppa.launchpad.net/phoerious/keepassxc/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,742 DEBUG examining: 'deb https://dl.yarnpkg.com/debian/ stable main'
2020-09-30 16:21:36,744 DEBUG entry '# deb https://dl.yarnpkg.com/debian/ stable main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,744 DEBUG examining: 'deb http://ppa.launchpad.net/obsproject/obs-studio/ubuntu bionic main'
2020-09-30 16:21:36,746 DEBUG entry '# deb http://ppa.launchpad.net/obsproject/obs-studio/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,746 DEBUG examining: 'deb http://ppa.launchpad.net/elementary-os/stable/ubuntu bionic main'
2020-09-30 16:21:36,748 DEBUG entry '# deb http://ppa.launchpad.net/elementary-os/stable/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:36,748 DEBUG examining: 'deb http://ppa.launchpad.net/oibaf/graphics-drivers/ubuntu bionic main'
2020-09-30 16:21:36,750 DEBUG entry '# deb http://ppa.launchpad.net/oibaf/graphics-drivers/ubuntu focal main # disabled on upgrade to focal' was disabled (unknown mirror)
2020-09-30 16:21:39,530 DEBUG running doUpdate() (showErrors=True)
2020-09-30 16:21:58,296 DEBUG openCache()
2020-09-30 16:21:59,479 DEBUG Comparing 4.15.0-117 with 
2020-09-30 16:21:59,480 DEBUG Comparing 4.15.0-118 with 4.15.0-117
2020-09-30 16:21:59,700 DEBUG /openCache(), new cache size 66591
2020-09-30 16:21:59,700 DEBUG need_server_mode(): run in 'desktop' mode, (because of pkg 'ubuntu-desktop')
2020-09-30 16:21:59,701 DEBUG quirks: running PreDistUpgradeCache
2020-09-30 16:21:59,701 DEBUG running Quirks.PreDistUpgradeCache
2020-09-30 16:21:59,701 INFO installing python-is-python2 because python-minimal was installed
2020-09-30 16:21:59,701 DEBUG Installing 'python-is-python2' (python-minimal was installed on the system)
2020-09-30 16:21:59,765 INFO removing python-minimal because python-is-python2 is being installed
2020-09-30 16:21:59,766 DEBUG Removing 'python-minimal' (python-is-python2 is being installed on the system)
2020-09-30 16:21:59,845 INFO failed to remove python-minimal
2020-09-30 16:22:01,792 DEBUG Installing 'xserver-xorg-video-all' (Distro KeepInstalledPkgs rule)
2020-09-30 16:22:02,057 ERROR Dist-upgrade failed: 'E:Unable to correct problems, you have held broken packages.'
2020-09-30 16:22:02,058 DEBUG abort called
2020-09-30 16:22:02,060 DEBUG openCache()
2020-09-30 16:22:05,217 DEBUG Comparing 4.15.0-117 with 
2020-09-30 16:22:05,217 DEBUG Comparing 4.15.0-118 with 4.15.0-117
2020-09-30 16:22:05,498 DEBUG /openCache(), new cache size 100547

尝试删除 python-minimal 会导致我的一半程序(如 emma、mysql workbench 等)被删除。

所有包都已完全更新,所有不必要的包都已删除,apt -f没有返回任何错误。

迄今已尝试:

sudo apt --fix-broken install
sudo apt autoremove
sudo dpkg --get-selections | grep hold

全部 3 个命令均未返回任何错误或警告。

这里该如何进行?

答案1

刚刚使用sudo apt-get purge python-minimal,之后进行了定期升级。

答案2

原因在于第三方 PPA 之一。

我安装了ppa-purge并且aptitude

sudo apt-get install ppa-purge aptitude

ppa-purge我为第三方 PPA执行了一些命令(注意:此命令将从给定的 PPA 中删除所有软件包):

sudo ppa-purge ppa:audio-recorder/ppa
sudo ppa-purge ppa:bablu-boy/nutty
sudo ppa-purge ppa:elementary-os/stable
sudo ppa-purge ppa:haraldhv/shotcut
sudo ppa-purge ppa:kritalime/ppa
sudo ppa-purge ppa:obsproject/obs-studio
sudo ppa-purge ppa:oibaf/graphics-drivers

然后重新启动升级。然后它就成功了。所以他们中肯定有人阻止了它。

sudo do-release-upgrade

答案3

我在进行此更新时也遇到了问题。幸运的是,错误消息很有帮助。如果您看到有关安装非官方软件的部分,请查看以下消息中提到的文件:

如果以上都不适用,请在终端中使用命令“ubuntu-bug ubuntu-release-upgrader-core”报告此错误。如果您想自己调查此问题,“/var/log/dist-upgrade”中的日志文件将包含有关升级的详细信息。具体来说,请查看“main.log”和“apt.log”。

有问题的软件包在其中一个中被提及。尝试卸载提到的软件包并再次执行发行版升级。就我的情况而言,sudo apt-get remove postgresql-10-postgis-2.4 ; sudo apt-get remove ; sudo apt-get autoremove继续升级就足够了。

答案4

我确认删除以下两项:

sudo apt-get remove postgresql-10-postgis-2.4 ; sudo apt-get remove ; sudo apt-get autoremove

sudo apt-get purge python-minimal

已经解决了。

仅供参考,首先我必须通过以下方式进行深度清洁https://fedingo.com/how-to-fix-please-install-all-available-updates-before-upgrading/https://www.howtogeek.com/351360/how-to-upgrade-to-the-latest-version-of-ubuntu/加上一些:

sudo aptitude install [offending or broken package X as shown in logs] 

相关内容