Ubuntu 22 软件包管理出现问题

Ubuntu 22 软件包管理出现问题

包管理似乎陷入了混乱。apt upgrade 给我:

Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 libpython3-stdlib : Depends: libpython3.10-stdlib (>= 3.10.6-1~) but it is not installed
 python3.10 : Depends: libpython3.10-stdlib (= 3.10.11-1+focal1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

但如果我运行 apt --fix-broken install:

Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED
  libpython3-stdlib python3 python3-apt python3-pkg-resources python3-yaml python3.10 ubuntu-advantage-tools
0 to upgrade, 0 to newly install, 7 to remove and 1 not to upgrade.
After this operation, 3,546 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 271677 files and directories currently installed.)
Removing ubuntu-advantage-tools (27.14.4~22.04) ...
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/usr/lib/python3/dist-packages/uaclient/apt.py", line 14, in <module>
    import apt  # type: ignore
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 26, in <module>
    from apt.package import Package as Package, Version as Version
  File "/usr/lib/python3/dist-packages/apt/package.py", line 32, in <module>
    from http.client import BadStatusLine
ModuleNotFoundError: No module named 'http'
dpkg: error processing package ubuntu-advantage-tools (--remove):
 installed ubuntu-advantage-tools package pre-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 ubuntu-advantage-tools
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

我猜 python 已经完全崩溃了,但是当 apt 也崩溃时我不知道如何开始修复它。sudo apt clean 没有帮助,但我已经远远超出了这一点......

非常感谢您的任何建议!

相关内容