无法运行 apt-get upgrade ,总是错误无法删除 linux-image-4.15.0-53-generic

无法运行 apt-get upgrade ,总是错误无法删除 linux-image-4.15.0-53-generic

谁能帮助我,谢谢。

root@awan:~# apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  linux-image-4.15.0-53-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 8327 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 61586 files and directories currently installed.)
Removing linux-image-4.15.0-53-generic (4.15.0-53.57) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-4.15.0-53-generic
/etc/kernel/postrm.d/x-grub-legacy-ec2:
Searching for GRUB installation directory ... found: /boot/grub
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
Cannot determine root device.  Assuming /dev/hda1
This error is probably caused by an invalid /etc/fstab
/usr/sbin/update-grub-legacy-ec2: line 85: awk: command not found
/usr/sbin/update-grub-legacy-ec2: line 375: awk: 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-53-generic (--remove):
 installed linux-image-4.15.0-53-generic package post-removal script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-53-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑

我尝试这个dpkg -l | egrep -v '^ii|rc'

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
+++-=====================================-========================================================-============-===============================================================================
iF  initramfs-tools                       0.130ubuntu3.8                                           all          generic modular initramfs generator (automation)
rH  linux-image-4.15.0-53-generic         4.15.0-53.57                                             amd64        Signed kernel image generic
ic  unattended-upgrades                   1.1ubuntu1.18.04.11                                      all          automatic installation of security upgrades

答案1

首次尝试sudo dpkg --configure initramfs-tools 该软件包尚未完全配置。没有运气?

sudo apt install --reinstall initramfs-tools

如果错误仍然存​​在,wget -c http://mirrors.kernel.org/ubuntu/pool/main/i/initramfs-tools/initramfs-tools_0.130ubuntu3.8_all.deb则使用 安装包dpkg -i initramfs-tools_0.130ubuntu3.8_all.deb。此包很重要,它会创建或更新 initrd(引导加载程序初始化 RAM 磁盘)

sudo dpkg -P linux-image-4.15.0-53-generic 

sudo apt -f install

相关内容