如何重新运行启动加载程序?

运行sudo apt-get -f installThe link /vmlinuz.old is a damaged link并且:

 you may need to re-run your boot loader[grub] 

这是完整的输出:

 user@chrubuntu:~$ sudo apt-get -f install Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic linux-image-3.13.0-32-generic linux-image-extra-3.13.0-32-generic Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. user@chrubuntu:~$ sudo apt-get autoremove Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: linux-headers-3.13.0-32 linux-headers-3.13.0-32-generic linux-image-3.13.0-32-generic linux-image-extra-3.13.0-32-generic 0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded. After this operation, 270 MB disk space will be freed. Do you want to continue? [Y/n] y perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: LANGUAGE = "en en", LC_ALL = (unset), LC_TIME = "en", LC_MONETARY = "en", LC_ADDRESS = "en", LC_TELEPHONE = "en", LC_NAME = "en", LC_MEASUREMENT = "en", LC_IDENTIFICATION = "en", LC_NUMERIC = "en", LC_PAPER = "en", LANG = (unset) are supported and installed on your system. perl: warning: Falling back to the standard locale ("C"). locale: Cannot set LC_ALL to default locale: No such file or directory (Reading database ... 232120 files and directories currently installed.) Removing linux-headers-3.13.0-32-generic (3.13.0-32.57) ... Removing linux-headers-3.13.0-32 (3.13.0-32.57) ... Removing linux-image-extra-3.13.0-32-generic (3.13.0-32.57) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic update-initramfs: Deleting /boot/initrd.img-3.13.0-32-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic The link /initrd.img.old is a damaged link Removing symbolic link initrd.img.old you may need to re-run your boot loader[grub] Removing linux-image-3.13.0-32-generic (3.13.0-32.57) ... Examining /etc/kernel/postrm.d . run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic update-initramfs: Deleting /boot/initrd.img-3.13.0-32-generic run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic The link /vmlinuz.old is a damaged link Removing symbolic link vmlinuz.old you may need to re-run your boot loader[grub] user@chrubuntu:~$ 

如何重新运行引导加载程序?

根据womble 在内核卸载后对Damaged / vmlinuz和/initrd.img符号链接 的回答 (在服务器故障上 ),当你的引导加载程序是GRUB / GRUB2时,你不必在这种情况下做任何事情 – 就在这里。

对于其他一些引导加载程序(至少是LILO ),显然有时需要手动运行引导加载程序的配置。

如果你确实需要告诉GRUB检查现有内核并更新其配置,那么运行sudo update-grub会这样做。 运行它没有害处。 但在这种情况下,它不应该是必要的。

在grub的情况下,错误有点奇怪。

当apt安装一个新的内核版本时,它将/ vmlinuz和/initrd.img移​​动到/vmlinuz.old和/initrd.img.old(然后它仍然指向当前活动的内核。再次注意.old扩展名,这与“内核卸载后损坏的链接”中链接的故事不同,并创建了两个新文件/ vmlinuz /initrd.img。

当您运行apt-get autoremove (消息不是由apt-get -f install生成)时,它会删除以前活动的内核(在安装之后重新启动,在运行autoremove之前,对吗?),这会使链接无效。

当内核本身被删除时,autoremove本身会调用update-grub:

 run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.13.0-32-generic /boot/vmlinuz-3.13.0-32-generic 

因此:

 The link /vmlinuz.old is a damaged link Removing symbolic link vmlinuz.old you may need to re-run your boot loader[grub] 

所以,autoremove做:

  1. 删除旧内核
  2. 运行update-grub
  3. update-grub删除链接到已删除文件的.old文件。

没什么好担心的 :-)

问候。

$ sudo update-grub

如果你想删除/清除旧包,你也可以

$ dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge