25

Each time I've tried to dual boot Ubuntu with Windows I always have difficulty with the same thing... editing the default option on the grub boot loader. I'm now running 11.10 and have run into the same problem.

  • Startup-manager didn't work on 11.04, neither does it work on 11.10.
  • Editing GRUB_DEFAULT= in the /etc/default/grub file doesn't seem to work either.

This shouldn't be difficult, and I'm sure there's a simple explanation. Could someone please tell me what it is?

23

The definitive guide is the community wiki (link below).

But in summary - GRUB_DEFAULT takes either a numeric or a string value. Numeric values reflect the boot order options (menu entry values) described in /boot/grub/grub.cfg

For example - in my grub my GRUB_DEFAULT value is set to the value 6 (six):

enter image description here

If you look at /boot/grub/grub.cfg and count the lines starting with the the text menuentry where the first entry is zero, the second is one and so on you'll see that the value of six corresponds to what you see in the grub screen.

enter image description here

N.B. I've truncated the file to just show lines starting with the text menuentry

Setting by a string value is useful if you want to make windows the default boot.

You only make changes to GRUB_DEFAULT in the file /etc/default/grub

In both cases - run sudo update-grub to regenerate the file /boot/grub/grub.cfg - this is the file that grub itself uses but you should not change yourself.


Linked Question:

  1. How do I set Windows to boot as the default in the boot loader?
  2. https://help.ubuntu.com/community/Grub2
  • What's the name of an entry? The label after menuentry? The menuentry_id_option? Something not specified by default? Does it need to be quoted when passed to GRUB_DEFAULT? Can you maybe change the example to show how to use menu entry names/ids since specifying indexes seems a bad idea anyway. – Karl Richter Mar 4 '16 at 12:39
  • Hi, @fossfreedom, I saw this thread when I was looking for a way to change the label of a GRUB menu right from the editor without having to boot up the OS that installed it (Should be Ctrl-X from GRUB manual but maybe the installed grub is too old). Anyway, my comment is instead about how you did the screenshot above along with the really nice arrows and labels you added? BTW, is it your text editor that added the ellipsis? What do you use? – green diod Dec 18 '16 at 14:01
  • Actually, it's the manual at gnu.org that is way too old: dated June 2012 for GRUB version 2.00 :P – green diod Dec 18 '16 at 14:07
1

I just had this and it still didn't work no matter how many times I tried variations...until I realized I had two /etc/default/grub files - one for each of my dual boot roots! And I had been editing the wrong one. So there's another file or variable out there somewhere that selects which file we are really using.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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