Monday, January 3, 2022

[SOLVED] i want read another kernel when an error occurs

Issue

When reading the kernel, i want read another kernel when an error occurs. because ssh remote in kernel compile. grub option is it possible?

title CentOS (3.13.6)
        root (hd0,0)
        kernel /vmlinuz-3.13.6 ro root=/dev/mapper/vg_sizone-lv_root rd_NO_LUKS rd 
_LVM_LV=vg_sizone/lv_root rd_NO_MD crashkernel=auto LANG=ko_KR.UTF-8  KEYBOARDTYPE 
=pc KEYTABLE=ko rd_LVM_LV=vg_sizone/lv_swap rd_NO_DM rhgb quiet
        initrd /initramfs-3.13.6.img
title CentOS (2.6.32-642.6.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-642.6.1.el6.x86_64 ro root=/dev/mapper/vg_sizone-lv 
_root rd_NO_LUKS rd_LVM_LV=vg_sizone/lv_root rd_NO_MD crashkernel=auto LANG=ko_KR. 
UTF-8  KEYBOARDTYPE=pc KEYTABLE=ko rd_LVM_LV=vg_sizone/lv_swap rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-642.6.1.el6.x86_64.img

if 3.13.6 kernel panic. i want boot 2.6.32


Solution

This cannot be achieved in all the scenarios; However, if you want to test a new kernel for your server and fall back to old if not working, you can get.

I assume you are booted with your old kernel right now and want to test your newly compiled kernel.
once you have created a menu entry for your new kernel, make sure, You add 'panic=N' to kernel command line parameter; This will ensure a reboot after N seconds (if N is greater than zero) of kernel panic.

Then,

Set currently booted kernel as default:

# grub-set-default <current kernel menuentry number>
# grub-reboot <new kernel menuentry number>

Note here that the menu entry number starts from 0. Then, reboot the system.

# reboot

This will boot into the newly compiled kernel and reboot to old kernel in case there is a kernel panic.



Answered By - rk1825