当我运行时update-grub
得到以下输出:
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.5.0-26-generic
Found initrd image: /boot/initrd.img-3.5.0-26-generic
Found linux image: /boot/vmlinuz-3.5.0-25-generic
Found initrd image: /boot/initrd.img-3.5.0-25-generic
Found linux image: /boot/vmlinuz-3.5.0-17-generic
Found initrd image: /boot/initrd.img-3.5.0-17-generic
Found memtest86+ image: /boot/memtest86+.bin
done
为什么列出了三张图片?
我读了 ”grub 显示两次相同的 Linux 映像“ 也没有解决我的问题。
我的 /etc/grub.d/ 的内容是:
$ ls -l
-rwxr-xr-x 1 root root 7541 okt 14 19:36 00_header
-rwxr-xr-x 1 root root 5488 okt 4 11:30 05_debian_theme
-rwxr-xr-x 1 root root 10891 okt 14 19:36 10_linux
-rwxr-xr-x 1 root root 10258 okt 14 19:36 20_linux_xen
-rwxr-xr-x 1 root root 1688 okt 11 16:10 20_memtest86+
-rwxr-xr-x 1 root root 10976 okt 14 19:36 30_os-prober
-rwxr-xr-x 1 root root 1426 okt 14 19:36 30_uefi-firmware
-rwxr-xr-x 1 root root 214 okt 14 19:36 40_custom
-rwxr-xr-x 1 root root 216 okt 14 19:36 41_custom
-rw-r--r-- 1 root root 483 okt 14 19:36 README
答案1
我通过谷歌搜索找到了这一点:
current=`uname -r` && uninstall="" && for version in `dpkg -l linux-image* | grep ii | awk '{ print $2}'`; do if [[ "$version" < "linux-image-$current" ]]; then uninstall=$uninstall" $version"; fi; done && sudo apt-get purge $uninstall -y && sudo update-grub2
它会删除旧内核并更新 grub。这解决了我的问题。