What exactly do a "dracut --regenerate-all --force"?

Hi to you all,

As the title suggests, what exactly do a “dracut --regenerate-all --force” ? I’m running the command out of curiosity and it seems to be looking after every /lib/modules/* where I have VERY old kernel leftover files (from fedora <19 to fedora 36 ^^´). Also, any idea how I can clean this out please ^^ ?

1 Like

Theoretically a kernel update should be removing the /lib/modules/<kernel version> trees for the older kernel that is being removed. If you have a lot of those old directories without having the kernels still installed then it would free up some space to remove the ones that do not match the currently installed kernels.

man dracut shows

       --regenerate-all
           Regenerate all initramfs images at the default location with the kernel versions found on the system. Additional
           parameters are passed through.


       -f, --force
           Overwrite existing initramfs file.

To see what directories are under /lib/modules simply run ls /lib/modules. If the system is up to date you should only see one entry for each of the currently installed kernels.

To remove the unnecessary /lib/modules/NNNN directories simply use
sudo rm -rf /lib/modules/NNNN. Replace the NNNN with the actual names shown by the ls command and making sure to only remove the ones that do not match the currently installed kernels. Do not make a typo in this type of command. Disaster awaits with a simple error.

4 Likes

This answered my question, and more. Thank you Jeff V.
After the dracut, I’ve found some img regenerated in /boot (each around 30 Mo with old kernel versions).
Cleaning Operation in progress !

1 Like