Ubuntu 18.04 dpkg/apport 问题

Ubuntu 18.04 dpkg/apport 问题

我最近在我的系统上更新了 python2,现在每当我尝试更新或安装任何软件包时,都会收到以下错误:

sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  apport
Suggested packages:
  apport-gtk | apport-kde
The following packages will be upgraded:
  apport
1 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
3 not fully installed or removed.
Need to get 0 B/124 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 283944 files and directories currently installed.)
Preparing to unpack .../apport_2.20.9-0ubuntu7.4_all.deb ...
/var/lib/dpkg/info/apport.prerm: 22: /var/lib/dpkg/info/apport.prerm: pyclean: Permission denied
dpkg: warning: old apport package pre-removal script subprocess returned error exit status 126
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 22: /var/lib/dpkg/tmp.ci/prerm: pyclean: Permission denied
dpkg: error processing archive /var/cache/apt/archives/apport_2.20.9-0ubuntu7.4_all.deb (--unpack):
 new apport package pre-removal script subprocess returned error exit status 126
/var/lib/dpkg/info/apport.postinst: 13: /var/lib/dpkg/info/apport.postinst: pycompile: Permission denied
dpkg: error while cleaning up:
 installed apport package post-installation script subprocess returned error exit status 126
Errors were encountered while processing:
 /var/cache/apt/archives/apport_2.20.9-0ubuntu7.4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试过更新和升级,删除 apport 并重新安装,以及再次更新重新安装 python2。我还尝试过重新安装 apport 并删除

/var/cache/apt/archives/apport_2.20.9-0ubuntu7.4_all.deb

看完之后帖子发布后,我在尝试更新或安装系统上的任何软件包时遇到以下错误:

sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python-configparser (3.5.0-1) ...
/var/lib/dpkg/info/python-configparser.postinst: 6: /var/lib/dpkg/info/python-configparser.postinst: pycompile: Permission denied
dpkg: error processing package python-configparser (--configure):
 installed python-configparser package post-installation script subprocess returned error exit status 126
Setting up apport (2.20.9-0ubuntu7.4) ...
/var/lib/dpkg/info/apport.postinst: 13: /var/lib/dpkg/info/apport.postinst: pycompile: Permission denied
dpkg: error processing package apport (--configure):
 installed apport package post-installation script subprocess returned error exit status 126
Setting up python-pip (9.0.1-2.3~ubuntu1) ...
/var/lib/dpkg/info/python-pip.postinst: 6: /var/lib/dpkg/info/python-pip.postinst: pycompile: Permission denied
dpkg: error processing package python-pip (--configure):
 installed python-pip package post-installation script subprocess returned error exit status 126
Errors were encountered while processing:
 python-configparser
 apport
 python-pip
E: Sub-process /usr/bin/dpkg returned an error code (1)

我知道错误 126 表示软件包已损坏或不完整,并且我看到过一些解决方案需要强制删除软件包,例如,

sudo dpkg --remove --force-remove-reinstreq PACKAGE_NAME

但我担心删除可能对系统运行至关重要的 python 包,所以我犹豫是否要删除它们。

编辑

我已经解决了这个问题使用 Live CD 重新安装 Ubuntu,无需重新格式化分区。只需恢复已安装的软件包。

相关内容