yum updateしたらkernel panicで起動しなくなった
スポンサーリンク
環境
CentOS7.2上のKVM上のCentOS7.2で
状況
yum update
でカーネルが
3.10.0-327.22.2.el7.x86_64
から
3.10.0-327.28.2.el7.x86_64
アップデートされ,久しぶりに再起動するとKernel Panicで以下のメッセージが表示され,起動できていなかった
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) CPU: 0 PID 1 Comm: swapper/0 Not tainted 3.10.0-327.28.2.el7.x86_64 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 ...
解決法
新しいカーネル(3.10.0-327.28.2.el7.x86_64
)のinitramfsが生成されていないのが原因らしい
とりあえず,古いカーネル(3.10.0-327.22.2.el7.x86_64
)で起動し
$ ls -l /boot | grep initramfs -rw-r--r--. 1 root root 57613265 5月 31 10:42 initramfs-0-rescue-1016740bf95247ae941d721fac81bcaa.img -rw-------. 1 root root 29887789 8月 8 10:14 initramfs-3.10.0-327.18.2.el7.x86_64.img -rw-------. 1 root root 29886600 8月 8 10:14 initramfs-3.10.0-327.22.2.el7.x86_64.img -rw-------. 1 root root 19841024 8月 8 10:14 initramfs-3.10.0-327.el7.x86_64.img
initramfs-3.10.0-327.28.2.el7.x86_64.img
がないので,以下のコマンドで生成
$ sudo depmod 3.10.0-327.28.2.el7.x86_64 $ sudo mkinitrd initramfs-3.10.0-327.28.2.el7.x86_64.img 3.10.0-327.28.2.el7.x86_64 $ ls -l /boot | grep initramfs -rw-r--r--. 1 root root 57613265 5月 31 10:42 initramfs-0-rescue-1016740bf95247ae941d721fac81bcaa.img -rw-------. 1 root root 29887789 8月 8 10:14 initramfs-3.10.0-327.18.2.el7.x86_64.img -rw-------. 1 root root 29886600 8月 8 10:14 initramfs-3.10.0-327.22.2.el7.x86_64.img -rw-------. 1 root root 29885799 8月 19 23:07 initramfs-3.10.0-327.28.2.el7.x86_64.img -rw-------. 1 root root 19841024 8月 8 10:14 initramfs-3.10.0-327.el7.x86_64.img
grub.cfg
の新しいカーネルのセクションを確認
セクション最終行の
initrd16 /initramfs-3.10.0-327.28.2.el7.x86_64.img
が抜けていたため,追記した
$ sudo vi /boot/grub2/grub.cfg menuentry 'CentOS Linux (3.10.0-327.28.2.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.el7.x86_64-advanced-fdca8898-0b12-4e30-a4c6-abb66c8f1ddc' { load_video set gfxpayload=keep 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='hd0,msdos1' d03afdf1-35b8-4289-93fb-6363859211c4 else search --no-floppy --fs-uuid --set=root d03afdf1-35b8-4289-93fb-6363859211c4 fi linux16 /vmlinuz-3.10.0-327.28.2.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=ja_JP.UTF-8 initrd16 /initramfs-3.10.0-327.28.2.el7.x86_64.img
これで,無事起動できるようになった