Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have installed Linux and Windows on same system, Linux is loaded by default on system startup and from Linux I restart the OS. What I want to do is on next restart I want to automatically load Windows OS, i.e. user don't need to select the OS. and when Windows is restarted the System should load Linux again. Mean I need to load Windows only one time after restart of linux. Can I do it with GRUB? as in GRUB if i put the index number of OS in default directive of boot loader it will become permanant, but I need one time change only.

edit: I have come across a command which is grub-reboot which do the above task according to its manual... but its not working for me on debian.., yet not sure why... any luck with any one?

edit: This command works on ubuntu and I have to transfer my code to UBuntu text only version. and problem resolved.

share|improve this question

migrated from stackoverflow.com Sep 8 '12 at 9:49

This question came from our site for professional and enthusiast programmers.

    
Are you using the legacy GRUB or GRUB2? –  Nico Huysamen Jan 3 '11 at 9:03
    
Legacy GRUB on Debian. –  Ummar Jan 3 '11 at 9:42
add comment

2 Answers

To change the default OS to boot, you will need to change the value in:

/boot/grub/menu.lst

I cannot see any way that you would be able to do exactly what you want. If you want to play around a bit, what you could do is the following:

Have 2 versions of your /boot/grub/menu.lst file, one for booting Linux as default, and one for booting Windows as default. Secondly, you will need to install (on Windows) a driver so that you can access your Linux partitions (easy enough if using EXT2/EXT3, not so much when using EXT4) Have a look here or if you have EXT2/3 use this.

Now, what you will need to do is create a script that runs at startup (of both OSes seperately) to swop AND RENAME the two menu.lst files that you have.

Sorry that I cannot think of a more eloquent way of doing it. If anyone else has a suggestion, please let me know.

share|improve this answer
    
Thanks for your suggestion.. it may be considered as work arround.. first I am investigation for a direct way. –  Ummar Jan 3 '11 at 12:53
    
Is it possible with GRUB 2? –  Ummar Jan 3 '11 at 14:00
    
@Ummar - Not too sure. GRUB2 does not use the menu.lst file. –  Nico Huysamen Jan 3 '11 at 14:14
add comment
up vote 1 down vote accepted

the grub-reboot command is solution for this problem, don't work on debian same case here with me, it worked on Ubuntu and Redhat

share|improve this answer
    
This is what I have told already in my question.. however thanks for reply.. –  Ummar Apr 15 '11 at 8:10
add comment

Your Answer

 
discard

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