apt-get 升級期間斷電破壞了 apt-get 指令

apt-get 升級期間斷電破壞了 apt-get 指令

我有一台運行 Ubuntu 18.04 LTS 的伺服器。今天早上我跑了一次apt upgrade,期間伺服器斷電了。恢復後,我登入並注意到有 2 個軟體包「未完全安裝或刪除」。我嘗試運行apt-get autoremove、顯式apt-get remove命令以及在網路上找到的許多解決方案,但我目前不記得了。

似乎沒有任何幫助,而且由於損壞的軟體包容易出錯,我無法升級/安裝軟體包。它們是核心包:

linux-image-4.15.0-50-generic
linux-image-4.15.0-51-generic

這是輸出apt-get autoremove

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  linux-image-4.15.0-50-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 8,323 kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 144087 files and directories currently installed.)
Removing linux-image-4.15.0-50-generic (4.15.0-50.54) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-50-generic
/etc/kernel/postrm.d/x-grub-legacy-ec2:
Searching for GRUB installation directory ... found: /boot/grub
/etc/default/grub: line 12: net.ifnames=0: command not found
run-parts: /etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 127
dpkg: error processing package linux-image-4.15.0-50-generic (--remove):
 installed linux-image-4.15.0-50-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-50-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

手動刪除檔案後運行一系列apt-get autoremove和命令似乎已經清除了它。apt-get autoclean.deb

相關內容