I have a dual boot setup:
- Ubuntu 16.04 LTS
- Windows
Currently when I want to reboot
from Ubuntu into Windows I use grub-reboot
with the appropriate number as argument. This works well.
However sometimes Windows needs a reboot so a certain program can install or update and I manually have to select the right grub boot menu entry. Is there a similar way (from Windows UI) to tell grub which entry to boot?
I suppose the grub-reboot
command passes the argument to a file which is in turn read by grub upon reboot
.
edit (concerning my selected answer):
I'm currently looking into mounting the ext4 drive that contains /boot and scripting the edit. this will possibly take quite a while since i'm doing this in my free time beside my 40h/week non-tech job. ^^
Best Answer
Easiest way is with Grub
It is cumbersome controlling
grub
from Windows. A third party application to access Ubuntu from Windows and some hacking is required. However from the top part of this post: How to change the order on my dual booting distros, you can setupgrub
to automatically reboot to the last menu option. So when you initially boot with windows, and it wakes up at 2 am to run updates,grub
will reload Windows so it can gracefully finish updates.When you manually reboot and pick Ubuntu from
grub
all your next reboots automatically load Ubuntu. This feature works equally well if you have bugs in the current kernel and wantgrub
to automatically reboot into an older kernel version you selected.How to get Grub to repeat last boot selection
This is fairly straight forward. Using
sudo
powers edit/etc/default/grub
and change the following:The first line you will be commenting out and right below that insert the next two lines.
Save the file and type in the terminal:
Ubuntu command line to reboot into Windows
Currently you use something like this:
From this modified Stack Exchange answer you can use the grub default to reboot into Windows. Copy this code into your
~/.bashrc
file:~/.bashrc
file with newreboot-to-windows
function.~/.bashrc
to be loaded.: ~/.bashrc
to reload it into the existing terminal session but some people recommend against do this.To reboot into Windows from the command line use:
If Windows automatically restarts when you aren't looking, Windows is rebooted. This allows Windows automatic updates to be processed normally over multiple-reboot cycles Windows sometimes uses.