jan 26

Fix missing intramfs on RHEL7

I found an interesting problem. After yum update, the kernel install run out error. After the reboot i received kernel panic.

Solution:
1. Start the linux with the old kernel.

2. Create new initramfs with the following steps:

2.1 Create intirams:

dracut -f -v --kver <kernel> (example: 3.10.0-693.11.6.el7.x86_64)

2.2 Update grub2:

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

2.3 Check the grub2 config:

grep initrd /etc/grub2.cfg
 set tuned_initrd=""
 initrd16 /initramfs-3.10.0-693.11.6.el7.x86_64.img
 initrd16 /initramfs-3.10.0-514.6.1.el7.x86_64.img
 initrd16 /initramfs-3.10.0-514.el7.x86_64.img
 grep "menuentry " /boot/grub2/grub.cfg
 menuentry 'Red Hat Enterprise Linux Server (3.10.0-693.11.6.el7.x86_64) 7.4 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.11.6.el7.x86_64-advanced-dad5925c-4696-4338-bfd0-fa82090398b1' {
 menuentry 'Red Hat Enterprise Linux Server (3.10.0-514.6.1.el7.x86_64) 7.4 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.6.1.el7.x86_64-advanced-dad5925c-4696-4338-bfd0-fa82090398b1' {
 menuentry 'Red Hat Enterprise Linux Server (3.10.0-514.el7.x86_64) 7.4 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-514.el7.x86_64-advanced-dad5925c-4696-4338-bfd0-fa82090398b1' {

2.3. Set the default to your new kernel:

 awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
 0 : Red Hat Enterprise Linux Server (3.10.0-693.11.6.el7.x86_64) 7.4 (Maipo)
 1 : Red Hat Enterprise Linux Server (3.10.0-514.6.1.el7.x86_64) 7.4 (Maipo)
 2 : Red Hat Enterprise Linux Server (3.10.0-514.el7.x86_64) 7.4 (Maipo)
 grub2-set-default 0
 grub2-editenv list
 saved_entry=0

3.1 Reboot:

reboot or shutdown -r now

3.2 Check your kernel version:

uname -a

Vélemény, hozzászólás?