[Cialug] reboot into a different OS w/ grub

Matthew Nuzum newz at bearfruit.org
Mon May 3 14:17:59 CDT 2010


Hi, I saw this on commandlinefu.com:
http://www.commandlinefu.com/commands/view/5509/reboot-as-a-different-os-in-grub
$ echo "savedefault --default=2 --once" | grub --batch; sudo reboot

It is a command you can run that causes your computer to boot into a
different OS, as specified by one of the options in your grub boot
menu.

There's been a few times where I've wanted this capability, but always
in the context of testing an update on a remote machine. In that case
I want the computer to reboot into a different OS after x minutes
unless I tell it not to. Or, better yet, to return to "known good
state" if the next reboot fails.

I've not tried this technique yet but here are some examples of things
I've tried to fix and not been able to:

 1. reboot into a new kernel and everything works but networking
 2. reboot into a new kernel and cannot mount the filesystem at all
 3. panic on reboot

Will the above help with the above? Can anyone explain how the command
works? (I've searched the grub manual page and can't find reference to
savedefault or --once)


-- 
Matthew Nuzum
newz2000 on freenode, skype, linkedin, identi.ca and twitter

"Do not seek to follow in the footsteps of the wise. Seek what they
sought." –Matsuo Bashō


More information about the Cialug mailing list