dpkg 依赖问题:软件包 python3 尚未配置

dpkg 依赖问题:软件包 python3 尚未配置

我最近必须重新启动,并且sudo apt upgrade从那时起运行就导致依赖性问题:

The following packages were automatically installed and are no longer required:
  libapparmor1 libargon2-1 libcryptsetup12 libdevmapper1.02.1 libip4tc2 libjson-c5 libkmod2 systemd
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
13 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up python3 (3.10.6-1~22.04) ...
running python rtupdate hooks for python3.10...
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 '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: error processing package python3 (--configure):
 installed python3 package post-installation script subprocess returned error exit status 4
Setting up systemd (249.11-0ubuntu3.9) ...
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
dpkg: dependency problems prevent configuration of python3-wheel:
 python3-wheel depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-wheel (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-dev:
 python3-dev depends on python3 (= 3.10.6-1~22.04); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-dev (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pip:
 python3-pip depends on python3-wheel; however:
  Package python3-wheel is not configured yet.
 python3-pip depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pip (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of lsb-release:
 lsb-release depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package lsb-release (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-lib2to3:
 python3-lib2to3 depends on python3:any (>= 3.10.5-0~); however:
  Package python3 is not configured yet.
 python3-lib2to3 depends on python3:any (<< 3.12); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-lib2to3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pkg-resources:
 python3-pkg-resources depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pkg-resources (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-distutils:
 python3-distutils depends on python3:any (>= 3.10.5-0~); however:
  Package python3 is not configured yet.
 python3-distutils depends on python3:any (<< 3.12); however:
  Package python3 is not configured yet.
 python3-distutils depends on python3-lib2to3 (= 3.10.6-1~22.04); however:
  Package python3-lib2to3 is not configured yet.

dpkg: error processing package python3-distutils (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-setuptools:
 python3-setuptools depends on python3-pkg-resources (= 59.6.0-1.2ubuntu0.22.04.1); however:
  Package python3-pkg-resources is not configured yet.
 python3-setuptools depends on python3-distutils; however:
  Package python3-distutils is not configured yet.
 python3-setuptools depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-setuptools (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-distro:
 python3-distro depends on lsb-release; however:
  Package lsb-release is not configured yet.
 python3-distro depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
 hplip-data depends on python3-distro; however:
  Package python3-distro is not configured yet.
 hplip-data depends on python3:any; however:
  Package python3 is not configured yet.

  Package lsb-release is not configured yet.
 python3-distro depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
 hplip-data depends on python3-distro; however:
  Package python3-distro is not configured yet.
 hplip-data depends on python3:any; however:
  Package python3 is not configured yet.

  Package lsb-release is not configured yet.
 python3-distro depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
 hplip-data depends on python3-distro; however:
  Package python3-distro is not configured yet.
 hplip-data depends on python3:any; however:
  Package lsb-release is not configured yet.
 python3-distro depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
 hplip-data depends on python3-distro; however:
  Package python3-distro is not configured yet.
 hplip-data depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package hplip-data (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-all:
 python3-all depends on python3 (= 3.10.6-1~22.04); however:
  Package python3 is not configured yet.
 python3-all depends on python3-distutils (>= 3.10.6-1~); however:
  Package python3-distutils is not configured yet.

dpkg: error processing package python3-all (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3
 systemd
  Package lsb-release is not configured yet.
 python3-distro depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
 hplip-data depends on python3-distro; however:
  Package python3-distro is not configured yet.
 hplip-data depends on python3:any; however:
  Package python3 is not configured yet.

  Package lsb-release is not configured yet.
 python3-distro depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of hplip-data:
 hplip-data depends on python3-distro; however:
  Package python3-distro is not configured yet.
 hplip-data depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package hplip-data (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-all:
 python3-all depends on python3 (= 3.10.6-1~22.04); however:
  Package python3 is not configured yet.
 python3-all depends on python3-distutils (>= 3.10.6-1~); however:
  Package python3-distutils is not configured yet.

dpkg: error processing package python3-all (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3
 systemd
 python3-wheel
 python3-dev
 python3-pip
 lsb-release
 python3-lib2to3
 python3-pkg-resources
 python3-distutils
 python3-setuptools
 python3-distro
 hplip-data
 python3-all
E: Sub-process /usr/bin/dpkg returned an error code (1)

的输出是相同的sudo apt --fix-broken install。前段时间,我更新了 /usr/bin 中的 python 符号链接,使其指向 python3.11 而不是 python3.10。它似乎可以正常工作,但也许这会导致这样的问题?从那时起,我尝试重新安装替换符号链接的两个版本。

以下是有问题的软件包dpkg -l

iF  python3                     3.10.6-1~22.04                          amd64        interactive high-level object-oriented language (default python3 ver>
iU  python3-all                 3.10.6-1~22.04                          amd64        package depending on all supported Python 3 runtime versions
iU  python3-dev                 3.10.6-1~22.04                          amd64        header files and a static library for Python (default)
iU  python3-distro              1.7.0-1                                 all          Linux OS platform information API
iU  python3-distutils           3.10.6-1~22.04                          all          distutils package for Python 3.x
iU  python3-lib2to3             3.10.6-1~22.04                          all          Interactive high-level object-oriented language (lib2to3)
ii  python3-minimal             3.10.6-1~22.04                          amd64        minimal subset of the Python language (default python3 version)
iU  python3-pip                 22.0.2+dfsg-1ubuntu0.3                  all          Python package installer
iU  python3-pkg-resources       59.6.0-1.2ubuntu0.22.04.1               all          Package Discovery and Resource Access using pkg_resources
iU  python3-setuptools          59.6.0-1.2ubuntu0.22.04.1               all          Python3 Distutils Enhancements
iU  python3-wheel               0.37.1-2ubuntu0.22.04.1                 all          built-package format for Python

此外,出于某种原因,systemd 也显示为“iF”。当我尝试sudo dpkg --configure python3

Setting up python3 (3.10.6-1~22.04) ...
running python rtupdate hooks for python3.10...
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 '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: error processing package python3 (--configure):
 installed python3 package post-installation script subprocess returned error exit status 4
Errors were encountered while processing:
 python3

的输出类似sudo dpkg --configure -a。我注意到“ibus-table”未安装,所以我尝试了它,结果出现了与第一个输出类似的错误。我相信这样做也会导致 systemd 在 dpkg 列表中显示为“iF”。

我也尝试过强制删除sudo dpkg --remove --force-depends python3并重新安装。一切都导致了类似的错误。我正在运行 22.04.2 版本。

编辑:我认为我可以通过删除/etc/resolv.conf然后运行来修复一些软件包sudo apt --fix-broken install。现在唯一有依赖性错误的软件包是 python3。

答案1

我相信我已经通过安装这些软件包解决了这个问题:

sudo apt install python3-uno system-config-printer-common system-config-printer

然后运行:

sudo apt --fix-broken install

我不确定这些是否或者为什么具体导致了这个问题,但至少目前它最终解决了这个问题。

相关内容