Linux – Boot a physical disk with EFI in VirtualBox Ubuntu 18.04 host

bootlinuxubuntu 18.04virtualboxwindows 10

I used to use legacy BIOS booting on this machine to dual-boot Ubuntu 16.04 and Windows 10 across three hard drives. I used GRUB to boot to Ubuntu on an SSD and HDD combo and Windows 10 on it's own SSD, but I could also boot that Windows 10 disk in a Virtual Machine in Ubuntu.

When I upgraded to Ubuntu 18.04 I reinstalled both Ubuntu and Windows as a UEFI install. Eveything works as expected except I can no longer use the physical Windows 10 drive in Virtualbox.

I've tried tweaking permissions for days but ultimately I just get dumped to a GRUB recovery shell on boot. I can boot the virtual machine to a live disk and access the drive just fine.

I'm really not familiar with EFI boot partitions or how they work at all. I'm not even sure if I need an EFI partition for each operating system, but I would like to be able to use the Windows 10 disk in other machines without the Ubuntu hard disks.

Can anyone tell me what I am doing wrong?

This is my set up. /dev/sda is my home and var mount points. sdc is my root. sdb is the Windows disk.

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 1D529F06-982A-4C10-86F1-9AABFA271304

Device          Start        End    Sectors   Size Type
/dev/sda1        2048   16777215   16775168     8G Linux swap
/dev/sda2    16777216   25165823    8388608     4G Linux filesystem
/dev/sda3    25165824 1659922431 1634756608 779.5G Linux filesystem
*** IGNORE THESE PARTITIONS ***
/dev/sda4  1659922432 1695938559   36016128  17.2G Linux filesystem
/dev/sda5  1695938560 1704327167    8388608     4G Linux filesystem
/dev/sda6  1704327168 1828964351  124637184  59.4G Linux filesystem
/dev/sda7  1828964352 1926782975   97818624  46.7G Microsoft basic data


Disk /dev/sdb: 238.5 GiB, 256060514304 bytes, 500118192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C76B0EBA-27D6-4FE0-A92F-F78276F26981

Device       Start       End   Sectors   Size Type
/dev/sdb1     2048   1023999   1021952   499M Windows recovery environment
/dev/sdb2  1024000   1228799    204800   100M EFI System
/dev/sdb3  1228800   1261567     32768    16M Microsoft reserved
/dev/sdb4  1261568 500117503 498855936 237.9G Microsoft basic data


Disk /dev/sdc: 29.8 GiB, 32017047552 bytes, 62533296 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D7616B5D-A0FA-4ACD-9122-DAB9BA2F21ED

Device      Start      End  Sectors  Size Type
/dev/sdc1    2048   411647   409600  200M EFI System
/dev/sdc2  411648 62531583 62119936 29.6G Linux filesystem

Best Answer

I found out you just need to press delete as the VM boots to enter the BIOS then, manually add the EFI boot option for Windows.

Related Question