我在 ubuntu LTS 20.04 上安装任何东西都遇到问题

我在 ubuntu LTS 20.04 上安装任何东西都遇到问题

我正在尝试安装新的包apt-get install但是遇到了数千个 dpkg 错误。

dpkg: warning: files list file for package 'fonts-tlwg-kinnari' missing; assuming     package has no files currently installed
dpkg: warning: files list file for package 'fonts-smc-raghumalayalamsans' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'sosreport-oem' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgles2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'humanity-icon-theme' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libexpat1-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libass9:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-louis' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'pinentry-gnome3' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'apt-config-icons-hidpi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpwquality1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libfaudio0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libfaudio0:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'oem-somerville-meta' missing; assuming package has no files currently installed

我猜我拥有的每个软件包都有这个列表。在所有警告之后,会记录以下内容:

(Reading database ... 49236 files and directories currently installed.)
Preparing to unpack .../0-aptitude-common_0.8.12-1ubuntu4_all.deb ...
Unpacking aptitude-common (0.8.12-1ubuntu4) ...
Selecting previously unselected package libcwidget4:amd64.
Preparing to unpack .../1-libcwidget4_0.5.18-5build1_amd64.deb ...
Unpacking libcwidget4:amd64 (0.5.18-5build1) ...
Selecting previously unselected package libxapian30:amd64.
Preparing to unpack .../2-libxapian30_1.4.14-2_amd64.deb ...
Unpacking libxapian30:amd64 (1.4.14-2) ...
Selecting previously unselected package aptitude.
Preparing to unpack .../3-aptitude_0.8.12-1ubuntu4_amd64.deb ...
Unpacking aptitude (0.8.12-1ubuntu4) ...
Selecting previously unselected package libsub-name-perl.
Preparing to unpack .../4-libsub-name-perl_0.26-1_amd64.deb ...
Unpacking libsub-name-perl (0.26-1) ...
Selecting previously unselected package libclass-accessor-perl.
Preparing to unpack .../5-libclass-accessor-perl_0.51-1_all.deb ...
Unpacking libclass-accessor-perl (0.51-1) ...
Selecting previously unselected package libio-string-perl.
Preparing to unpack .../6-libio-string-perl_1.08-3_all.deb ...
Unpacking libio-string-perl (1.08-3) ...
Selecting previously unselected package libparse-debianchangelog-perl.
Preparing to unpack .../7-libparse-debianchangelog-perl_1.2.0-13_all.deb ...
Unpacking libparse-debianchangelog-perl (1.2.0-13) ...
Setting up libxapian30:amd64 (1.4.14-2) ...
Setting up php8.2-common (8.2.10-1+ubuntu20.04.1+deb.sury.org+2) ...
dpkg: error processing package php8.2-common (--configure):
 installed php8.2-common package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of php8.2-mysql:
 php8.2-mysql depends on php8.2-common (= 8.2.10-1+ubuntu20.04.1+deb.sury.org+2); however:
  Package php8.2-common is not configured yet.

...

这里有数百行相同的未配置软件包

...

dpkg: error processing package php8.2-mysql (--configure):
 dependency problems - leaving unconfigured
Setting up php7.4-common (1:7.4.33-8+ubuntu20.04.1+deb.sury.org+1) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: error processing package php7.4-common (--configure):
 installed php7.4-common package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of php8.2-bz2:
 php8.2-bz2 depends on php8.2-common (= 8.2.10-1+ubuntu20.04.1+deb.sury.org+2); however:
  Package php8.2-common is not configured yet.

dpkg: error processing package postgresql (--configure):
 dependency problems - leaving unconfigured
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.9) ...
Errors were encountered while processing:
 php8.2-common
 php8.2-mysql
 php7.4-common
 php8.2-bz2
 php7.4-curl
 php7.4-fpm
 php7.4-bcmath
 php8.2-zip
 php8.2-opcache
 php8.2-readline
 php8.2-mbstring
 php7.4-readline
 php7.4-mbstring
 ufw
 php7.4-bz2
 php7.4-cli
 php8.2-phpdbg
 php8.2-curl
 php7.4
 php7.4-zip
 php8.2-xml
 php8.2
 postgresql-common
 libapache2-mod-php8.2
 php7.4-opcache
 php8.2-gd
 php8.2-cli
 postgresql-15
 php7.4-gd
 libapache2-mod-php7.4
 php7.4-json
 postgresql-contrib
 postgresql
E: Sub-process /usr/bin/dpkg returned an error code (1)

如果我只运行 apt-get update,就会出现此错误:

Hit:22 https://storage.googleapis.com/download.dartlang.org/linux/debian stable Release
Fetched 23.1 kB in 4s (6,442 B/s)
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 12, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

我发现了一些类似的问题,已通过以下方式修复:

sudo apt install --reinstall python3-apt

或者使用以下命令:

dpkg --configure -a
apt-get -f install
apt-get clean
apt-get autoclean
apt-get autoremove

并尝试使用以下命令重新安装所有软件包:

dpkg --get-selections > selections
sudo dpkg --clear-selections
sudo dpkg --set-selections < selections
sudo apt-get --reinstall dselect-upgrade

但一切都只是因 dpkg 包丢失而出现同样的错误。

自动清理

相关内容