Virtualbox cannot boot guest from GPT physical partition


Ding

Virtualbox cannot boot the guest from a GPT physical partition, it stops at a black screen with the cursor in the top left corner (not blinking). Virtualbox version is 5.0.10 x64.

PhysicalDrive0 is the GPT drive, here is the partition information:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands listpartitions -rawdisk \\.\PhysicalDrive0
Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x00 0 /0 /0 0 /0 /0 100 2048
2 0x00 0 /0 /0 0 /0 /0 128 206848
3 0x00 0 /0 /0 0 /0 /0 409372 468992
4 0x00 0 /0 /0 0 /0 /0 409600 838862848
5 0x00 0 /0 /0 0 /0 /0 409600 1677723648
6 0x00 0 /0 /0 0 /0 /0 662640 2516584448
7 0x00 0 /0 /0 0 /0 /0 16288 3873671168
  • Partition #3: Win7 sp1 x64, host
  • Partition #6: Ubuntu14.04.3 x64, Guest
  • Partition 7: Swap

Dual booting via BIOS works fine.

First, boot the computer with Ubuntu 14.04.3 through the BIOS and run the following command to create the .mbr file:

sudo grub-install /dev/sdb
sudo dd if=/dev/sdb of=~/my.mbr

/dev/sdb is the USB flash, after executing these commands, I can boot Ubuntu14.04.3 through this USB falsh.

Then boot the computer with Win7, run the following command at the DOS prompt to create the vmdk file, administrator permission is required:

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk
-filename e:\VirtualBox\a.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 6,7 -mbr
e:\VirtualBox\my.mbr
RAW host disk access VMDK file e:\VirtualBox\a.vmdk created successfully

Start Virtualbox with admin rights, create a virtual machine, Ubuntu 64bit, 4G ram, and use the existing a.vmdk. Start the virtual machine, it stops at a black screen and the cursor is in the upper left corner (not blinking).

I did a lot of searching but didn't find a solution. Can anyone here help me?

Ding

In the end, I managed to do it, although there were still some issues I couldn't explain. I wanted to document it here for people with the same problem so I can remember it in the future.

  1. This parameter is not required when creating the vmdk file -mbr, but make sure not to include the partition where the host OS is located, that is, including the entire physical drive in the vmdk will fail. My last command line (excluding host partition 3) is:

    C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename e:\VirtualBox\Ubuntu.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 1,2,4,5,6,7
    
  2. After creating the guest machine (as described in the question), go to Guest Settings, System, Motherboard, Extended Features, make sure "Enable EFI (special OS only)" is checked.

  3. Boot the guest , then quickly press into the guest's VirtualBox BIOS Delbefore the Windows boot menu is displayed . If you didn't, go to the Windows boot menu, force power off the guest, and restart.

  4. In BIOS, go to Boot Maintenance Manager, Boot Options, Change Boot Order. Move the EFI inner shell to the first option, commit the changes and exit. Press the Reset System menu item in the Boot Maintenance Manager screen. Instructions on how to change the boot order are provided at the bottom of the BIOS screen.

  5. When the guest reboots again, it will enter the EFI Shell (not the Windows boot menu). Now you need to determine which partition is the EFI bootloader. Once inside the shell, it prints the parts and their mixtures, but it doesn't seem to print them all for me. Once you've figured out which is the EFI bootloader, run:

    BLK2:\EFI\ubuntu\grubx64.efi
    

    It will return an error if it is not an EFI bootloader.

  6. Now, the GRUB boot menu will be displayed and we can boot Ubuntu.

Sometimes I find that the guest is still on an empty Ubuntu screen, and sometimes VirtualBox shows an error. I kept restarting the client until it worked. You may also have to reboot from step 3 as it appears your BIOS settings have been lost.

Hope this helps you. I would like to clarify, I have only tested this with: * VirtualBox 5.0.10 x64 * Host OS: Win7 sp1 x64 * Guest OS: Ubuntu 14.04.3 x64 * with the specific disk partitions described.

Be careful as this runs directly on the physical drive. Your data is your responsibility.

Related


Erase the Boot Partition of a GPT Disk in Solaris 11.3

Sharp C I have a 4-way mirror rpoolon a set of GPT disks (GPT used due to disk size over 2TB) running Solaris 11.3 on x86 hardware . Disks 1 and 2 are the "primary" operating systems. Disks 3 and 4 exist intermittently because they are offsite (offline) backup

Access virtualbox guest from LAN

Tom Kaho All the tutorials and guides I've seen about accessing remote desktops in virtualbox claim it's very easy, but I still get errors. Every time I try to access a virtualbox client running Arch Linux, I get standard error: Remote Desktop cannot connect t

Wireshark cannot view traffic from VirtualBox guest on Windows 7

San Diego I've been trying to capture some traffic from a virtual machine using Wireshark. The settings are: Windows 7 host Ubuntu guest virtual box 4 I send some packets from the guest to the host or another IP in the host's LAN. The packets get there, but Wi

How to boot into UEFI Shell on VirtualBox with macOS guest?

dagger I'm running VirtualBox 6.0.10 on an iMac (Mojave) and have prepared a macOS High Sierra VM from scratch using VirtualBox. The VM is running fine, but I can't update the guest OS from 10.13.4 to 10.13.6. From what I understand, the reason for this is tha

VirtualBox Windows GUEST cannot "see" local network

Clay Nichols I have setup VirtualBox on Windows 7 HOST on Windows XP Guest. The guest can access the Internet and the host, but not the network the host is on. I am using the default NAT network in "Guest Settings". Any ideas? LPC chip NAT networks will place

VirtualBox - Bridged Connection - Guest cannot access internet

alex 44 I have installed CLI Debian 3.16.7 as guest in VirtualBox 5.0.24 on Ubuntu-Gnome 16.04 host . I set the network to the one named in the vm preferences because I want to have an interconnection between multiple virtual machines later on, and a connectio

Virtualbox Vagrant Guest cannot use host DNS

Micardo On my company's Windows 10 host, I can run it successfully ping a.b.c. I have vagrant guests on Virtualbox and when I call I get ping a.b.can errorUnknown host I found that I should use natdnshostresolver1 on. But that didn't help me. I'm using the net

Virtualbox with rawdisk "Cannot read from boot media"

Sean Lee I currently have 2 NVMe ssds on my computer, one with windows installed and the other with ubuntu installed (hence dual boot) I want to boot to ubuntu using virtualbox, I did the following Create the vmdk file with the following command VBoxManage.exe

Erase the Boot Partition of a GPT Disk in Solaris 11.3

Sharp C I have a 4-way mirror rpoolon a set of GPT disks (GPT used due to disk size over 2TB) running Solaris 11.3 on x86 hardware . Disks 1 and 2 are the "primary" operating systems. Disks 3 and 4 exist intermittently because they are offsite (offline) backup

Access virtualbox guest from LAN

Tom Kaho All the tutorials and guides I've seen about accessing remote desktops in virtualbox claim it's very easy, but I still get errors. Every time I try to access a virtualbox client running Arch Linux, I get standard error: Remote Desktop cannot connect t

Wireshark cannot view traffic from VirtualBox guest on Windows 7

San Diego I've been trying to capture some traffic from a virtual machine using Wireshark. The settings are: Windows 7 host Ubuntu guest virtual box 4 I send some packets from the guest to the host or another IP in the host's LAN. The packets get there, but Wi

Wireshark cannot view traffic from VirtualBox guest on Windows 7

San Diego I've been trying to capture some traffic from a virtual machine using Wireshark. The settings are: Windows 7 host Ubuntu guest virtual box 4 I send some packets from the guest to the host or another IP in the host's LAN. The packets get there, but Wi

Virtualbox with rawdisk "Cannot read from boot media"

Sean Lee I currently have 2 NVMe ssds on my computer, one with windows installed and the other with ubuntu installed (hence dual boot) I want to boot to ubuntu using virtualbox, I did the following Create the vmdk file with the following command VBoxManage.exe

Erase the Boot Partition of a GPT Disk in Solaris 11.3

Sharp C I have a 4-way mirror rpoolon a set of GPT disks (GPT used due to disk size over 2TB) running Solaris 11.3 on x86 hardware . Disks 1 and 2 are the "primary" operating systems. Disks 3 and 4 exist intermittently because they are offsite (offline) backup