Remotely reboot to a given kernel

I would like to remotely reboot a computer (via ssh) to a non default kernel.
If I just type reboot, it reboots to the default kernel.
Man reboot(8) does not give any hint so I am not sure that is possible at all. I have found nothing googling around either.
Does anyone know if this is possible?
Many thanks in advance!!

I guess you could as root edit the /boot/grub/menu.lst file. and change the default option number. Or you could have several menu.lst files and as root simply copy the one you want to the real menu.lst

I see. Thank you Gogalthorp!

G0NZ0 wrote:
> I see. Thank you Gogalthorp!

Or use kexec instead of reboot

It can be done using GRUB without editing menu.lst each boot and involves the directives default, savedefault, fallback as well as the program grub-set-default. See the texinfo doc for GRUB. Here is a sample file taken from a remote Debian server. This is just illustrative, the server in question will be decommissioned soon.

default saved
fallback 0

title           Debian GNU/Linux, kernel 2.6.8-3-686
root            (hd0,0)
kernel          /vmlinuz-2.6.8-3-686 root=/dev/hda7 ro 
initrd          /initrd.img-2.6.8-3-686
savedefault

title           Debian GNU/Linux, kernel 2.6.20.1-vs2.2.0-rc15-p3-squash-drbd-256ip-ipv6
root            (hd0,0)
kernel          /vmlinuz-2.6.20.1-vs2.2.0-rc15-p3-squash-drbd-256ip-ipv6 root=/dev/hda7 ro 
initrd          /initrd.img-2.6.20.1-vs2.2.0-rc15-p3-squash-drbd-256ip-ipv6
savedefault fallback

To get kernel 1 to boot, you run grub-set-default 1. It will work just once, for the next boot, and then revert to the fallback entry, kernel 0. A failure to load kernel 1 will also cause the fallback 0 to boot. Thus one can try a different kernel remotely. Of course if the kernel hangs, you still need remote power control to regain control.

On 2011-03-16 18:36, G0NZ0 wrote:

> Does anyone know if this is possible?

grubonce
grub-set-default


Cheers / Saludos,

Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)

Thank you so much everyone, I am really glad I asked this question, lots of useful info that I did not know!! :slight_smile: