![16.04 无法运行 apt-get 任何内容,总是出现错误](https://linux22.com/image/889932/16.04%20%E6%97%A0%E6%B3%95%E8%BF%90%E8%A1%8C%20apt-get%20%E4%BB%BB%E4%BD%95%E5%86%85%E5%AE%B9%EF%BC%8C%E6%80%BB%E6%98%AF%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF.png)
我收到此错误:
$ apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
linux-image-extra-4.4.0-53-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 161 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 227614 files and directories currently installed.)
Removing linux-image-extra-4.4.0-53-generic (4.4.0-53.74) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-53-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-53-generic /boot/vmlinuz-4.4.0-53-generic
sort: /lib/x86_64-linux-gnu/libpthread.so.0: version `GLIBC_2.275' not found (required by sort)
sort: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.4' not found (required by sort)
sort: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.275' not found (required by sort)
run-parts: /etc/kernel/postinst.d/apt-auto-removal exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-53-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-53-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
当我尝试使用 dpkg 删除有问题的软件包时:
$ sudo dpkg --purge linux-image-extra-4.4.0-53-generic
(Reading database ... 227614 files and directories currently installed.)
Removing linux-image-extra-4.4.0-53-generic (4.4.0-53.74) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-53-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-53-generic /boot/vmlinuz-4.4.0-53-generic
sort: /lib/x86_64-linux-gnu/libpthread.so.0: version `GLIBC_2.275' not found (required by sort)
sort: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.4' not found (required by sort)
sort: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.275' not found (required by sort)
run-parts: /etc/kernel/postinst.d/apt-auto-removal exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-53-generic (--purge):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-53-generic
无法安装 libc(不确定为什么它不在那里)因为我无法运行apt-get
。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
$ apt-cache policy libc6 coreutils linux-image-extra-4.4.0-53-generic
libc6:
Installed: 2.23-0ubuntu5
Candidate: 2.23-0ubuntu5
Version table:
*** 2.23-0ubuntu5 500
500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
100 /var/lib/dpkg/status
2.23-0ubuntu3 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
coreutils:
Installed: 8.25-2ubuntu2
Candidate: 8.25-2ubuntu2
Version table:
*** 8.25-2ubuntu2 500
500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
100 /var/lib/dpkg/status
linux-image-extra-4.4.0-53-generic:
Installed: 4.4.0-53.74
Candidate: 4.4.0-53.74
Version table:
*** 4.4.0-53.74 500
500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages
100 /var/lib/dpkg/status
答案1
看起来软件包libc6
和/或coreutils
已损坏。要修复此问题,您需要重新安装它们,而无需 Apt 软件包操作的帮助。
libc6
将文件和包下载coreutils
到临时目录中(或者您想要保存它们直到安装结束的任何位置):cd /tmp apt-get download libc6 coreutils
安装它们:
sudo dpkg -i {libc6,coreutils}_*.deb
使用 Apt 修复剩余的打包问题:
sudo apt-get install -f