当前位置: 首页>>技术问答>>正文


我如何re-run启动加载程序?

, , , , ,

问题描述

运行sudo apt-get -f install表示The 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:~$

我如何将re-run引导加载程序?

最佳解决方案

根据womble’s answerDamaged /vmlinuz and /initrd.img symbolic links after Kernel uninstall(在Server Fault上),当您的引导加载程序是GRUB /GRUB2时,在这种情况下您不必做任何事情,在这里它是。

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

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

次佳解决方案

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

当安装一个新的kernel-version时,它将/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

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/357.html,未经允许,请勿转载。