解决dpkg错误代码(1):systemd与python3配置失败导致无法安装软件的问题求助
我现在完全卡壳了,一直碰到同一个错误,根本没法正常操作——既装不了任何软件,网上帖子里别人说的各种修复方法也都不管用。
安装Firefox时的错误详情
当我执行sudo apt-get install firefox时,出现了以下错误:
The following packages were automatically installed and are no longer required:
libmpdec3 libpython3-stdlib libpython3.10-minimal libpython3.10-stdlib
python3 python3-minimal python3.10 python3.10-minimal
Use 'sudo apt autoremove' to remove them.The following additional packages will be installed:
apparmor dbus dbus-user-session dirmngr fuse3 gnupg gnupg-l10n gnupg-utils
gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm libassuan0
libcbor0.8 libdbus-1-3 libedit2 libfido2-1 libfuse3-3 libksba8 liblzo2-2
libnpth0 libnss-systemd libpam-runtime libpam-systemd libx11-6 libx11-data
libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 lsb-base openssh-client
pinentry-curses snapd squashfs-tools systemd-hwe-hwdb systemd-sysv udev
xauthSuggested packages:
apparmor-profiles-extra apparmor-utils pinentry-gnome3 tor parcimonie
xloadimage scdaemon keychain libpam-ssh monkeysphere ssh-askpass
pinentry-doc zenity | kdialogThe following NEW packages will be installed:
apparmor dbus dbus-user-session dirmngr firefox fuse3 gnupg gnupg-l10n
gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm
libassuan0 libcbor0.8 libdbus-1-3 libedit2 libfido2-1 libfuse3-3 libksba8
liblzo2-2 libnpth0 libnss-systemd libpam-runtime libpam-systemd libx11-6
libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1 lsb-base
openssh-client pinentry-curses snapd squashfs-tools systemd-hwe-hwdb
systemd-sysv udev xauth0 upgraded, 43 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/29.2 MB of archives.
After this operation, 126 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
debconf: delaying package configuration, since apt-utils is not installed
Setting up systemd (249.11-0ubuntu3.11) ...
cp: '/etc/resolv.conf' and '/run/systemd/resolve/stub-resolv.conf' are the same file
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)
强制安装也没用,我尝试安装Chrome、Chromium、Brave等其他浏览器时,都会出现相同的错误。
执行sudo dpkg --configure -a时的错误详情
我试过重新配置dpkg,但完全不管用,执行这个命令后出现了一堆错误:
Setting up python3 (3.10.6-1~22.04) ... running python rtupdate hooks for python3.10... dpkg-query: package 'gedit' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of gedit error running python rtupdate hook gedit dpkg-query: package 'hplip-data' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of hplip-data error running python rtupdate hook hplip-data dpkg-query: package 'ibus-table' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of ibus-table error running python rtupdate hook ibus-table dpkg-query: package 'ibus' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of ibus error running python rtupdate hook ibus dpkg-query: package 'python3-uno' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of python3-uno error running python rtupdate hook python3-uno dpkg-query: package 'rhythmbox-plugin-alternative-toolbar' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of rhythmbox-plugin-alternative-toolbar error running python rtupdate hook rhythmbox-plugin-alternative-toolbar dpkg-query: package 'rhythmbox-plugins' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of rhythmbox-plugins error running python rtupdate hook rhythmbox-plugins dpkg-query: package 'system-config-printer-common' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of system-config-printer-common error running python rtupdate hook system-config-printer-common dpkg-query: package 'system-config-printer' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of system-config-printer error running python rtupdate hook system-config-printer dpkg-query: package 'ubuntu-drivers-common' is not installed Use dpkg --contents (= dpkg-deb --contents) to list archive files contents. Traceback (most recent call last): File "/usr/bin/py3clean", line 210, in <module> main() File "/usr/bin/py3clean", line 196, in main pfiles = set(dpf.from_package(options.package)) File "/usr/share/python3/debpython/files.py", line 53, in from_package raise Exception("cannot get content of %s" % package_name) Exception: cannot get content of ubuntu-drivers-common error running python rtupdate hook ubuntu-drivers-common dpkg: error processing package python3 (--configure): installed python3 package post-installation script subprocess returned error exit status 4 Setting up systemd (249.11-0ubuntu3.11) ... cp: '/etc/resolv.conf' and '/run/systemd/resolve/stub-resolv.conf' are the same file dpkg: error processing package systemd (--configure): installed systemd package post-installation script subprocess returned error exit status 1 Errors were encountered while processing: python3 systemd
我真的快被逼疯了,网上大家说的唯一解决办法就是重新配置dpkg,但这根本没用。有没有大佬知道怎么解决这个问题啊?
备注:内容来源于stack exchange,提问作者WebWarriorResearcher

