############################################### Redhat and Centos kernel panic after yum update ############################################### :Author: Dimitry Dukhovny .. contents:: When the kernel panic hits ========================== After a yum update that includes the kernel or glibc, sometimes the post-installation grub steps do not complete. However you access your machine when that happens, this script can fix the problem. Thank your chosen deity that systemd solved all our problems. The unfoxtrot.sh script ======================= .. code-block:: bash :linenos: #!/bin/bash export PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin export MYNAME=`basename ${0}` ischroot() { if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ] then echo 1 else echo 0 fi } /bin/ls /boot/vmlinuz-* /mnt/sysimage/vmlinuz-* 2> /dev/null echo Above are versions of the kernel you have in the usual places. [ `/usr/bin/id -u` -ne 0 ] && echo You are not root. I will not obey. \ && exit 255 [ `ischroot` -ne 1 ] && echo You are not chrooted. Try: \ && echo " chroot /mnt/sysimage" && echo " ${MYNAME}" && exit 255 \ || echo "You are chrooted, hopefully correctly. Continuing" echo "Type the full version string you want, such as 2.6.32-696.18.7.el6.x86_64" echo -n "? " read v1 echo You chose ${v1}. /sbin/depmod -a ${v1} /sbin/mkinitrd /boot/initramfs-${v1}.img ${v1} echo "!!!!!" echo "! Add the following line to /boot/grub/grub.conf below your kernel line." echo "initrd /initramfs-${v1}.img" echo "! Then, reboot." echo "!!!!!"