Enabling booting of Windows 10 as a VM under Linux via raw disk access - sandro-mancuso/Tech-documentation GitHub Wiki

BIOS Changes:

  • AHCI instead of RAID
  • disable UEFI security

Install Vbox from PPA

Install the extension pack from website

Make sure you enable usb2.0

Prepare the VMDK disk:

sudo VBoxManage internalcommands createrawvmdk -filename win10pro.vmdk -rawdisk /dev/nvme0n1 -partitions 1,2,3,4

  • This assumes that Partition 1 is the EFI, and partitions 2-4 are part of windows.
  • Because we're using logical (GPT?) partitions, you have to specify which partitions out of nvme0n1 to include.
  • By excluding the Ubuntu partition, you remove the risk of trying to start the same OS already running
  • You can either specify path in the -filename flag above, or, like I do, just move to the desired directory first.

Create a VM for Windows 10. Here are pertinent changes to make

  • Give it 1 vCPU at 100%
  • at least 4GB ram
  • set flag for hardware clock in UTC
  • set flag to enable EFI
  • Give it 256mb display ram for Direct3D, and also set the scale factor (4k/high-res/"retina" type displays

Get into BIOS to change the default boot, so that it boots from windows. Once you know it works, do the following:

  • open /boot/efi/EFI/ubuntu/grub.cfg
  • Add a conditional to test if ubuntu is present (which it is not when booting VM), and if not present, to default to windows partition:

if [ -f $prefix/grub.cfg ] then configfile $prefix/grub.cfg else insmod chain set root=(hd0,gpt1) chainloader /EFI/Microsoft/Boot/bootmgfw.efi boot fi

Other sources:

https://github.com/rcasero/doc/wiki/Ubuntu-linux-on-Dell-XPS-15-(9560)

https://bbs.archlinux.org/viewtopic.php?id=223056

https://wiki.archlinux.org/index.php/Dell_XPS_15_9560