Linux Kernel – Which Kernel Does Reboot Load?

kernellinux

I am using ssh to remotely access some machines. These machines have a custom kernel installed (based on the 2.6.28 source). However, whenever I try to reboot the machines using sudo reboot, the system uses kexec and loads the 2.6.28-19-generic kernel, which is also intalled on the machine.

So how can I specify which kernel image to load after reboot?

EDIT:
I have ubuntu 9.04 installed on the machine, with grub 1.something.
The custom kernel is based on the 2.6.28 source with the name being 2.6.28.10-custom-1.1.
Two other kernels are installed on the machine 2.6.28-19-generic and 2.6.28-6-386. I have checked that after calling reboot, the machine does not actually reboot but uses kexec to load the 19-generic kernel, even if the current kernel was the custom one.

Best Answer

Normally, when you reboot, the machine will return to grub and either allow you to select a kernel via the keyboard, or boot the default configured kernel. However if you have kexec-tools installed, the reboot command will short circuit this behaviour and directly kexec into a kernel. You can disable this behaviour, and return to grub in reboot, by uninstalling kexec tools or editing the file

/etc/default/kexec 

and setting:

  LOAD_KEXEC=false 

Alternatively, to keep kexec active and have it reboot into the kernel of your choice, try a command line like this to load your desired kernel:

 kexec -l /boot/vmlinux --append=root=/dev/hda1 --initrd=/boot/initrd

then when 'kexec -e' is later run, the configured kernel in the kexec line as well will be run. As I believe the reboot script eventually just calls 'kexec-e' I believe the kernel change should take effect then.

Related Question