How do I re-run boot loader?

157,441

Solution 1

According to womble's answer to Damaged /vmlinuz and /initrd.img symbolic links after Kernel uninstall (on Server Fault), you don't have to do anything in this situation when your boot loader is GRUB/GRUB2—which it is, here.

For some other boot loaders (at least LILO), it is/was apparently sometimes necessary to manually run the boot loader's configuration.

If you did need to tell GRUB to check for existing kernels and update its configuration, running sudo update-grub would do so. And there's no harm in running that. But it shouldn't be necessary in this case.

Solution 2

The error is a bit odd in case of grub.

When apt installs a new kernel-version, it moves /vmlinuz and /initrd.img to /vmlinuz.old and /initrd.img.old (Which then are still pointing to the currently active kernel. Again, notice the .old extension, which is different from the story linked in "Damaged links after kernel uninstall") and creates two new files /vmlinuz /initrd.img.

When you run apt-get autoremove (the messages weren't generated by apt-get -f install) it removes that previously active kernel (you rebooted after that install, before running autoremove, right?), which makes the links invalid.

When the removal of the kernel itself done, the autoremove itself invokes update-grub:

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

Hence:

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

So, autoremove does:

  1. remove old kernel
  2. run update-grub
  3. update-grub removes .old files which linked to removed files.

Nothing to worry about :-)

Regards.

Solution 3

$ sudo update-grub

And if you want delete / purge old packages you can do also

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

Share:
157,441
TevinYoungz
Author by

TevinYoungz

The person who says it cannot be done should not interrupt the person doing it.

Updated on September 18, 2022

Comments

  • TevinYoungz
    TevinYoungz over 1 year

    Running sudo apt-get -f install said that The link /vmlinuz.old is a damaged link and:

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

    Here's the full output:

    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:~$
    

    How do I re-run the boot loader?

    • Mark Mikofski
      Mark Mikofski about 9 years
      I get the same issue when I use apt-get autoremove, but as the Eliah Kagan says in his answer grub seems to work fine on reboot.
  • TevinYoungz
    TevinYoungz over 9 years
    ok i ran them thou
  • Eliah Kagan
    Eliah Kagan over 9 years
    @TevinYoungz That's fine. sudo update-grub shouldn't do any harm.
  • Simon Richter
    Simon Richter over 9 years
    The word "sometimes" is an understatement.
  • weima
    weima almost 9 years
    In think that this pair of error and the resolution could receive a prize for the most stupid design mistakes: having a grub command that is named update-grub instead of grub-update which is logical and failing to specify the fix (command) that works in 99.99% of cases.
  • Evan Carroll
    Evan Carroll over 8 years
    What if you didn't reboot after the last dist-upgrade? Then what? I never reboot. That's for newbs.
  • simpleuser
    simpleuser about 8 years
    There is no way to get the new kernel into memory unless you reboot.
  • Harkály Gergő
    Harkály Gergő over 7 years
    If you have only 3.X images, you delete everything, am I right?
  • B. Shea
    B. Shea over 7 years
    Also wise to note if you have /vmlinuz && /initrd.img linked to kernel area (usually /boot) before you reboot. As answer notes - the ".old" files 'damaged link' is nothing to worry about. Voted ^
  • B. Shea
    B. Shea over 7 years
    Technically, your first command answers the question. No reason to add more about pkg maintenance.
  • reducing activity
    reducing activity almost 7 years
    @sorin I wonder whatever there is bug report for that somewhere.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 6 years
    +1 for one of those answers that make you say "phew!". Kernel 4.15 broke my boot so I rebooted with 4.10.0-42 and removed 4.15 then got the message: The link /vmlinuz is a damaged link which led me here. Sure enough update-grub came back clean after reading comments here.