How to select which operating system starts first on a dual-boot installation (Windows7 and Ubuntu 12.04)


Edit /etc/default/grub, in terminal...

  • gksudo gedit /etc/default/grub

and edit/add these two parameters near the top of the file...

GRUB_DEFAULT=saved     <--- this line requires an edit
GRUB_SAVEDEFAULT=true  <--- this line needs to be added

...so that GRUB will remember your last selected OS as the default OS.

Then, in terminal...

  • sudo update-grub

I am assuming you are using Grub2 to boot. More details can be found at https://help.ubuntu.com/community/Grub2/Setup#Configuring_GRUB_2.

  1. Boot your computer; when Grub appears, tap a key to prevent loading the default OS
  2. Look at the list of available options for booting; take note of the line number of the OS you want to boot by default; line numbers start at 0
  3. Boot into the OS that manages Grub; I am going to guess this would be Ubuntu
  4. In a terminal, open /etc/default/grub with sudo -H gedit /etc/default/grub (or other text editor)
  5. Look for the line that starts with either "GRUB_DEFAULT=" or "#GRUB_DEFAULT="; if the latter, remove "#"
  6. Replace whatever is after "=" with the line number of the OS you want to boot by default
  7. Save
  8. In a terminal, use sudo update-grub
  • NEVER run a GUI app with sudo alone. The -H parameter assures it won't mess with file permissions where it shouldn't. Also there's no need to open nautilus as root just to open and editable file when you can open it directly in the way I just edited in.
    – user692175
    Nov 16 '17 at 2:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.