To remove the default rescue image that gets installed when you install a CentOS/RHEL 7 system. To list out the rescue image under /boot directory :

[root@ucartz ~]# ls -lrt /boot
total 135164
-rw-------. 1 root root  3113253 Oct 17  2018
-rw-r--r--. 1 root root   137696 Oct 17  2018 config-3.10.0-514.el7.x86_64
-rwxr-xr-x. 1 root root  5392080 Oct 17  2018 vmlinuz-3.10.0-514.el7.x86_64
-rw-r--r--. 1 root root   277953 Oct 17  2018 symvers-3.10.0-514.el7.x86_64.gz
drwxr-xr-x. 2 root root       27 Oct 14 19:50 grub
-rw-------. 1 root root 64487503 Oct 14 20:00 initramfs-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e.img
-rwxr-xr-x. 1 root root  5392080 Oct 14 20:00 vmlinuz-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e
-rw-r--r--. 1 root root 10209739 Oct 14 20:00 initrd-plymouth.img
-rw-------. 1 root root 30753143 Oct 14 20:02 initramfs-3.10.0-514.el7.x86_64.img
drwx------. 6 root root      111 Oct 14 20:02 grub2
-rw-------. 1 root root 18624164 Oct 14 22:10 initramfs-3.10.0-514.el7.x86_64kdump.img


You can not simply do arm on the rescue image in /boot directory. There are other entries such as in the menu entry in grub2 configuration file which needs to be removed as well. Follow the steps below to remove the default rescue image from the system.


Removing rescue image using grubby


1. Remove the rescue image from the /boot directory first.

rm -fr /boot/vmlinuz-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e


2. Locate the rescue menu entry in the GRUB2 configuration file /boot/grub2/grub.cfg which needs to be deleted.

# cat /boot/grub2/grub.cfg 
menuentry 'CentOS Linux (0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e) 7 (Core)' --class centos --class gnu-linux --class 
gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e-advanced-10bac86a-a9be-478c-b63f-46d3ca061e03' {
	insmod gzio
	insmod part_msdos
	insmod xfs
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  a52207e4-01fd-4f12-98b7-681d56f21dc5
	  search --no-floppy --fs-uuid --set=root a52207e4-01fd-4f12-98b7-681d56f21dc5
	linux16 /vmlinuz-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e root=/dev/mapper/cl-root ro crashkernel=auto rhgb quiet
	initrd16 /initramfs-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e.img


3. Remove the rescue image using the grubby command with –remove-kernel option.

# grubby --remove-kernel=/boot/vmlinuz-0-rescue-9cdb9ab3246a4b3f9c0849ecd597f25e


4. Verify that the rescue image menu entry is now removed from the grub2 configuration file.

# cat /boot/grub2/grub.cfg | grep rescue


Var dette svaret til hjelp? 0 brukere syntes dette svaret var til hjelp (0 Stemmer)