18

I needed to regenerate initrd. Doing this:

update-initramfs -u -k all

threw up errors for a kernel I compiled and then deleted some time ago (because update-initramfs could not find the /lib/modules directory I had deleted of course).

I thought I had completely removed the kernel by deleting all its entries in /boot and directory in /lib/modules & running sudo update-grub (as in this answer), but apparently there are traces of it somewhere that I should probably clean up.

I read this and dug around in /usr/share/initramfs-tools but I couldn't figure it out.

In man update-initramfs I see that:

The use of "all" for the version string specifies update-initramfs to execute the chosen action for all kernel versions, that are already known to update-initramfs.

But how does it know them? Where does update-initramfs look for kernel versions?

Note: many months later... I added the answer to this question to the tag wiki for

Zanna
  • 69,223
  • 56
  • 216
  • 327

1 Answers1

20

I had the same problem as you, I also thought I had completely removed the kernel by deleting all its entries in /boot and directory in /lib/modules & updating GRUB, but I found the one directory that is used by update-initramfs to keep track of the kernels:

/var/lib/initramfs-tools
Zanna
  • 69,223
  • 56
  • 216
  • 327
thom
  • 7,372
  • 3
  • 24
  • 26
  • 2
    `update-initramfs -d -k ` will remove the entry in `/var/lib/initramfs-tools` and the image in `/boot` in one go, just fyi:) – Mohamed Hafez May 30 '19 at 01:06