Ubuntu – How to switch remotely from Ubuntu and Windows 7 and vice versa

bootdual-bootgrub2windows 7

How do I switch from Ubuntu and Windows 7 (and vice versa) while working remotely?

Actually, I'm using the Windows loader (BCD) on MBR, and I have two choices:

If I'm working on Windows 7 and want to boot to Ubuntu, it's easy, because I set Ubuntu as default. So at restart, the system goes directly to GRUB (with timeout sets to "0") and Ubuntu is there.

But how could I get back to Windows again? Is there a chance?

While typing I was wondering if I could solve this trouble forcing the Windows loader to Ubuntu and let GRUB2 to choose from different systems.

Could it work?

Best Answer

Good that you already solved the part of switching from Windows to Linux. The other direction is not that hard:


There is the command grub-reboot that does just what you need - see below for detais:

If your grub menu entry for the system you want to boot is "Windows", you would just do:

$ grub-reboot Windows


If you configure the hardware to boot after a power failure, I see no reason the computer could not just stay running.

But if not, it should be possible to wake it up with wake on lan (WOL), booting the system you configured before shutdown. The WOL works with "special" network packages that can not be routed outside the local network, so there is a device needed in that network, like a some DSL router or any computer.



From man 8 grub-reboot:

 GRUB-REBOOT(8)     System Administration Utilities      GRUB-REBOOT(8)


 NAME
        grub-reboot - set the default boot entry for GRUB, for the next
        boot only

 SYNOPSIS
        grub-reboot [OPTION] MENU_ENTRY

 DESCRIPTION
        Set the default boot menu entry for GRUB,  for  the  next  boot
        only.

        [  ...  ]
        --boot-directory=DIR
               expect  GRUB images under the directory DIR/grub instead
               of the /boot/grub directory

        MENU_ENTRY is a number, a menu item title or a menu item  iden‐
        tifier. Please note that menu items in submenus or sub-submenus
        require specifying the submenu components  and  then  the  menu
        item  component.  The  titles  should  be  separated  using the
        greater-than character (>) with no extra spaces.  Depending  on
        your  shell some characters including > may need escaping. More
        information about this is available in the GRUB Manual  in  the
        section about the 'default' command.
        [  ...  ]


Run man -k grub for a list of related command - eg. grub-set-default may help you too.

Related Question