ย ๐Ÿ” Reboot from Linux into any other OS (Dual Boot) via SSH

This guide shows how to remotely reboot into Any Grub Boot Menu option while remoting into linux on a dual-boot system.

โœ… For example: when youโ€™re SSHโ€™d into a Linux system (e.g., Linux Mint) and want the next boot to go to Windows without physically interacting with the machine.


๐Ÿ“‹ Prerequisites

  • Dual boot setup with Linux (e.g., Mint) and another OS
  • GRUB bootloader and boot menu
  • SSH access to the Linux system

For full details, Check Grubโ€™s Official Documentation

๐Ÿงพ Step-by-Step

For this example, I assume you want to boot into your windows for simplicity

1. ๐Ÿ” Find the Windows GRUB entry

What weโ€™re doing is basically filtering through /boot/grub/grub.cfg to get the lines we want, thereโ€™re many ways to do so but the simplest is just to run this command:

awk -F\' '/menuentry / {print i++ ": " $2}' /boot/grub/grub.cfg

The output will look something like this:

0: Linux Mint 22 Cinnamon
1: Linux Mint 22 Cinnamon, with Linux 6.8.0-40-generic
2: Linux Mint 22 Cinnamon, with Linux 6.8.0-40-generic (recovery mode)
3: Linux Mint 22 Cinnamon, with Linux 6.8.0-39-generic
4: Linux Mint 22 Cinnamon, with Linux 6.8.0-39-generic (recovery mode)
5: Linux Mint 22 Cinnamon, with Linux 6.8.0-38-generic
6: Linux Mint 22 Cinnamon, with Linux 6.8.0-38-generic (recovery mode)
7: Windows Boot Manager (on /dev/nvme0n1p1)
8: UEFI Firmware Settings

Copy the name exactly, without the index: Windows Boot Manager (on /dev/nvme0n1p1)

Or, if for any reason you didnโ€™t find the Windows entry, run this command:

sudo grep -i menuentry /boot/grub/grub.cfg

And look for:

menuentry 'Windows Boot Manager (on /dev/nvme0n1p1)' --class windows --class os ...

The name is in quotes.


2. ๐Ÿš€ Reboot into Windows (once)

Now that you have your menu entry, just use grub-reboot with it:

sudo grub-reboot "Windows Boot Manager (on /dev/nvme0n1p1)"
sudo reboot

The name in "" should be exact.

For this example, the system will reboot into Windows one time, then revert to the default OS (Linux for me).


3. (Optional) ๐Ÿ” Make Windows the default

To boot into Windows every time by default:

sudo grub-set-default "Windows Boot Manager (on /dev/nvme0n1p1)"
sudo update-grub

You can undo this later with:

sudo grub-set-default 0  # Assuming Linux is first entry, index works as the image shows
sudo update-grub

4. Extra:

Youโ€™d use the index instead of the name to reboot into the OS once:

sudo grub-reboot 2
sudo reboot

๐Ÿง  Notes

  • This uses GRUBโ€™s temporary boot override via grub-reboot
  • You need sudo privileges to run it

  • grub-reboot โ€“ Set next boot only
  • grub-set-default โ€“ Change default permanently
  • update-grub โ€“ Regenerates GRUB menu

Future:

  • Make it a simple script so youโ€™d remotely run to avoid the manual process

๐Ÿ–ค Credits

Written by Abdullah Alafari, tested on Linux Mint 22 Cinnamon with GRUB2.

Connect with me on Linkedin