Ubuntu 16.04 当我在系统故障后从备份恢复系统时,我的 apt 损坏了。
当我尝试使用 apt 时,例如:
$ sudo apt install pyroom
Setting up python3 (3.5.1-3) ...
running python rtupdate hooks for python3.5...
dpkg-query: package 'rhythmbox-plugins' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their 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: error processing package python3 (--configure):
subprocess installed post-installation script returned error exit status 4
Errors were encountered while processing:
python3
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我检查我的公寓列表时:
$ apt list python3.5
Listing... Done
python3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
当我尝试重新配置时,出现错误:
$ sudo dpkg --configure -a
Setting up python3 (3.5.1-3) ...
running python rtupdate hooks for python3.5...
dpkg-query: package 'rhythmbox-plugins' is not installed
Use dpkg --info (= dpkg-deb --info) to examine archive files,
and dpkg --contents (= dpkg-deb --contents) to list their 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: error processing package python3 (--configure):
subprocess installed post-installation script returned error exit status 4
dpkg: dependency problems prevent processing triggers for gnome-menus:
gnome-menus depends on python3:any (>= 3.1~); however:
Package python3 is not configured yet.
dpkg: error processing package gnome-menus (--configure):
dependency problems - leaving triggers unprocessed
Errors were encountered while processing:
python3
gnome-menus
我可以做什么来解决这个问题?
我花了几天时间寻找解决方案。 我调查了当前不同的包依赖关系:
$ apt list python3.5
Listing... Done
python3.5/xenial-updates,xenial-security,now 3.5.2-2ubuntu0~16.04.1 amd64 [installed,automatic]
但打破了依赖性:
Python 3.5.1-3
。
我删除了
Python 3.5.1
依赖的软件包并重新安装了它们。
然后运行:
$ sudo dpkg --configure -a
我得到了成功的结果。
通过删除目录 /usr/share/python3/runtime.d 中的 .rtupdate 文件并重新安装 python3 来修复。