The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 11,870β€…    Votes:  21β€…    βœ… Solution
Tags: dual-boot   grub2   windows  
Link: πŸ” See Original Answer on Ask Ubuntu πŸ”—

URL: https://askubuntu.com/q/1014491
Title: Is there a way for grub to automatically reboot into Windows from Windows?
ID: /2018/03/13/Is-there-a-way-for-grub-to-automatically-reboot-into-Windows-from-Windows_
Created: March 13, 2018    Edited:  March 30, 2018
Upload: November 24, 2022    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


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 setup grub 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 want grub 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:

#GRUB_DEFAULT=0 # Rather than option #1, we'll always default to last boot choice.
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

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:

sudo update-grub

Ubuntu command line to reboot into Windows

Currently you use something like this:

sudo grub-reboot x # Where x is Windows zero-based grub menu number
sudo reboot now

From this modified Stack Exchange answer you can use the grub default to reboot into Windows. Copy this code into your ~/.bashrc file:

function reboot-to-windows {
    WINDOWS_TITLE=`grep -i "^menuentry 'Windows" /boot/grub/grub.cfg|head -n 1|cut -d"'" -f2`
    sudo grub-set-default "$WINDOWS_TITLE"
    sudo reboot
}

To reboot into Windows from the command line use:

reboot-to-windows

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.

⇧ what are system.journal and templates.dat how to make conky true transparent?  β‡©