Virtualbox fail to bootup guest from GPT physical partition, it stop at a black screen with a cursor(doesn't blink) at the left top corner. Virtualbox version is 5.0.10 x64.
PhysicalDrive0 is a GPT drive, Here is 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
Dual boot via BIOS works fine.
Firstly, boot up computer with Ubuntu14.04.3 via BIOS, run below commands to create .mbr file:
sudo grub-install /dev/sdb
sudo dd if=/dev/sdb of=~/my.mbr
/dev/sdb is a USB flash, and after these commands, I can bootup the Ubuntu14.04.3 via this USB falsh.
Then boot up computer with Win7, run below commands to create vmdk file, in a DOS prompt, with administrators persmission:
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
Launch Virtualbox with administrators permission, create a virtual machine, Ubuntu 64-bit, 4G ram, use existing a.vmdk . Start the virtual machine, it stop at a black screen with a cursor(doesn't blink) at the left top corner.
I did a lot of search, but didn't get a solution. Anybody here could help me this ?
Finally, I managed to accomplish this, though there are still some questions I am not able to explain. I would like to record it here for people who get the same problem, and so I can remember in the future.
When creating the vmdk file, the -mbr
parameter is not necessary, but be
sure NOT to include the partition in which the host OS resides, that
is, including whole physical drive in vmdk will fail. My final
command line (with host partition #3 excluded) was:
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename e:\VirtualBox\Ubuntu.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 1,2,4,5,6,7
After creating the guest machine (as described in the question), go to guest Settings, System, MotherBoard, Extended Features, be sure to keep "Enable EFI (special OSes only)" checked.
Start the guest, and quickly press Del to enter the guest's VirtualBox BIOS before it shows the Windows boot menu. If you failed to do so and got to the Windows boot menu, forcibly turn the power off to the guest and start again.
In BIOS, go to Boot Maintenance Manager, Boot Options, Change Boot Order. Move EFI Internal Shell to the first option, Commit Changes and Exit. Press Reset System menu item in Boot Maintenance Manager screen. There are instructions on how to change the boot order at the bottom of the BIOS screen.
When the guest reboots again, it will enter EFI shell (instead of Windows boot menu). Now you need to work out which partition is the EFI bootloader. Upon entering the shell it prints out the partiions and their alises, but it didn't seem to print them all out for me. Once you've worked out which is your EFI bootloader, run:
BLK2:\EFI\ubuntu\grubx64.efi
It will return an error if it's not the EFI bootloader.
Now the GRUB boot menu displays and we can launch Ubuntu.
Sometimes I find the guest remains on an empty Ubuntu screen, sometimes VirtualBox displays an error. I keep restarting the guest until it works. You may also have to restart from step 3 as it seems your BIOS settings are lost.
Hope this help you somewhat. I would like to clarify that I only tested this under: * VirtualBox 5.0.10 x64 * host OS: Win7 sp1 x64 * guest OS: Ubuntu 14.04.3 x64 * with specific disk partitions as described.
Be very careful as this operates directly on the physical drive. Your data is your responsibility.