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 have a dual boot system with Ubuntu 11.04 and Windows 7.

My GRUB bootloader defaults to Ubuntu. I mainly use Ubuntu, but I occasionally need to bootup Windows to do a few things.

If I need to do something in Windows I can "shutdown" Ubuntu and select Windows 7 in the bootloader. However, it would be more efficient if I could do this in one click from Ubuntu.

  • Is it possible to press a key in Ubuntu which means "Shut down, and then boot into Windows"? (or for that matter Shut down and boot into any non-default bootup)
share|improve this question
add comment

2 Answers 2

up vote 15 down vote accepted

In case you know the entry number for your Windows installation (start counting with 0 for first position) in the grub menu you can reboot into Windows (assuming to be 3rd on the list) by this command:

grub-reboot 2

Alternatively you can also use the textual entry used:

grub-reboot '<type entry here>'

This command can also be put in a launcher for "single-click" usage.

To make this procedure work we need the entry GRUB_DEFAULT=saved in /etc/default/grub.

share|improve this answer
3  
Thanks. After reading your answer, I did a few searches and found the following post useful to flesh out a few more details about grub-reboot : webupd8.org/2010/10/how-to-reboot-in-windows-from-ubuntu.html –  Jeromy Anglim May 13 '11 at 7:35
add comment

@Takkat has answered the question, but I thought I'd describe a few more details in case it might help others.

  • Boot menus count from zero. I have five elements in my boot menu. The fifth element is Windows, thus, to reboot to Windows, I had to issue the command grub-reboot 4 (i.e., not 5). UPDATE: see comments below about this possibly changing.
  • In order to edit /etc/default/grub I issued sudo vim /etc/default/grub.
  • To make the procedure work, I had to modify the existing value of GRUB_DEFAULT=0 to GRUB_DEFAULT=saved and then run sudo update-grub.

I then created a script based on the webupd8 example:

I called it winboot and put in in ~/bin

#!/bin/bash
gksu grub-reboot 4
gksu reboot
share|improve this answer
    
Ty for giving us further details. Mind that after the next kernel update you will likely have to change your position number. –  Takkat May 13 '11 at 9:03
    
@Takkat - Would there be a way of auto selecting the lowest line number (I'm assuming Windows is listed last in Grub2) to avoid that problem? @Jeromy - Thanks for posting this up. –  boehj May 13 '11 at 11:33
    
I've not tested this but by using the textual description for Winodws you should be on the safe side. –  Takkat May 13 '11 at 12:38
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.