卡在损坏的apt-get中,无法更新我的VPS或进行任何安装

盘古霉素

由于我通常能够在google的帮助下解决我的问题,因此第一次在这里发布,但是这一次我觉得我有点不高兴。

我有一个在DigitalOcean上运行的VPS,用于个人项目。我很早以前就安装了它,我认为它甚至可能是DO预先为我安装的。它正在运行Ubuntu 14.04,因此我决定是时候对其进行升级了-大错误。

sudo apt-get update && sudo apt-get upgrade在运行之前运行了一些临时更新sudo do-release-upgrade

这些问题之一开始出现-似乎apt-get remove无法删除旧的内核版本?但是我可能完全误读了这些信息,因为可悲的是,我对Linux更新并不那么精通。

我将尝试列出我已阅读的所有命令输出,这可能会有用。任何有关如何摆脱这种混乱的技巧都将受到赞赏。

df -hT 输出:

root@web:~# df -hT

Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  487M  4.0K  487M   1% /dev
tmpfs          tmpfs     100M  344K  100M   1% /run
/dev/vda1      ext4       20G  4.7G   14G  25% /
none           tmpfs     4.0K     0  4.0K   0% /sys/fs/cgroup
none           tmpfs     5.0M     0  5.0M   0% /run/lock
none           tmpfs     497M     0  497M   0% /run/shm
none           tmpfs     100M     0  100M   0% /run/user

看来我对服务器上的空间还好

sudo apt-get autoremovesudo apt-get remove --purge --auto-remove输出:

root@web:~# sudo apt-get autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-image-3.13.0-79-generic : Depends: initramfs-tools (>= 0.36ubuntu6) but it is not installed
                                 Recommends: grub-pc or
                                             grub-efi-amd64 or
                                             grub-efi-ia32 or
                                             grub but it is not installed or
                                             lilo (>= 19.1) but it is not installed
 linux-image-3.13.0-83-generic : Depends: initramfs-tools (>= 0.36ubuntu6) but it is not installed
                                 Recommends: grub-pc or
                                             grub-efi-amd64 or
                                             grub-efi-ia32 or
                                             grub but it is not installed or
                                             lilo (>= 19.1) but it is not installed
E: Unmet dependencies. Try using -f.

使用修复标志自动删除:

root@web:~# sudo apt-get -f autoremove
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  bash-completion cloud-guest-utils coreutils dpkg ifupdown
  init-system-helpers initramfs-tools initramfs-tools-bin initramfs-tools-core
  initscripts klibc-utils libalgorithm-diff-xs-perl libapparmor-perl libblkid1
  libdbd-mysql-perl libdbi-perl libfdisk1 libfile-fcntllock-perl libgcrypt20
  libgpg-error0 libklibc liblocale-gettext-perl libmount1 libmysqlclient20
  libncurses5 libncursesw5 libperl5.22 libselinux1 libsmartcols1
  libsub-name-perl libsystemd0 libtext-charwidth-perl libtext-iconv-perl
  libtinfo5 libudev1 lsb-base perl perl-base perl-modules-5.22 rename
  sysvinit-utils udev util-linux
Suggested packages:
  rdnssd libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
  rng-tools perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl
  bootlogd sash kbd console-tools util-linux-locales
The following packages will be REMOVED:
  libterm-readkey-perl libtext-soundex-perl linux-headers-3.13.0-79
  linux-headers-3.13.0-79-generic linux-image-3.13.0-79-generic
  linux-image-extra-3.13.0-79-generic mysql-client-5.5 perl-modules
The following NEW packages will be installed:
  initramfs-tools initramfs-tools-core libfdisk1 libgcrypt20 libmysqlclient20
  libperl5.22 libsmartcols1 libsystemd0 perl-modules-5.22 rename udev
The following packages will be upgraded:
  bash-completion cloud-guest-utils coreutils dpkg ifupdown
  init-system-helpers initramfs-tools-bin initscripts klibc-utils
  libalgorithm-diff-xs-perl libapparmor-perl libblkid1 libdbd-mysql-perl
  libdbi-perl libfile-fcntllock-perl libgpg-error0 libklibc
  liblocale-gettext-perl libmount1 libncurses5 libncursesw5 libselinux1
  libsub-name-perl libtext-charwidth-perl libtext-iconv-perl libtinfo5
  libudev1 lsb-base perl perl-base sysvinit-utils util-linux
32 upgraded, 11 newly installed, 8 to remove and 277 not upgraded.
4 not fully installed or removed.
Need to get 0 B/16.2 MB of archives.
After this operation, 279 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Extracting templates from packages: 100%
(Reading database ... 143659 files and directories currently installed.)
Removing linux-image-extra-3.13.0-79-generic (3.13.0-79.123) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-79-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-79-generic /boot/vmlinuz-3.13.0-79-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-79-generic /boot/vmlinuz-3.13.0-79-generic
/etc/kernel/postinst.d/initramfs-tools: 33: /etc/kernel/postinst.d/initramfs-tools: update-initramfs: not found
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 127
dpkg: error processing package linux-image-extra-3.13.0-79-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.13.0-79-generic (3.13.0-79.123) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-79-generic /boot/vmlinuz-3.13.0-79-generic
/etc/kernel/postrm.d/initramfs-tools: 33: /etc/kernel/postrm.d/initramfs-tools: update-initramfs: not found
run-parts: /etc/kernel/postrm.d/initramfs-tools exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.13.0-79-generic.postrm line 328.
dpkg: error processing package linux-image-3.13.0-79-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-79-generic
 linux-image-3.13.0-79-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get -f install 输出:

root@web:~# sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  bash-completion cloud-guest-utils coreutils dpkg ifupdown
  init-system-helpers initramfs-tools initramfs-tools-bin initramfs-tools-core
  initscripts klibc-utils libalgorithm-diff-xs-perl libapparmor-perl libblkid1
  libdbd-mysql-perl libdbi-perl libfdisk1 libfile-fcntllock-perl libgcrypt20
  libgpg-error0 libklibc liblocale-gettext-perl libmount1 libmysqlclient20
  libncurses5 libncursesw5 libperl5.22 libselinux1 libsmartcols1
  libsub-name-perl libsystemd0 libtext-charwidth-perl libtext-iconv-perl
  libtinfo5 libudev1 lsb-base perl perl-base perl-modules-5.22 rename
  sysvinit-utils udev util-linux
Suggested packages:
  rdnssd libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl
  rng-tools perl-doc libterm-readline-gnu-perl libterm-readline-perl-perl
  bootlogd sash kbd console-tools util-linux-locales
The following packages will be REMOVED:
  libterm-readkey-perl libtext-soundex-perl linux-image-3.13.0-79-generic
  linux-image-extra-3.13.0-79-generic mysql-client-5.5 perl-modules
The following NEW packages will be installed:
  initramfs-tools initramfs-tools-core libfdisk1 libgcrypt20 libmysqlclient20
  libperl5.22 libsmartcols1 libsystemd0 perl-modules-5.22 rename udev
The following packages will be upgraded:
  bash-completion cloud-guest-utils coreutils dpkg ifupdown
  init-system-helpers initramfs-tools-bin initscripts klibc-utils
  libalgorithm-diff-xs-perl libapparmor-perl libblkid1 libdbd-mysql-perl
  libdbi-perl libfile-fcntllock-perl libgpg-error0 libklibc
  liblocale-gettext-perl libmount1 libncurses5 libncursesw5 libselinux1
  libsub-name-perl libtext-charwidth-perl libtext-iconv-perl libtinfo5
  libudev1 lsb-base perl perl-base sysvinit-utils util-linux
32 upgraded, 11 newly installed, 6 to remove and 277 not upgraded.
4 not fully installed or removed.
Need to get 0 B/16.2 MB of archives.
After this operation, 202 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Extracting templates from packages: 100%
(Reading database ... 143659 files and directories currently installed.)
Removing linux-image-extra-3.13.0-79-generic (3.13.0-79.123) ...
depmod: FATAL: could not load /boot/System.map-3.13.0-79-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.13.0-79-generic /boot/vmlinuz-3.13.0-79-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.13.0-79-generic /boot/vmlinuz-3.13.0-79-generic
/etc/kernel/postinst.d/initramfs-tools: 33: /etc/kernel/postinst.d/initramfs-tools: update-initramfs: not found
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 127
dpkg: error processing package linux-image-extra-3.13.0-79-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-3.13.0-79-generic (3.13.0-79.123) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-79-generic /boot/vmlinuz-3.13.0-79-generic
/etc/kernel/postrm.d/initramfs-tools: 33: /etc/kernel/postrm.d/initramfs-tools: update-initramfs: not found
run-parts: /etc/kernel/postrm.d/initramfs-tools exited with return code 127
Failed to process /etc/kernel/postrm.d at /var/lib/dpkg/info/linux-image-3.13.0-79-generic.postrm line 328.
dpkg: error processing package linux-image-3.13.0-79-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
 linux-image-extra-3.13.0-79-generic
 linux-image-3.13.0-79-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

ls -l /boot 输出:

root@web:~# ls -l /boot
total 70752
-rw-r--r-- 1 root root  1165578 Mar 10  2016 abi-3.13.0-83-generic
-rw-r--r-- 1 root root   166221 May  9  2019 config-3.13.0-170-generic
-rw-r--r-- 1 root root   165918 Mar 10  2016 config-3.13.0-83-generic
-rw-r--r-- 1 root root   191071 Nov 13 22:00 config-4.4.0-170-generic
drwxr-xr-x 5 root root     4096 Dec 29 08:09 grub
-rw-r--r-- 1 root root 20352301 Dec 29 08:05 initrd.img-3.13.0-170-generic
-rw-r--r-- 1 root root 20176312 Dec 29 08:05 initrd.img-3.13.0-79-generic
-rw-r--r-- 1 root root   176500 Mar 12  2014 memtest86+.bin
-rw-r--r-- 1 root root   178176 Mar 12  2014 memtest86+.elf
-rw-r--r-- 1 root root   178680 Mar 12  2014 memtest86+_multiboot.bin
-rw------- 1 root root  3418683 May  9  2019 System.map-3.13.0-170-generic
-rw------- 1 root root  3393725 Mar 10  2016 System.map-3.13.0-83-generic
-rw------- 1 root root  3913902 Nov 13 22:00 System.map-4.4.0-170-generic
-rw------- 1 root root  5909496 May 14  2019 vmlinuz-3.13.0-170-generic
-rw------- 1 root root  5827776 Mar 10  2016 vmlinuz-3.13.0-83-generic
-rw------- 1 root root  7208856 Nov 14 10:33 vmlinuz-4.4.0-170-generic

uname -a 输出:

root@web:~# uname -a
Linux web 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

dpkg -l | grep linux-image 输出:

root@web:~# dpkg -l | grep linux-image
ii  linux-image-3.13.0-170-generic          3.13.0-170.220                                  amd64        Signed kernel image generic
rc  linux-image-3.13.0-77-generic           3.13.0-77.121                                   amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rH  linux-image-3.13.0-79-generic           3.13.0-79.123                                   amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
iU  linux-image-3.13.0-83-generic           3.13.0-83.127                                   amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-170-generic           4.4.0-170.199                                   amd64        Signed kernel image generic
rc  linux-image-extra-3.13.0-77-generic     3.13.0-77.121                                   amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
rH  linux-image-extra-3.13.0-79-generic     3.13.0-79.123                                   amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
ii  linux-image-generic                     4.4.0.170.178                                   amd64        Generic Linux kernel image

dpkg -l | egrep -v '^ii|rc' 输出:

root@web:~# dpkg -l | egrep -v '^ii|rc'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
+++-=======================================-===============================================-============-===============================================================================
rH  linux-image-3.13.0-79-generic           3.13.0-79.123                                   amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
rH  linux-image-3.13.0-83-generic           3.13.0-83.127                                   amd64        Linux kernel image for version 3.13.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-170-generic           4.4.0-170.199                                   amd64        Signed kernel image generic
rH  linux-image-extra-3.13.0-79-generic     3.13.0-79.123                                   amd64        Linux kernel extra modules for version 3.13.0 on 64 bit x86 SMP
没有人

并没有我预期的那么糟。好吧,让我们尝试修复它。

首先,确实要从您的重要数据进行备份。

确保您有足够的空间和inode可用。

df -h;df -i

下一步是重新安装initramfs-tools。找不到命令update-initramfs,这是必需的。

sudo apt install --reinstall initramfs-tools=0.122ubuntu8.16

根据软件包搜索,这是xenial版本,位于xenial-updates中。

如果不可能的话。直接用wget绘制包装

wget -c http://mirrors.kernel.org/ubuntu/pool/main/i/initramfs-tools/initramfs-tools_0.122ubuntu8.16_all.deb

并使用dpkg安装它。

 sudo dpkg -i initramfs-tools_0.122ubuntu8.16_all.deb

仅当此程序运行无误时。

sudo dpkg --configure -a && sudo apt-get -f install

检查与

dpkg -l | egrep -v '^ii|rc'

如果所有程序包都处于干净状态。应该像我的

Desired=Unknown/Install/Remove/Purge/Hold                                                                                                                    
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend                                                                               
+++-=============================================-========================================-============-===============================================================================                                                                                                                                   

然后就可以准备升级了。

sudo apt-get update && sudo apt-get dist-upgrade

如果有任何连线,请告诉我们。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

apt-get 更新卡在我的 K8s 中,无法安装任何工具进行调试

apt更新卡在Debian上

如何修复apt-get?我无法安装或更新任何东西

sudo apt-get更新卡在0%[工作中]

我的网站卡在预加载器循环中(CSS 损坏)

无法使用apt-get和VirtualBox进行安装或更新

Ubuntu 16.04损坏的内核程序包不允许我使用apt-get安装或删除任何内容

Ubuntu 18.04.2 LTS 损坏的 Apt 安装 LibreOffice 挂起更新

Firefox运行apt安装后卡在版本58上

apt 升级卡在安装/升级 open-vm-tools 上

Nautilus在Linux中损坏了,我无法通过`apt-get'来修复它

apache安装错误后,apt-get状态损坏

apt-get更新,带有https源损坏

为什么我无法进行“ sudo apt-get更新”?

无法通过更新管理器/ apt-get升级安装任何更新

当“ apt-get更新”卡在100%中时该怎么办?

14.04上的内核损坏-无法运行任何apt-get,dpkg

无法修复损坏的软件包(apt-get -f安装不起作用)

每当我们安装任何东西时,是否都必须使用“ sudo apt-get update”命令每次进行更新吗?

无法进行apt-get升级:如何替换损坏的systemd .conf文件?

尝试升级后单声道损坏,无法使用apt

卡在相同的更新上;apt-get更新似乎没有帮助

解决损坏的apt-get软件包下载

apt-get升级后Debian dpkg损坏

Apt-get更新卡在0%[archive.ubuntu.com] Ubuntu版本18.04

即使使用apt-get install -f也会损坏apt-get问题

apt-get卡在试图删除不可移动的程序包的过程中

apt-get升级卡在同一软件包中

使用任何实用程序,apt-get,synaptic等进行的任何安装过程中的一堆错误