Windows 10/11 physical & virtual dual boot on Steamdeck (Virtualbox)

Recently upgraded the SSD to 512GB and remade the SteamOS. With such clean system, started to re-investigate the Windows physical & virtual dual boot to get rid of the cons of the KVM method (Link: https://okoken.github.io/post/windows-1011-physical-and-virtual-dual-boot-on-steamdeck/).

To simply conclude, this method meets all my needs and already used in my daily life.

πŸ”¨<2nd trial with Virtualbox>
Inspiring by @Lampa183, found the way to install Virtualbox in SteamOS easily.
https://www.reddit.com/r/SteamDeck/comments/y4n7k6/macos_catalina_on_steam_deck_steamos_virtualbox/

πŸ’‘ Pros:
- no USB SD card reader required anymore
- out-of-the-box features provided by Virtualbox, e.g. shared folder
πŸ’‘ Cons:
- need to run script to reinstall it after every SteamOS update

πŸ’‘ Requirements:

  • SD card

πŸ’‘ Major steps:

  1. Prepare Windows-To-Go in VHD format. I am using MBR option, but believe GPT options works the same (and even better).

    hints: Rufus is not supporting WTG in VHD. Here is a Chinese tool with English support.
    Home site: https://bbs.luobotou.org/thread-761-1-1.html
    Download link: https://dl.luobotou.org/wtga5610.zip

  2. To install Virtualbox (will not survice after SteamOS update)
    2a. Install packages [linux-neptune-headers virtualbox-host-dkms virtualbox] via pacman.

    hints: Instructions for Steamdeck pacman can be easily found if you search. Just be careful to use "pacman -Sy [package1 package2 ...]" as per @Philipp Richter, Steam Deck Tricks (https://gitlab.com/popsulfr/steam-deck-tricks).
    2b. Configure Virtualbox following Archlinux wiki (https://wiki.archlinux.org/title/VirtualBox), and reboot.
    hints: minimum commands as below.

    modprobe vboxdrv
    gpasswd -a deck vboxusers
    
  3. To make the VHD bootable, inspired by @pbatard / uefi-ntfs (https://github.com/pbatard/uefi-ntfs)
    3a. To mount VHD in another Windows. You can choose to mount in another PC or in a another VM.
    3b. Create a new partition at the end of the VHD with any disk manager e.g. DiskGenius. Format and size should be the same as the EFI partition in the SD card.
    3c. Copy all the contents from the SD card EFI partition to the new VHD partition you just created.
    3d. BOOTICE to load EFI/Microsoft/Boot/BCD in the new partition, and change the boot path from VHD to the 1st partion in the VHD.
    I don't have screenshots, but this step is tricky so borrowed some screenshot from somewhere else. Only below parts in the red circles need to be changed.



  4. Create new VM in Virtualbox with the VHD, and with "Enable EFI" option checked in the Settings->System.

    Now the Windows should be bootable via Virtualbox and physically.
    Remember to backup your VHD regullarly, as you know some SD has bad performance and can easily corrupt.

πŸ’‘ Optional steps and tips

  1. For easy backup, mostly we keep the VHD as small as possible, e.g. around 64GB with dynamic size. Therefore when we boot the Windows physically, typically we will have the VHD mount as C:\ and the real SD card as D:.
    In this case it is a good idea to always install applications in D:, and to reallocate some folders (Desktop, Downloads, Documents, etc.) to the D:. There are many instrutions and below is one:

    https://www.partitionwizard.com/clone-disk/win10-move-user-folder-to-another-drive.html

But it is quite a headache to let the Windows still access the D:\ when boot via Virtualbox. Below is the method.
1a. Add the whole SD card as "Shared Folder" in VM settings, with Full access, Auto Mount, and assign a Mount Point e.g. Z:\.
1b. Create a new virtual hard disk for Windows VM, and boot up the Windows VM to create partition on it. Assign it as D:\.
1c. Use mkdir command to create hard link from Z:\ to D:\. Without this hardlink you will not be able to run .exe requiring Admin permission. Inspired by @Casey Dwayne,

https://forums.virtualbox.org/viewtopic.php?t=80854#:~:text=mklink%20%2Fd%20TempDir,To%5CDesired%20Folder%22

  1. !!! The mouse driver in the Virtualbox Guest Additions will crash Windows. If you use Virtualbox Guest Additions, follow below steps to uninstall the mouse driver inside.
    2a. Use command line to direct the path to the Virtualbox Guest Additions CD. Run

     .\VBoxWindowsAdditions.exe /extract /D=path_to_some_where
    

    2b. Direct to the path_to_some_where you extracted the files. Run

     .\VBoxDrvInst.exe driver uninstall .\VBoxMouse.inf
    
  2. To automount the SD card NTFS partition at SteamOS bootup. Below are the instructions I used @Chinballs Gaming.

    https://www.youtube.com/watch?v=Z6dhdlqtPS4
    https://www.youtube.com/watch?v=elusccCzvOc (in case you made anything wrong and cannot boot your SteamOS)

  3. For USB3.0 the Virtualbox Extension Pack is required. Below are the commands to install it easily. (will not survice after SteamOS update)

    echo "Downloading Virtualbox Extension Pack"
    curl https://download.virtualbox.org/virtualbox/$(vboxmanage -v | cut -dr -f1)/Oracle_VM_VirtualBox_Extension_Pack-$(vboxmanage -v | cut -dr -f1).vbox-extpack -o Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack
    
    echo "Installing Virtualbox Extension Pack"
    echo y | VBoxManage extpack install --replace ./Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack
    
  4. For all the steps which will not survive after SteamOS update, good to put every commands in shell bash so that you can run them easily after every SteamOS. One example by @muzzol/SD_packages-pacman.sh:

    https://gist.github.com/muzzol/9f559c92a7f1132fcd65b211a86759b2

  5. Timezone is another issue between SteamOS and Windows. Here is a method to fix it from @HoodedHorse.

    https://www.reddit.com/r/SteamDeck/comments/uxnukk/problem_with_dualbooting_windows_and_time_zones/#:~:text=open%20up%20a,t%20REG_DWORD%20%2Ff

  6. It is annoying that the EFI partitions are visible in Windows or SteamOS. DISKPART command under Windows can remove the volumn lable to avoid showing it in Windows, and "set id=EF" can avoid showing it in SteamOS, inspired by @Ahze85283:

    https://superuser.com/questions/459434/how-to-make-a-hidden-partition-visible

  7. It would be great if I can use my bluetooth mouse / keyboard in both the SteamOS and the physical Windows without reconnection. @Mario Olivio Flores provided the method with psexec.

    https://unix.stackexchange.com/questions/255509/bluetooth-pairing-on-dual-boot-of-windows-linux-mint-ubuntu-stop-having-to-p#:~:text=You%20need%20psexec,show%20this%20values

  8. In case you want better network adapter performance in the Windows VM e.g. for NAS access, it would be worthy to install the virtIO driver for the virtio-net (Virtualbox VM -> Settings -> Network -> Adapter1 -> Advanced -> Adapter Type). Driver is here:

    https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/