157

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?

1
  • 2
    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. Commented Apr 10, 2015 at 0:44

3 Answers 3

194

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.

4
  • 5
    The word "sometimes" is an understatement. Commented Sep 2, 2014 at 4:35
  • 9
    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.
    – sorin
    Commented Jul 7, 2015 at 13:22
  • @sorin I wonder whatever there is bug report for that somewhere. Commented May 24, 2017 at 9:02
  • +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. Commented Feb 3, 2018 at 0:50
31

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.

3
  • 2
    What if you didn't reboot after the last dist-upgrade? Then what? I never reboot. That's for newbs. Commented Dec 23, 2015 at 21:14
  • 3
    There is no way to get the new kernel into memory unless you reboot.
    – simpleuser
    Commented Mar 1, 2016 at 14:37
  • 1
    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
    Commented Dec 16, 2016 at 16:37
13

$ 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

2
  • If you have only 3.X images, you delete everything, am I right? Commented Sep 1, 2016 at 22:12
  • Technically, your first command answers the question. No reason to add more about pkg maintenance.
    – B. Shea
    Commented Dec 16, 2016 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .