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.

Okay here is the situation -

I have

1.Ubuntu (default)

2.Windows XP.

I use XP only for android rooting and stuff and thus do not need it 90% of times.

Now what I want should happen is, Grub should not show up and directly boot to Ubuntu in normal everyday circumstances.

And when I shall want XP, I will do the exact opposite change to what I did to exclude it and make grub show up.(Obviously first booting into Ubuntu,doing that change and then rebooting to get grub)

So, How can i achieve this?

share|improve this question
add comment

1 Answer 1

You can set the grub timeout to 0. Just edit the file /etc/default/grub and set

GRUB_TIMEOUT=0

This leaves us with the question of how to boot Windows. In the same config file set

GRUB_DEFAULT=saved

After that you can set the default entry to select. If your Ubuntu is the first entry run

sudo grub-set-default 0

This way grub will always select the first entry if you don't specify something else. If you want to start Windows now, you have to start Ubuntu first. Open a terminal and run e.g.

sudo grub-reboot 1

if you want the second entry to be selected on reboot. There you have to enter the number of the entry that is your Windows. Keep in mind that the index is zero based, so the first is 0, the second is 1 and so on.

When using grub-reboot your system reboots and the given entry will be selected default instead of Ubuntu. Since your timeout is 0 it will boot directly. Technically grub still shows but so shortly that you don't see it. I suggest you try out grub-reboot before setting the timeout to 0.

Almost forgot: After every edit of the config file you have to run

sudo update-grub

for the changes to become effective.

share|improve this answer
    
okay...now just to confirm the index, after ubuntu is mem test and stuff...i guess 3 options...so windows will be..4? ( ubuntu-0,the other 3 options, windows-4)? right? –  Nirmik Nov 17 '12 at 15:39
    
and the command 'sudo grub-reboot 1' will directly boot windows? without showing grub? –  Nirmik Nov 17 '12 at 15:39
    
If you have really three other options between Ubuntu and Windows 4 would be right and sudo grub-reboot 4 would reboot your system into Windows. Editing my answer on the other concern. –  André Stannek Nov 17 '12 at 15:48
    
okay...about the grub-reboot command, is it a 1 time command? because if it isnt, how will i again get back to ubuntu? –  Nirmik Nov 17 '12 at 15:52
    
The selection counts only for the next boot. Afterwards the entry you set with grub-set-default will be selected again. –  André Stannek Nov 17 '12 at 16:04
show 1 more 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.