6

I accidentally ran sudo grub-reboot 4 (background) twice in a row, and now GRUB permanently boots to the fourth menu item.

How can I restore the default boot behavior?

6

Use the grub-set-default command.
For example, assuming you want the first grub entry to be your default:

sudo grub-set-default 0

| improve this answer | |
  • 1
    Or you can clear all this state entirely with 'sudo grub-editenv /boot/grub/grubenv unset prev_saved_entry; sudo grub-editenv /boot/grub/grubenv unset saved_entry'. (That's slightly lower-level, though.) – Colin Watson Jan 5 '11 at 15:03
3

Open Terminal and type:

cd /etc/default/

Backup your file:

sudo cp grub grub.backup

Edit your file:

gksudo gedit grub

Add this line before the GRUB_DEFAULT=? line:

GRUB_SAVEDEFAULT=true

and change this line to:

GRUB_DEFAULT=saved

Save, close and then run this:

sudo update-grub

Next time, whenever you choose an OS from your grub menu it will be the default one until you choose another one, and so on.

Your first lines will look like these:

GRUB_SAVEDEFAULT=true
GRUB_DEFAULT=saved
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=6
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""
# ...
| improve this answer | |
  • Thank you for the suggestion, but this is not the default behavior I want to restore. I want GRUB to always boot to the first menu item. – ændrük May 22 '11 at 17:15
1

It is working , ...anyway.

the first choice in the grub2 menu is '0' the second one is '1' and so on.......

so your file looks like:

GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

................. ......................

| improve this answer | |
  • Please only use the Post Your Answer button for new, different answers. You should use the edit button to modify your original answer if you need to add additional information. – ændrük May 23 '11 at 13:05

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.