模块“collections”没有属性“Mapping”如何安全地重新安装 update-notifier-common?

模块“collections”没有属性“Mapping”如何安全地重新安装 update-notifier-common?

运行时app upgrade出现以下错误:

$ sudo sudo apt upgrade
[sudo] password for admin-federico-dostuni:
Hit:1 http://azure.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://azure.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://azure.archive.ubuntu.com/ubuntu bionic-backports InRelease [83.3 kB]
Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease
Hit:6 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Fetched 172 kB in 1s (176 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y

Setting up update-notifier-common (3.192.1.15) ...
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 78, in <module>
    class TagSectionWrapper(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'
dpkg: error processing package update-notifier-common (--configure):
 installed update-notifier-common package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 update-notifier-common
E: Sub-process /usr/bin/dpkg returned an error code (1)

在网上查找,问题似乎是由模块collections.Mapping中缺少属性引起的debian.deb822。要解决该问题,我应该:

  1. 项目清单

删除包update-notifier-common

sudo dpkg --remove --force-remove-reinstreq update-notifier-common
  1. 更新 apt,然后重新安装update-notifier-common
sudo apt-get install update-notifier-common

问题是我无法通过第一步,因为我收到以下错误消息:

sudo dpkg --remove --force-remove-reinstreq update-notifier-common
dpkg: dependency problems prevent removal of update-notifier-common:
 ubuntu-server depends on update-notifier-common.

dpkg: error processing package update-notifier-common (--remove):
 dependency problems - not removing
Errors were encountered while processing:
 update-notifier-common

我检查了update-notifier-common依赖项但看起来不太好:

$ apt-cache rdepends update-notifier-common
update-notifier-common
Reverse Depends:
  update-notifier
  flashplugin-installer
  ubuntu-server
  debconf
  ttf-mscorefonts-installer
  apt-config-auto-update
  reboot-notifier
  apt-config-auto-update
  update-notifier
  debconf
  ubuntu-server
  byobu

如何才能安全地删除update-notifier-common而不弄乱整个操作系统?

答案1

显然,问题不update-notifier-common在于我这台机器上的 Python 版本。

相关内容