You are here

howto: make grub boot a specific stanza only once on the next boot for centos 6.x

sometimes when experimenting, we need a certain grub config/stanza. but what do we do if the stanza is not 100% there yet? well normally it means we have to reboot the box and manually select the healthy stanza and boot it.

however there are some scenarios that dont make this a reasonable approach. stanalone servers with no consoles attached.

so what we want is to tell grub to boot our new stanza only once and this is the command to do it

echo "savedefault --default=N --once" | grub --batch

where N is the number of the stanza you are working on.

the command saves the current default and tells grub to swap the current default stanze with the stanza N only this one time

this only leaves the system administrator with figuring out how to powercycle that server to use the default stanza and that exercise will be left up to the imagination of the gentle reader :)

NB. This is only required on Centos/RHEL 6.x, other distros have a grub command line utility that will do it for you