因此运行后do-release-upgrade
,过程失败,提示我中止或重新启动该窗口(我不记得具体显示了什么错误,而且我无法复制它,因为它没有进一步损坏)。
现在,经过尝试,apt update
我得到了这个:
$>sudo apt update
Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [107 kB]
Hit:2 http://archive.ubuntu.com/ubuntu focal InRelease
Get:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease [107 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB]
Fetched 312 kB in 2s (155 kB/s)
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
因此我尝试使用 重新安装 apt-pkg sudo apt-get install --reinstall python3-apt
,结果如下:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
dnsutils : Depends: bind9-dnsutils but it is not going to be installed
e2fsprogs : PreDepends: libext2fs2 (= 1.45.3-4ubuntu2.1) but 1.45.5-2ubuntu1 is to be installed
Recommends: e2fsprogs-l10n but it is not going to be installed
fwupd : Depends: libglib2.0-0 (>= 2.63.3) but 2.62.4-1~ubuntu19.10.2 is to be installed
gir1.2-glib-2.0 : Depends: libglib2.0-0 (>= 2.63.3) but 2.62.4-1~ubuntu19.10.2 is to be installed
gir1.2-pango-1.0 : Depends: libpango-1.0-0 (= 1.44.7-2ubuntu4) but 1.42.4-7 is to be installed
glib-networking : Depends: libglib2.0-0 (>= 2.63.0) but 2.62.4-1~ubuntu19.10.2 is to be installed
glib-networking-services : Depends: libglib2.0-0 (>= 2.63.0) but 2.62.4-1~ubuntu19.10.2 is to be installed
golang-race-detector-runtime : Depends: golang-1.13-race-detector-runtime but it is not going to be installed
gparted : Depends: gparted-common (= 1.0.0-0.1build1) but it is not going to be installed
libalgorithm-diff-xs-perl : Depends: perlapi-5.30.0
libasound2 : Depends: libasound2-data (>= 1.2.2-2.1) but 1.1.9-0ubuntu1.3 is to be installed
libcairo-gobject-perl : Depends: perlapi-5.30.0
libcairo-perl : Depends: perlapi-5.30.0
libfile-fcntllock-perl : Depends: perlapi-5.30.0
libglib-object-introspection-perl : Depends: perlapi-5.30.0
Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.62.0-1 is to be installed
libglib-perl : Depends: perlapi-5.30.0
libglib2.0-bin : Depends: libglib2.0-0 (= 2.64.2-1~fakesync1) but 2.62.4-1~ubuntu19.10.2 is to be installed
libhtml-parser-perl : Depends: perlapi-5.30.0
libicu-dev : Depends: icu-devtools (>= 66.1-2ubuntu2) but 63.2-2ubuntu0.1 is to be installed
Breaks: icu-devtools (< 66.1-1~) but 63.2-2ubuntu0.1 is to be installed
libnet-dbus-perl : Depends: perlapi-5.30.0
libnet-ssleay-perl : Depends: perlapi-5.30.0
libpam-modules : PreDepends: libpam-modules-bin (= 1.3.1-5ubuntu1.19.10.1) but 1.3.1-5ubuntu4 is to be installed
libpangocairo-1.0-0 : Depends: libpango-1.0-0 (= 1.44.7-2ubuntu4) but 1.42.4-7 is to be installed
libpangoft2-1.0-0 : Depends: libpango-1.0-0 (= 1.44.7-2ubuntu4) but 1.42.4-7 is to be installed
libpangoxft-1.0-0 : Depends: libpango-1.0-0 (= 1.44.7-2ubuntu4) but 1.42.4-7 is to be installed
libpci3 : Depends: pci.ids (>= 0.0~2019.11.10-2) but it is not going to be installed
libpython-dev : Depends: libpython2-dev (= 2.7.17-1) but 2.7.17-2ubuntu4 is to be installed
libpython-stdlib : Depends: libpython2-stdlib (= 2.7.17-1) but 2.7.17-2ubuntu4 is to be installed
libtext-charwidth-perl : Depends: perl-base (>= 5.30.0-8) but 5.28.1-6build1 is to be installed
Depends: perlapi-5.30.0
libtext-iconv-perl : Depends: perl-base (>= 5.30.0-8) but 5.28.1-6build1 is to be installed
Depends: perlapi-5.30.0
libxml-parser-perl : Depends: perlapi-5.30.0
libxml2-dev : Depends: libxml2 (= 2.9.4+dfsg1-7ubuntu3.1) but 2.9.10+dfsg-5 is to be installed
ncurses-bin : PreDepends: libtinfo6 (< 6.2~) but 6.2-0ubuntu2 is to be installed
perl : Depends: perl-base (= 5.30.0-9build1) but 5.28.1-6build1 is to be installed
Depends: perl-modules-5.30 (>= 5.30.0-9build1) but it is not going to be installed
Depends: libperl5.30 (= 5.30.0-9build1) but it is not going to be installed
python-all : Depends: python2 (= 2.7.17-2ubuntu4) but 2.7.17-1 is to be installed
python-all-dev : Depends: python2 (= 2.7.17-2ubuntu4) but 2.7.17-1 is to be installed
python-dev : Depends: python2-dev (= 2.7.17-1) but 2.7.17-2ubuntu4 is to be installed
python-gi : Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.62.0-1 is to be installed
python-minimal : Depends: python2-minimal (= 2.7.17-1) but 2.7.17-2ubuntu4 is to be installed
python-pip : Depends: python-pip-whl (= 18.1-5) but 20.0.2-5ubuntu1 is to be installed
python2 : PreDepends: python2-minimal (= 2.7.17-1) but 2.7.17-2ubuntu4 is to be installed
Depends: libpython2-stdlib (= 2.7.17-1) but 2.7.17-2ubuntu4 is to be installed
python2-dev : Depends: python2 (= 2.7.17-2ubuntu4) but 2.7.17-1 is to be installed
python3 : Depends: libpython3-stdlib (= 3.7.5-1) but 3.8.2-0ubuntu2 is to be installed
python3-apt : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-cairo : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-cffi-backend : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-crypto : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-dbus : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-dev : Depends: python3 (= 3.8.2-0ubuntu2) but 3.7.5-1 is to be installed
Depends: libpython3-dev (= 3.8.2-0ubuntu2) but 3.7.5-1 is to be installed
python3-distutils : Depends: python3 (>= 3.8.0-1~) but 3.7.5-1 is to be installed
python3-gdbm : Depends: python3 (>= 3.8.0-1~) but 3.7.5-1 is to be installed
python3-gi : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.62.0-1 is to be installed
python3-gi-cairo : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-lib2to3 : Depends: python3 (>= 3.8.0-1~) but 3.7.5-1 is to be installed
python3-markupsafe : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-netifaces : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-newt : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-pyrsistent : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-simplejson : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-systemd : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-twisted-bin : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-venv : Depends: python3 (= 3.8.2-0ubuntu2) but 3.7.5-1 is to be installed
python3-yaml : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
python3-zope.interface : Depends: python3 (>= 3.8~) but 3.7.5-1 is to be installed
systemd : Depends: systemd-timesyncd but it is not going to be installed or
time-daemon
vim : Depends: vim-runtime (= 2:8.1.2269-1ubuntu5) but 2:8.1.0875-5ubuntu2.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
这提示我尝试运行apt --fix-broken install
,结果显示:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
dh-python enchant geoip-database golang-1.12-go golang-1.12-race-detector-runtime golang-1.12-src javascript-common
libapt-pkg5.90 libbind9-161 libcodec2-0.8.1 libcupsfilters1 libcupsimage2 libdns-export1104 libdns1104
libenchant1c2a libept1.5.90 libevent-2.1-6 libgeoip1 libgnat-8 libgspell-1-1 libgtkmm-2.4-1v5 libhogweed4 libicu63
libiptc0 libirs161 libisc-export1100 libisc1100 libisccc161 libisccfg163 libisl21 libjs-jquery libjs-sphinxdoc
libjs-underscore liblwres161 libmysofa0 libnettle6 libperl5.28 libplymouth4 libprocps7 libpython-all-dev
libpython2-dev libpython2-stdlib libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib libpython3.7
libpython3.7-dev libpython3.7-minimal libpython3.7-stdlib libx265-176 perl-modules-5.28 python-all python-all-dev
python-asn1crypto python-cffi-backend python-configparser python-crypto python-cryptography python-dbus
python-entrypoints python-enum34 python-gi python-ipaddress python-keyring python-pkg-resources python-setuptools
python-six python-xdg python2 python2-dev python2-minimal python2.7 python2.7-dev python2.7-minimal
python3-asn1crypto python3-nacl python3-pymacaroons python3-xdg python3.7 python3.7-dev python3.7-minimal
python3.7-venv
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
alsa-topology-conf bind9-dnsutils e2fsprogs golang-1.13-race-detector-runtime gparted-common icu-devtools
libasound2-data libgirepository-1.0-1 libglib2.0-0 liblocale-gettext-perl libpam-modules libpango-1.0-0 libperl5.30
libpython3-dev libxml2-dev ncurses-bin pci.ids perl-base perl-modules-5.30 python2 python3 python3-minimal
systemd-timesyncd vim-runtime
Suggested packages:
gpart fuse2fs e2fsck-static alsa-utils python2-doc python-tk python3-doc python3-tk
Recommended packages:
e2fsprogs-l10n
The following packages will be REMOVED:
libpython-dev libpython-stdlib nodejs python python-dev python-keyrings.alt python-minimal python-pip
python-secretstorage python-wheel
The following NEW packages will be installed:
alsa-topology-conf bind9-dnsutils golang-1.13-race-detector-runtime gparted-common libperl5.30 pci.ids
perl-modules-5.30 systemd-timesyncd
The following packages will be upgraded:
e2fsprogs icu-devtools libasound2-data libgirepository-1.0-1 libglib2.0-0 liblocale-gettext-perl libpam-modules
libpango-1.0-0 libpython3-dev libxml2-dev ncurses-bin perl-base python2 python3 python3-minimal vim-runtime
16 upgraded, 8 newly installed, 10 to remove and 6 not upgraded.
835 not fully installed or removed.
Need to get 18.8 MB of archives.
After this operation, 34.1 MB disk space will be freed.
Do you want to continue? [Y/n] y
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
wever:
Package libc6:amd64 is not configured yet.
libselinux1:amd64 depends on libpcre2-8-0 (>= 10.22); however:
Package libpcre2-8-0:amd64 is not configured yet.
dpkg: error processing package libselinux1:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libzstd1:amd64:
libzstd1:amd64 depends on libc6 (>= 2.14); however:
Package libc6:amd64 is not configured yet.
dpkg: error processing package libzstd1:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of zlib1g:amd64:
zlib1g:amd64 depends on libc6 (>= 2.14); however:
Package libc6:amd64 is not configured yet.
dpkg: error processing package zlib1g:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libacl1:amd64:
libacl1:amd64 depends on libc6 (>= 2.14); however:
E: Sub-process /usr/bin/dpkg returned an error code (1)
经过搜索我已经尝试了这些解决方案:
dpkg --configure -a
给出:dpkg: dependency problems prevent configuration of libnet-ssleay-perl: libnet-ssleay-perl depends on perlapi-5.30.0; however: Package perlapi-5.30.0 is not installed. dpkg: error processing package libnet-ssleay-perl (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python3-distutils: python3-distutils depends on python3 (>= 3.8.0-1~); however: Version of python3 on system is 3.7.5-1. dpkg: error processing package python3-distutils (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of dh-python: dh-python depends on python3-distutils | python3 (<< 3.6.5~rc1-1); however: Package python3-distutils is not configured yet. Version of python3 on system is 3.7.5-1. dpkg: error processing package dh-python (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libglib-object-introspection-perl: libglib-object-introspection-perl depends on perlapi-5.30.0; however: Package perlapi-5.30.0 is not installed. libglib-object-introspection-perl depends on libgirepository-1.0-1 (>= 1.62.0-4~); however: Version of libgirepository-1.0-1:amd64 on system is 1.62.0-1. dpkg: error processing package libglib-object-introspection-perl (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libtext-iconv-perl: libtext-iconv-perl depends on perl-base (>= 5.30.0-8); however: Version of perl-base on system is 5.28.1-6build1. libtext-iconv-perl depends on perlapi-5.30.0; however: Package perlapi-5.30.0 is not installed. dpkg: error processing package libtext-iconv-perl (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of glib-networking-services: glib-networking-services depends on libglib2.0-0 (>= 2.63.0); however: Version of libglib2.0-0:amd64 on system is 2.62.4-1~ubuntu19.10.2. dpkg: error processing package glib-networking-services (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libtext-charwidth-perl: libtext-charwidth-perl depends on perl-base (>= 5.30.0-8); however: Version of perl-base on system is 5.28.1-6build1. libtext-charwidth-perl depends on perlapi-5.30.0; however: Package perlapi-5.30.0 is not installed. dpkg: error processing package libtext-charwidth-perl (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libxml-parser-perl: libxml-parser-perl depends on perlapi-5.30.0; however: Package perlapi-5.30.0 is not installed. dpkg: error processing package libxml-parser-perl (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python-gi: python-gi depends on libgirepository-1.0-1 (>= 1.62.0-4~); however: Version of libgirepository-1.0-1:amd64 on system is 1.62.0-1. dpkg: error processing package python-gi (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of golang-race-detector-runtime: golang-race-detector-runtime depends on golang-1.13-race-detector-runtime; however: Package golang-1.13-race-detector-runtime is not installed. dpkg: error processing package golang-race-detector-runtime (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of python3-dbus: python3-dbus depends on python3 (>= 3.8~); however: Version of python3 on system is 3.7.5-1. dpkg: error processing package python3-dbus (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libglib-perl:amd64: libglib-perl:amd64 depends on perlapi-5.30.0; however: Package perlapi-5.30.0 is not installed. --- a whole lot of these types of errors which I didn't include to save space --- dpkg: error processing package python3-jsonschema (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libipc-system-simple-perl: libipc-system-simple-perl depends on perl:any; however: Package perl is not configured yet. dpkg: error processing package libipc-system-simple-perl (--configure): dependency problems - leaving unconfigured dpkg: too many errors, stopping Errors were encountered while processing: libnet-ssleay-perl python3-distutils dh-python libglib-object-introspection-perl libtext-iconv-perl glib-networking-services libtext-charwidth-perl libxml-parser-perl python-gi golang-race-detector-runtime python3-dbus libglib-perl:amd64 vim python3-cairo:amd64 python2-dev python3-setuptools libpangoxft-1.0-0:amd64 libfile-fcntllock-perl python3-gdbm:amd64 python3-zope.interface python3-apt update-notifier-common gparted libxml-twig-perl python3-twisted-bin:amd64 libnet-dbus-perl libglib2.0-bin python3-yaml systemd python-all dnsutils ubuntu-standard python3-newt:amd64 python3-distupgrade landscape-common python3-markupsafe software-properties-common python3-apport netplan.io python3-simplejson unattended-upgrades perl gir1.2-pango-1.0:amd64 python3-jinja2 libxml2-dev:amd64 python3-venv python3-secretstorage python3-software-properties python3-jsonschema libipc-system-simple-perl Processing was halted because there were too many errors.
apt install -f
给出:Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following packages were automatically installed and are no longer required: dh-python enchant geoip-database golang-1.12-go golang-1.12-race-detector-runtime golang-1.12-src javascript-common libapt-pkg5.90 libbind9-161 libcodec2-0.8.1 libcupsfilters1 libcupsimage2 libdns-export1104 libdns1104 libenchant1c2a libept1.5.90 libevent-2.1-6 libgeoip1 libgnat-8 libgspell-1-1 libgtkmm-2.4-1v5 libhogweed4 libicu63 libiptc0 libirs161 libisc-export1100 libisc1100 libisccc161 libisccfg163 libisl21 libjs-jquery libjs-sphinxdoc libjs-underscore liblwres161 libmysofa0 libnettle6 libperl5.28 libplymouth4 libprocps7 libpython-all-dev libpython2-dev libpython2-stdlib libpython2.7 libpython2.7-dev libpython2.7-minimal libpython2.7-stdlib libpython3.7 libpython3.7-dev libpython3.7-minimal libpython3.7-stdlib libx265-176 perl-modules-5.28 python-all python-all-dev python-asn1crypto python-cffi-backend python-configparser python-crypto python-cryptography python-dbus python-entrypoints python-enum34 python-gi python-ipaddress python-keyring python-pkg-resources python-setuptools No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already No apport report written because MaxReports is reached already wever: Package libc6:amd64 is not configured yet. libselinux1:amd64 depends on libpcre2-8-0 (>= 10.22); however: Package libpcre2-8-0:amd64 is not configured yet. dpkg: error processing package libselinux1:amd64 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libzstd1:amd64: libzstd1:amd64 depends on libc6 (>= 2.14); however: Package libc6:amd64 is not configured yet. dpkg: error processing package libzstd1:amd64 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of zlib1g:amd64: zlib1g:amd64 depends on libc6 (>= 2.14); however: Package libc6:amd64 is not configured yet. dpkg: error processing package zlib1g:amd64 (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of libacl1:amd64: libacl1:amd64 depends on libc6 (>= 2.14); however: E: Sub-process /usr/bin/dpkg returned an error code (1)
所以现在我完全不知所措。我已经尝试了从互联网上收集到的所有方法。任何帮助都将不胜感激。
需要注意的一点是,我在 Windows 上使用 WSL。我使用的是 Ubuntu 19.10,运行do-release-upgrade
升级到 20.04 LTS 失败了。之后,我看到 Microsoft 商店有一个 Ubuntu 更新,可以升级到 20.04。我下载了它,do-release-upgrade
再次运行,也失败了。但如果我运行 neofetch,它会说我实际上正在运行 20.04。我不确定这是否是有用的信息,但我想说出来。
答案1
老实说,此时您可能会考虑从 Windows PC 上卸载 Ubuntu 并重新安装 20.04。您可以备份所有数据,然后在重新安装操作系统后恢复它。
这文章可能会帮助你入门。
答案2
您的依赖关系非常断裂。
如果不知道问题出在哪里就很难告诉您如何修复。
如果您使用的是 WSL 1,则应坚持使用 18.04,最高可达 19.10,但不要升级到 20.04:https://discourse.ubuntu.com/t/ubuntu-20-04-and-wsl-1/15291
我可能会将文件移至 Windows 中的 /mnt/c,然后卸载。如果您使用的是 WSL 1,请重新安装 Ubuntu 18.04;如果是 WSL 2,请重新安装 Ubuntu 20.04。
您还可以侧载非 LTS 版本:https://wiki.ubuntu.com/WSL#Installing_Ubuntu_on_WSL_via_rootfs