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.

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?

share|improve this question
add comment

3 Answers 3

up vote 5 down vote accepted

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

sudo grub-set-default 0

share|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
add comment

... hope you understand this :-)

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 GRUB_DEFAULT=? line:

GRUB_SAVEDEFAULT=true

and change this line to:

GRUB_DEFAULT=saved

save & close & 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 be 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=""
.................
......................
.........................
........bla bla bla...;-)
share|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
add comment

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=""

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

share|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
add comment

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.