我有一些损坏的包裹,更具体地说:
linux-image-4.4.0-101-generic
linux-image-extra-4.4.0-103-generic
linux-image-4.4.0-103-generic
linux-image-extra-4.4.0-104-generic
linux-image-4.4.0-104-generic
linux-image-extra-4.4.0-108-generic
linux-image-4.4.0-108-generic
linux-image-extra-4.4.0-109-generic
linux-image-4.4.0-109-generic
linux-image-extra-4.4.0-112-generic
linux-image-4.4.0-112-generic
linux-image-extra-4.4.0-116-generic
linux-image-4.4.0-116-generic
linux-image-extra-4.4.0-119-generic
linux-image-4.4.0-119-generic
linux-image-extra-4.4.0-127-generic
linux-image-4.4.0-127-generic
linux-image-extra-4.4.0-128-generic
linux-image-4.4.0-128-generic
linux-image-extra-4.4.0-130-generic
linux-image-4.4.0-130-generic
linux-image-extra-4.4.0-133-generic
linux-image-4.4.0-133-generic
linux-image-extra-4.4.0-134-generic
linux-image-4.4.0-134-generic
linux-image-extra-4.4.0-135-generic
linux-image-4.4.0-135-generic
linux-image-extra-4.4.0-139-generic
linux-image-4.4.0-139-generic
linux-image-extra-4.4.0-141-generic
linux-image-4.4.0-141-generic
linux-image-4.4.0-143-generic
当我尝试删除其中一个时,出现以下错误:
(Reading database ... 646975 files and directories currently installed.)
Removing linux-image-extra-4.4.0-101-generic (4.4.0-101.124) ...
depmod: FATAL: could not load /boot/System.map-4.4.0-101-generic: No such file or directory
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
run-parts: executing /etc/kernel/postinst.d/dkms 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-101-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.
depmod: WARNING: could not open /var/tmp/mkinitramfs_7UInLs/lib/modules/4.4.0-101-generic/modules.order: No such file or directory
depmod: WARNING: could not open /var/tmp/mkinitramfs_7UInLs/lib/modules/4.4.0-101-generic/modules.builtin: No such file or directory
run-parts: executing /etc/kernel/postinst.d/pm-utils 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-101-generic /boot/vmlinuz-4.4.0-101-generic
Searching for GRUB installation directory ... found: /boot/grub
/etc/default/grub: line 1: #: command not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-extra-4.4.0-101-generic (--remove):
subprocess installed post-removal script returned error exit status 1
Errors were encountered while processing:
linux-image-extra-4.4.0-101-generic
$ ls -al /boot
total 185785
drwxr-xr-x 5 root root 6144 Jul 11 13:39 .
drwxr-xr-x 24 root root 4096 May 20 11:39 ..
-rw-r--r-- 1 root root 1249237 Oct 10 2017 abi-4.4.0-98-generic
-rw-r--r-- 1 root root 190580 Mar 26 16:02 config-4.4.0-145-generic
-rw-r--r-- 1 root root 190862 May 7 16:38 config-4.4.0-148-generic
-rw-r--r-- 1 root root 190517 Oct 10 2017 config-4.4.0-98-generic
drwx------ 4 root root 4096 Jan 1 1970 efi
drwxr-xr-x 5 root root 1024 Nov 12 2017 grub
-rw-r--r-- 1 root root 14356810 Jul 11 13:39 initrd.img-4.4.0-101-generic
-rw-r--r-- 1 root root 44454972 May 20 11:40 initrd.img-4.4.0-145-generic
-rw-r--r-- 1 root root 44451845 May 20 11:40 initrd.img-4.4.0-148-generic
-rw-r--r-- 1 root root 43512380 Nov 28 2018 initrd.img-4.4.0-98-generic
drwx------ 2 root root 12288 Nov 4 2017 lost+found
-rw-r--r-- 1 root root 182704 Jan 28 2016 memtest86+.bin
-rw-r--r-- 1 root root 184380 Jan 28 2016 memtest86+.elf
-rw-r--r-- 1 root root 184840 Jan 28 2016 memtest86+_multiboot.bin
-rw------- 1 root root 3906115 Mar 26 16:02 System.map-4.4.0-145-generic
-rw------- 1 root root 3907764 May 7 16:38 System.map-4.4.0-148-generic
-rw------- 1 root root 3887471 Oct 10 2017 System.map-4.4.0-98-generic
-rw------- 1 root root 7188984 Mar 27 12:03 vmlinuz-4.4.0-145-generic
-rw------- 1 root root 7196216 May 14 21:09 vmlinuz-4.4.0-148-generic
-rw------- 1 root root 7103856 Oct 10 2017 vmlinuz-4.4.0-98-generic
-rw------- 1 root root 7105784 Nov 5 2017 vmlinuz-4.4.0-98-generic.efi.signed
$ uname -a
Linux Server 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
s$ lsb_release -r
Release: 16.04
答案1
以防每个人都想知道修复方法实际上非常简单,grub 文件在第一行有一个简单的错误,不知道是怎么出现的,但如果其他人遇到这个问题,希望这会有所帮助。