Redhat and Centos kernel panic after yum update¶
- Author:
Dimitry Dukhovny
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¶
1#!/bin/bash
2export PATH=${PATH}:/bin:/usr/bin:/sbin:/usr/sbin
3export MYNAME=`basename ${0}`
4
5ischroot() {
6 if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]
7 then
8 echo 1
9 else
10 echo 0
11 fi
12}
13
14/bin/ls /boot/vmlinuz-* /mnt/sysimage/vmlinuz-* 2> /dev/null
15echo Above are versions of the kernel you have in the usual places.
16
17[ `/usr/bin/id -u` -ne 0 ] && echo You are not root. I will not obey. \
18 && exit 255
19
20[ `ischroot` -ne 1 ] && echo You are not chrooted. Try: \
21 && echo " chroot /mnt/sysimage" && echo " ${MYNAME}" && exit 255 \
22 || echo "You are chrooted, hopefully correctly. Continuing"
23
24echo "Type the full version string you want, such as 2.6.32-696.18.7.el6.x86_64"
25echo -n "? "
26read v1
27echo You chose ${v1}.
28/sbin/depmod -a ${v1}
29/sbin/mkinitrd /boot/initramfs-${v1}.img ${v1}
30echo "!!!!!"
31echo "! Add the following line to /boot/grub/grub.conf below your kernel line."
32echo "initrd /initramfs-${v1}.img"
33echo "! Then, reboot."
34echo "!!!!!"