Using “grub-reboot” to specify the OS you want to reboot to

I ran into this immensely handy command for specifying which OS you want to boot into on your next boot. You simply run “grub-reboot” and specify the menu item (which can be found in /boot/grub/grub.cfg) you want to boot into.

For example, the following command will cause my computer to boot into windows on my next reboot. Note that it does not issue a reboot, it only pre-configures the behaviour for when I decide reboot.

sudo grub-reboot "Windows 7 (loader) (on /dev/sda3)"

What is awesome about this command is it does not modify your default menu item in grub. After one reboot, it will go back to the default. Very nifty.

Please note that this only works on distributions using Grub 2, and your grub configuration must be set to boot to the “saved” entry by default. In Ubuntu 10.10, this is accomplished by replacing the GRUB_DEFAULT line in /etc/default/grub with the following:


Any changes made to /etc/default/grub will need to be followed by running “update-grub”.

Share and Enjoy:
  • StumbleUpon
  • Facebook
  • Twitter
  • Reddit
Using “grub-reboot” to specify the OS you want to reboot to

9 thoughts on “Using “grub-reboot” to specify the OS you want to reboot to

  1. drewsus says:

    Great! Is there a way to do this to boot directly into Linux (Ubuntu) from Windows? (essentially the reverse of what you showed above)

    1. jharvey says:

      The way grub-reboot works is by modifying a grub environment file in the /boot directory. If you could mount and modify the /boot directory from windows, you may be able to control reboot behavior.

      Unfortunately, most filesystem types that linux uses aren’t supported in Windows at this time. It may be possible to put grub on a FAT filesystem, allowing windows to mount it, but I’m not certain. I’ll look into it and put a post up if I find a solution.

      Thanks for the comment!

    1. jharvey says:

      I’ve been wanting to try out BURG, but I haven’t gotten around to it yet. If I find similar functionality in it, I’ll write a post on it.

    2. dRewsus says:

      Hey, I have to wait til I get home, but I believe it does. But, there are a few more steps required.

      run this command in terminal:
      gksu gedit /etc/default/burg

      replace the GRUB_DEFAULT line with:

      save and close.
      run this command in terminal:
      sudo update-burg

      *disclaimer: I have not done this yet (will in about 2 hours) so results may not be as desired.

  2. Nick HS says:

    You have no idea how long I’ve been looking for this, you sir are fantastic. Thank you! If you’re ever around in Singapore I owe some cookies or a cold one.

Leave a Reply

Your email address will not be published.