“错误处理包”-由于包配置错误,apt upgrade 无法运行

“错误处理包”-由于包配置错误,apt upgrade 无法运行

我知道这个问题之前已经被问过很多次了但是这些解决方案都对我没有任何帮助。

每次运行时sudo apt upgrade我都会出现这个错误。

dpkg: error processing package systemd (--configure):
 installed systemd package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 systemd
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo dpkg --configure -a返回

  Setting up udev (237-3ubuntu10.28) ...
/var/lib/dpkg/info/udev.postinst: 108: /var/lib/dpkg/info/udev.postinst: addgroup: not found
dpkg: error processing package udev (--configure):
 installed udev package post-installation script subprocess returned error exit status 127
Setting up systemd (237-3ubuntu10.28) ...
/var/lib/dpkg/info/systemd.postinst: 123: /var/lib/dpkg/info/systemd.postinst: addgroup: not found
dpkg: error processing package systemd (--configure):
 installed systemd package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of libnss-systemd:amd64:
 libnss-systemd:amd64 depends on systemd (= 237-3ubuntu10.28); however:
  Package systemd is not configured yet.

dpkg: error processing package libnss-systemd:amd64 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libpam-systemd:amd64:
 libpam-systemd:amd64 depends on systemd (= 237-3ubuntu10.28); however:
  Package systemd is not configured yet.

dpkg: error processing package libpam-systemd:amd64 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 udev
 systemd
 libnss-systemd:amd64
 libpam-systemd:amd64

systemd我认为删除所有软件包并不安全。任何帮助都非常感谢,我使用的是 Ubuntu 18.04。

答案1

stat / /dev /var

检查您是否是所有目录的所有者。如果不是,请运行:

chown root DirectoryYouAreNotOwner

在我的例子中, 的所有者/Unknown。因此我使用了以下命令:

chown root /

答案2

Miguel Saldanha 的答案对我没有用,我尝试再搜索一下。最后,这个帖子对我有帮助。只是在这里发布答案,因为这已经在几个地方被提及,以防将来有人需要它。

sudo rm /var/lib/dpkg/info/systemd*
sudo dpkg --configure -D 777 systemd
sudo apt -f install

希望能帮助到你。

相关内容