What does "regenerate your initramfs" mean?
From man update-initramfs
The update-initramfs script manages your initramfs images on your lo‐
cal box. It keeps track of the existing initramfs archives in /boot.
There are three modes of operation create, update or delete. You must
at least specify one of those modes.
The initramfs is a gzipped cpio archive. At boot time, the kernel un‐
packs that archive into RAM disk, mounts and uses it as initial root
file system. All finding of the root device happens in this early
userspace.
The man
commands shows you the reference manual page for the command or topic you provided. Other documentation tools exist too (info
etc)
If you don't know what commands you need to use, you can search using tools like apropos
, eg. if I wanted to know what commands related to initramfs I might use
guiverc@d960-ubu2:/de2900/lubuntu$ apropos initramfs
dh_installinitramfs (1) - install initramfs hooks and setup maintscripts
initramfs-tools (7) - an introduction to writing scripts for mkinitramfs
initramfs.conf (5) - configuration file for mkinitramfs
kernel-install (8) - Add and remove kernel and initramfs images to and from /boot
linux-update-symlinks (1) - maintain symlinks to default kernel and initramfs
lsinitramfs (8) - list content of an initramfs image
mkinitramfs (8) - low-level tool for generating an initramfs image
unmkinitramfs (8) - extract content from an initramfs image
update-initramfs (8) - generate an initramfs image
update-initramfs.conf (5) - configuration file for update-initramfs
To create/recreate/update the initramfs file means to update the initrd.img-*
ramdisk files in /boot.
Here's a listing of my /boot. Note the size/date of the initrd.img-*
files. One or more of these need updating in your case.
~$ ls -al /boot
total 162745
drwxr-xr-x 4 root root 4096 Jul 5 05:19 .
drwxr-xr-x 23 root root 4096 Jun 19 12:40 ..
-rw-r--r-- 1 root root 252994 May 7 05:38 config-5.11.0-18-generic
-rw-r--r-- 1 root root 253022 Jun 16 15:38 config-5.11.0-22-generic
drwxr-xr-x 3 root root 1024 Dec 31 1969 efi
drwxr-xr-x 5 root root 4096 Jun 30 12:09 grub
lrwxrwxrwx 1 root root 28 Jun 25 12:42 initrd.img -> initrd.img-5.11.0-22-generic
-rw-r--r-- 1 root root 62066094 Jul 5 05:19 initrd.img-5.11.0-18-generic
-rw-r--r-- 1 root root 62067859 Jul 5 05:18 initrd.img-5.11.0-22-generic
lrwxrwxrwx 1 root root 28 Jun 25 12:42 initrd.img.old -> initrd.img-5.11.0-18-generic
-rw-r--r-- 1 root root 182704 Aug 18 2020 memtest86+.bin
-rw-r--r-- 1 root root 184380 Aug 18 2020 memtest86+.elf
-rw-r--r-- 1 root root 184884 Aug 18 2020 memtest86+_multiboot.bin
-rw------- 1 root root 5968565 May 7 05:38 System.map-5.11.0-18-generic
-rw------- 1 root root 5969489 Jun 16 15:38 System.map-5.11.0-22-generic
lrwxrwxrwx 1 root root 25 Jun 25 12:42 vmlinuz -> vmlinuz-5.11.0-22-generic
-rw------- 1 root root 14737344 May 7 06:26 vmlinuz-5.11.0-18-generic
-rw------- 1 root root 14741312 Jun 16 15:55 vmlinuz-5.11.0-22-generic
lrwxrwxrwx 1 root root 25 Jun 25 12:42 vmlinuz.old -> vmlinuz-5.11.0-18-generic
Note: I prefer to create a totally fresh version by using the -c
option, instead of just updating the existing file by using the -u
option.
The proper command would be:
sudo update-initramfs -c -k $(uname -r)
This will create a fresh initrd.img-* file for your currently booted version of Ubuntu.
However, if you can't boot to the current version of Ubuntu, you may have to modify this command, and by booting to an older version of Ubuntu, you can do it this way:
sudo update-initramfs -c -k 5.11.0-22-generic
where the 5.11.0-22-generic part should be replaced with the version of the desired boot kernel.
To regenerate all of the initrd.img-* files (not recommended), use:
sudo update-initramfs -c -k all
To get more detailed information, type:
man update-initramfs