如何修复“dpkg:处理软件包 systemd 时出错(--configure):

Ila*_*lak 3 upgrade systemd 18.04

我最近从 16.04 升级到 18.04,我认为升级过程中出现了问题。当我运行时sudo apt-get install -f,它尝试升级udev,但随后我收到有关“不安全符号链接”的重复消息和此错误消息:

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

我之前收到过类似的消息systemd-shim,但设法修复了它。我也遇到了不正确的问题/etc/apt/sources.list,但我认为这也已解决。我在升级过程中收到各种错误消息,最后我不得不“销毁”某些东西,而不是正确完成升级(不幸的是我不记得到底发生了什么。)对于发生了什么有什么想法吗?

ldi*_*ias 6

检查您是否是所有目录的所有者:

stat / /dev /var
Run Code Online (Sandbox Code Playgroud)

如果您不是所有者,请在终端中运行以下命令:

chown root DirectoryYouAreNotOwner
Run Code Online (Sandbox Code Playgroud)

注意:将 DirectoryYouAreNotOwner 替换为您不是其所有者的目录。例如,如果 的所有者/unknown

chown root /
Run Code Online (Sandbox Code Playgroud)

感谢这篇Ask Ubuntu 帖子。