Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Grub2 - Community Ubuntu Documentation says the following:

Saving an OS can be achieved by running sudo grub-set-default if DEFAULT=saved is set in /etc/default/grub. It may also be saved if GRUB_SAVEDEFAULT=true is also set in /etc/default/grub. In this case, the default OS remains until a new OS is manually selected from the GRUB 2 menu or the grub-set-default command is executed.

I put the lines DEFAULT=saved AND GRUB_SAVEDEFAULT=true in /etc/default/grub, and ran sudo grub-set-default. Here is the output:

$ sudo grub-set-default
entry not specified.
Usage: grub-set-default [OPTION] entry
Set the default boot entry for GRUB.

  -h, --help              print this message and exit
  -v, --version           print the version information and exit
  --boot-directory=DIR    expect GRUB images under the directory DIR/grub
                          instead of the /boot/grub directory

ENTRY is a number or a menu item title.

Report bugs to <bug-grub@gnu.org>.

Am I not following the documentation correctly? What's the correct way to do this?

share|improve this question
1  
After changing the grub file you best always run " sudo update-grub" . –  Julien Chau Jun 9 '12 at 18:36

2 Answers 2

up vote 27 down vote accepted

The documentation in this case is wrong. All variables in /etc/default/grub start with GRUB_, so it's GRUB_DEFAULT=saved, not DEFAULT=saved. I've corrected the Ubuntu wiki to reflect that.

The official grub manual describes this correctly: http://www.gnu.org/software/grub/manual/grub.html#Simple-configuration

Put the following in /etc/default/grub:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run:

sudo update-grub
share|improve this answer
1  
+1 for the link, I've edited your answer with the solution that worked for me (which I derived from the link you provided) –  notfed Jun 18 '12 at 17:47

You are forgetting the number (ie. the "ENTRY is a number or a menu item title." in your text).

sudo grub-set-default 1

for option 1 to be the default.

Always run sudo update-grub after modifying the /etc/default/grub file to apply the changes.

share|improve this answer
1  
This did not work for me, it just sets the GRUB menu to point to entry #1, not the last choice –  notfed Jun 18 '12 at 17:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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