Ubuntu – Edit grub from Windows

dual-bootgrub2

Now I'm not sure if this is on topic or not, but if not, I have no idea where to post it, superuser does not seem appropriate because this relates to grub, but I regress.

When I restart Windows it boots to grub, and then the default grub option is Ubuntu, causing some very annoying times trying to install updates, so what I want to do is be able to edit the grub boot configuration temporarily to put Windows at the top after a restart, but after Windows was booted, it would go back to Ubuntu.

How would I do this?

Best Answer

The title of the question is what the OP proposed solution to the problem is. The title could be changed to "How can I have Grub boot to the last used OS choice automatically?".

This should arguably be default grub behavior. For example, I might be using Windows for a week playing Mass Effect IV and never come into Ubuntu. Or I might be testing something in Ubuntu 14.04 with a specific Kernel and I don't like having to pick it every time over 50 reboots.

There is a link in various comments above to a Stack Exchange answer proposed as a duplicate question. We can reference an AskUbuntu Q&A too: How to get grub2 to remember last choice?

In summary edit /etc/default/grub, comment out one line and insert two lines below it:

#GRUB_DEFAULT=0 # Rather than first menu option, we'll default to last  OS.
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then save the changes and run sudo update-grub.

Voila! Whilst working in Windows and automatic updates happen at 3 am the system reboots to Windows and applies Stage 3 of 3.

OP is proposing "Edit Grub from Windows?" in the title as a solution to the problem. However, after stating the reason why, it becomes clear the title should be changed to something like: "How do I ensure Windows automatic update reboots go to Windows instead of Ubuntu?".

If the question was "How do I reboot to the last OS choice?" it's an obvious duplicate of the link. The proposed new title (or something shorter) has merit because others may search on the same problem. I know I've had the Windows update-reboot-update problem before and never would have imagined to search on the link here.

PS You can edit Grub from Windows but, why would you want to?