Booting to Windows from Linux

When you are at work but you still want to game on your trusty windows install

Booting to Windows from Linux
This article assumes that you have Windows 11 and a modern version of linux like Pop_OS 24.04 installed in another drive.
Pop_OS 24.04 has no X11 support by default

Prerequisites

  1. SSD1 (Gen5/Gen4/Gen3 NVMe) --> Windows 11 installed
  2. SSD2 (Gen5/Gen4/Gen3 NVMe) --> Pop_OS 24.04 (Default boot)

The Problem

Now usually when you manage such a dual boot, you could change the boot order after POST, by hitting the boot key (Different for different vendors) and then you can boot to whichever OS you see fit.

But what if this is in a remote workstation ? Its not like most consumer PC's ship with IPMI (P.S usually reserved for the Enterprise)

So no boot order for us, but if there is anything possible then its probably more viable in linux than in windows.

The Solution

Step 0: Make sure Linux is the primary Boot OS

Reboot to your Motherboard Firmware, Head to Boot and make sure Your Linux OS is in Boot Option #1

Save Changes and Reboot

Step 1: Check Boot List

Now that you are Booting to Linux by Default. Check all the available boot options using

sudo bootctl list

The Output should be something along the lines of:

kaito@Comet:~$ sudo bootctl list
         type: Boot Loader Specification Type #1 (.conf)
        title: Pop!_OS recovery (default)
           id: Recovery-5751-82C2.conf
       source: /boot/efi//loader/entries/Recovery-5751-82C2.conf
        linux: /boot/efi//EFI/Recovery-5751-82C2/vmlinuz.efi
       initrd: /boot/efi//EFI/Recovery-5751-82C2/initrd.gz
      options: boot=casper hostname=recovery userfullname=Recovery username=recovery live-media-path=/casper-5751-82C2 >

         type: Boot Loader Specification Type #1 (.conf)
        title: Pop!_OS (selected)
           id: Pop_OS-current.conf
       source: /boot/efi//loader/entries/Pop_OS-current.conf
        linux: /boot/efi//EFI/Pop_OS-cdb75637-6004-4586-850a-ccc116f78c1c/vmlinuz.efi
       initrd: /boot/efi//EFI/Pop_OS-cdb75637-6004-4586-850a-ccc116f78c1c/initrd.img
      options: root=UUID=cdb75637-6004-4586-850a-ccc116f78c1c ro quiet loglevel=0 systemd.show_status=false splash nvid>

         type: Automatic
        title: Windows Boot Manager
           id: auto-windows
       source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

         type: Automatic
        title: Reboot Into Firmware Interface
           id: auto-reboot-to-firmware-setup
       source: /sys/firmware/efi/efivars/LoaderEntries-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f

If the Windows entries are missing, chekout the F.A.Q's at the bottom of this post for why it happens and what's the fix.

Step 2: Identify the Boot Entry ID:

In this case, we are looking at the id of my Windows Install so that would be auto-windows

Step 3: Test Reboot to Windows

sudo systemctl reboot --boot-loader-entry=auto-windows
If this successfully boots to Windows ... Voila this experiment is complete

Step 4: (Optional) Set an alias in .bashrc/ .zshrc

For .bashrc

echo 'alias winboot="sudo systemctl reboot --boot-loader-entry=auto-windows"' >> ~/.bashrc
source ~/.bashrc

For .zshrc

echo 'alias winboot="sudo systemctl reboot --boot-loader-entry=auto-windows"' >> ~/.zshrc
source ~/.zshrc

Usage:

Open a terminal, and try:

winboot

F.A.Q

  1. I don't see anything about windows in my bootctl list.

This happens when your EFI for each OS is written in their individual drives, the linux drive cannot access the boot info of the windows drive and vice versa, but this can be solved by mounting the windows drive in linux, copying the efi entries to the linux drive.

A detailed how-to is provided here.