How do I remove the rescue kernel?

Hi,

How do I remove the rescue kernel on Rocky Linux 8.x and 9.x ? I’m currently setting up a multi-boot test environment, and the rescue entries keep getting in the way.

The question seems to have been answered here:

Unfortunately the answer is behind Red Hat’s paywall. On a side note, is there some way to access this kind of information without having to jump through burning loops ?

Cheers,

Niki

The rescue kernel is created by package dracut-config-rescue so omitting that package would prevent the entry (and its large initramfs) from returning.


Short-term, to just take the kernel out for now:

rm /boot/*rescue* /boot/loader/*rescue*
2 Likes

I think the means is buried in “man dracut.conf”. I just delete the rescue kernel and initramfs and then to keep it from being recreated I added this file in /etc/dracut.conf.d/
02-rescue.conf
with the contents:

dracut_rescue_image="no"

Then update the grub menu

grub2-mkconfig -o /boot/grub2/grub.cfg
2 Likes

A typo there. The BLS entries are in /boot/loader/entries/, not in /boot/loader/


The package provides only two files:

$ rpm -ql dracut-config-rescue
/usr/lib/dracut/dracut.conf.d/02-rescue.conf
/usr/lib/kernel/install.d/51-dracut-rescue.install

The first one has:

$ cat /usr/lib/dracut/dracut.conf.d/02-rescue.conf
dracut_rescue_image="yes"

and the only thing in /usr/lib/kernel/install.d/ that does use variable ‘dracut_rescue_image’ is the
/usr/lib/kernel/install.d/51-dracut-rescue.install


In other words, you override the /usr/lib/dracut/dracut.conf.d/02-rescue.conf in order to stop the /usr/lib/kernel/install.d/51-dracut-rescue.install from doing its job.

My alternative is to not install the dracut-config-rescue and therefore not have the /usr/lib/kernel/install.d/51-dracut-rescue.install to begin with. Less is more?

2 Likes

I implimented this solution so long ago I have forgotten how I came by it. But I now recall my first solution was to edit both those files the first as described earlier and the second by creating an empty 51-dracut-rescue.install in /etc/kernel/install.d/ which turned out to be unnecessary.

1 Like