损坏的软件包(更新通知程序、更新管理器)会破坏使用 apt 或 apt-get 或 dpkg 甚至 synap 进行的所有类型的安装

损坏的软件包(更新通知程序、更新管理器)会破坏使用 apt 或 apt-get 或 dpkg 甚至 synap 进行的所有类型的安装

很长一段时间以来,我每次安装软件包时都会遇到问题。例如,当我尝试安装 alien 软件包时,我得到的是:


sudo apt-get install alien
Reading package lists... Done
Building dependency tree       
Reading state information... Done
alien is already the newest version (8.95).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [O/n] O
Setting up update-notifier-common (3.192.1.7) ...
Traceback (most recent call last):
File "/usr/lib/update-notifier/package-data-downloader", line 24, in  <module>
import debian.deb822
File "/usr/lib/python3/dist-packages/debian/deb822.py", line 38, in  <module>
import chardet
ModuleNotFoundError: No module named 'chardet'
dpkg: error processing package update-notifier-common (--configure):
installed update-notifier-common package post-installation script     subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of update-notifier:
update-notifier depends on update-notifier-common (= 3.192.1.7); however:
Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-desktop:
ubuntu-desktop depends on update-notifier; however:
Package update-notifier is not configured yet.

dpkg: error processing package ubuntu-desktop (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-manager:
update-manager depends on update-notifier; however:
Package update-notifier is not configured yet.

dpkg: error processing package update-manager (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates it's a follow-up error from a previous failure.
No apport report written because the error   message indicates it's a follow-up error from a previous failure.
No apport report written because MaxReports has already been reached
Errors were encountered while processing:
update-notifier-common
update-notifier
ubuntu-desktop
update-manager
E: Sub-process /usr/bin/dpkg returned an error code (1)

我试图修复包裹,但问题仍然存在

enter code here
sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up update-notifier-common (3.192.1.7) ...
Traceback (most recent call last):
File "/usr/lib/update-notifier/package-data-downloader", line 24, in <module>
import debian.deb822
File "/usr/lib/python3/dist-packages/debian/deb822.py", line 38, in <module>
import chardet
ModuleNotFoundError: No module named 'chardet'
dpkg: error processing package update-notifier-common (--configure):
installed update-notifier-common package post-installation script     subprocess returned error exit status 1
No apport report written because the error message indicates it's a   follow-up error from a previous failure.
 dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 3.192.1.7);   however:
 Package update-notifier-common is not configured yet.
 dpkg: error processing package update-notifier (--configure):
 dependency problems - leaving unconfigured
 dpkg: dependency problems prevent configuration of ubuntu-desktop:
 ubuntu-desktop depends on update-notifier; however:
 Package update-notifier is not configured yet.

 dpkg: error processing package ubuntu-desktop (--configure):
 dependency problems - leaving unconfigured
 dpkg: dependency problems prevent configuration of update-manager:
 update-manager depends on update-notifier; however:
 Package update-notifier is not configured yet.

 dpkg: error processing package update-manager (--configure):
 dependency problems - leaving unconfigured
 No apport report written because the error message indicates it's a  follow-up error from a previous failure.
 No apport report written because MaxReports has already been reached
 Errors were encountered while processing:
 update-notifier-common
 update-notifier
 ubuntu-desktop
 update-manager
 E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

今天也遇到了同样的问题,在 Stack Overflow 上搜索了好多遍,都没有找到想要的解决方案,后来在一个中文网站上找到了解决办法,如下:

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get upgrade

参考这里

答案2

cd /var/lib/dpkg
sudo mv info info.bak
sudo mkdir info
sudo apt-get upgrade

您应该将原始info目录放回原位,以便包管理系统可以正确跟踪已安装的包:

sudo mv /var/lib/dpkg/info /var/lib/dpkg/info.replacement
sudo mv /var/lib/dpkg/info.bak /var/lib/dpkg/info
sudo dpkg --configure -a
sudo apt clean && sudo apt update && sudo apt upgrade
sudo apt autoremove && sudo apt install -f

相关内容