How do I disable the creation of the rescue boot image on CentOS?
Solution 1
Open the file /usr/lib/dracut/dracut.conf.d/02-rescue.conf
and change
dracut_rescue_image="yes"
to
dracut_rescue_image="no"
This seems to be the only way for CentOS 7.
Solution 2
Remove dracut-config-rescue package:
# yum remove dracut-config-rescue
Solution 3
To answer my own question;
The rescue image is automatically generated by dracut after a new kernel is installed, and this can be prevented by creating a file under /etc/dracut.conf.d/, containing:
dracut_rescue_image="no"
(The file must have a '.conf' extension)
Related videos on Youtube
hnsr
Updated on September 18, 2022Comments
-
hnsr over 1 year
To make a long story short, my (CentOS 7) server's /boot is too small (100MiB) to hold 2 kernels plus the automatically generated rescue image. I want to avoid the hassle of repartitioning and reinstalling my server by preventing the rescue image from being generated. This would leave enough space for at least 2 kernels, and I can still use my hoster's netboot rescue solution should it be needed.
(I know the only 'right' way to deal with this is to fix my partition scheme, but considering the downtime involved with that I wanted to try a more pragmatic solution first)
-
hnsr over 9 yearsAnd, to expand on my answer, even with an alternative 'rescue' solution, it may be unwise to disable this, as the rescue kernel/initramfs are more than just for fixing a broken system. Newer RHEL/CentOS/Fedora releases only include the kernel modules for the hardware of the currently running system for newly installed kernels, and the 'rescue' kernel can then be used to update these if hardware is added or changed.
-
MichaelLi almost 9 yearsI did it as above and still appearing the rescue boot option, do you know anything else on this?
-
nturner over 6 yearsThis should be the accepted answer, as it is the correct solution.
-
nturner over 6 yearsSee @Tomek's answer below for a simpler, more correct solution.