Ubuntu dpkg:处理包时出错(apt-get 升级后)

Ubuntu dpkg:处理包时出错(apt-get 升级后)

我最近从 dpkg 信息中删除了所有 python 文件来解决这个问题,但这不起作用,甚至损坏了。然后安装 ubuntu-desktop 后,再次面临同样的问题。

[root@nar-ubuntu ~]$ apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  dmsetup libdevmapper1.02.1
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 202 kB/326 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://am.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdevmapper1.02.1 amd64 2:1.02.145-4.1ubuntu3.18.04.2 [127 kB]
75% [Working]                               
Get:2 http://am.archive.ubuntu.com/ubuntu bionic-updates/main amd64 dmsetup amd64 2:1.02.145-4.1ubuntu3.18.04.2 [74.5 kB]
Fetched 202 kB in 0s (903 kB/s)   
dpkg: warning: files list file for package 'python-apt-common' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cryptography' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python-pip-whl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-yaml' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-speechd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-distro-info' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pil:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cups' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dbus' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-rfc3339' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyatspi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cffi-backend' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-olefile' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-keyring' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-brlapi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-mako' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-crypto' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-requests-unixsocket' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-simplejson' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-idna' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xdg' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-update-manager' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-keyrings.alt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-six' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-oauth' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pymacaroons' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-certifi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-wadllib' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.gtk3widgets' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-zope.interface' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi-cairo' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pkg-resources' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apport' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-markupsafe' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lazr.restfulclient' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-defer' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-problem-report' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-asn1crypto' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-macaroonbakery' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-protobuf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debconf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pexpect' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-chardet' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-systemd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-httplib2' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-requests' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-nacl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cupshelpers' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-urllib3' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab-accel:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cairo:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-launchpadlib' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-secretstorage' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ptyprocess' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-tz' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debian' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-louis' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-distupgrade' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python2.7-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dateutil' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xkit' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python-talloc' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lazr.uri' missing; assuming package has no files currently installed
(Reading database ... 250868 files and directories currently installed.)
Preparing to unpack .../libdevmapper1.02.1_2%3a1.02.145-4.1ubuntu3.18.04.2_amd64.deb ...
Unpacking libdevmapper1.02.1:amd64 (2:1.02.145-4.1ubuntu3.18.04.2) over (2:1.02.145-4.1ubuntu3.18.04.1) ...
Preparing to unpack .../dmsetup_2%3a1.02.145-4.1ubuntu3.18.04.2_amd64.deb ...
Unpacking dmsetup (2:1.02.145-4.1ubuntu3.18.04.2) over (2:1.02.145-4.1ubuntu3.18.04.1) ...
Setting up python2.7 (2.7.15-4ubuntu4~18.04.2) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
/usr/bin/python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing package python2.7 (--configure):
 installed python2.7 package post-installation script subprocess returned error exit status 2
Setting up libdevmapper1.02.1:amd64 (2:1.02.145-4.1ubuntu3.18.04.2) ...
Setting up python-minimal (2.7.15~rc1-1) ...
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
dpkg: error processing package python-minimal (--configure):
 installed python-minimal package post-installation script subprocess returned error exit status 1
dpkg: error processing package apport (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
Setting up dmsetup (2:1.02.145-4.1ubuntu3.18.04.2) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for initramfs-tools (0.130ubuntu3.9) ...
update-initramfs: Generating /boot/initrd.img-5.0.0-37-generic
Errors were encountered while processing:
 python2.7
 python-minimal
 apport
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

简单来说,如果你删除了 dpkg 应该处理的文件,它就会报错。通常,您不应删除本应由包管理器处理的文件。

重新安装软件包,然后使用 apt、dpkg 或您最喜欢的前端正确卸载它们,一切都会好起来的。

最坏的情况是彻底重新安装系统。是的,您可以在重新安装时保留用户数据。

请注意,如果您由于依赖关系而无法卸载某些内容,则意味着您可能需要它并且不应该卸载它。以后不要手动卸载东西。您最应该做的就是添加一些缺失的链接或编辑一些配置文件。

相关内容