I just discovered today that one can create VirtualBox VMDK files that simply reference real partitions on local disks and, needless to say, got pretty excited. "This means I can boot my Windows 7 installation from VirtualBox running in Linux!"
I created the VMDK file like so:
sudo VBoxManage internalcommands createrawvmdk -filename .VirtualBox/Hard\ Disks/Windows\ 7\ Local.vmdk -rawdisk /dev/sdb -partitions 2,4,5
Partition 2 is my EFI boot partition, partition 4 is the Windows msft partition, and partition 5 is the actual NTFS Windows partition. This went off without a hitch, so I chowned the VMDK files to my current user so I can run them with my login user.
This led to the first hitch. I can't seem to add this image to VirtualBox as any user except root, and I'd really like to not run it as root if possible. Is there a workaround?
The next hitch is EFI. I enabled EFI booting in VirtualBox, but whenever I boot the EFI/Microsoft/Boot/bootmgfw.efi image, I see the following code:
BlXmiInitialize failed 0xc000009a
and it doesn't boot. Plus, having to use the actual UEFI shell to get things booting is at best a hassle.
How can I get my actual local Windows 7 installation booting as a non-root user from Linux in VirtualBox?
By adding your Linux user to the disk
group, you can use the VMDK drive as a non-root user:
sudo adduser me disk
I still can't get past the boot error, though.
I figured it might be because of other problems, so I tried using my Windows 7 installation disk for startup repair, but it doesn't seem to even see the Windows installation, as the disk prompts me to simply install Windows.
In order to resolve potential problems with it missing vital information, I did the following to create a VMDK of the entire disk, not just individual partitions:
VBoxManage internalcommands createrawvmdk -filename ".VirtualBox/Hard Disks/Windows 7 Local.vmdk" -rawdisk /dev/sdb
The drive /dev/sdb
is a virtual drive provided by a hardware Intel RAID card (RS2BL080).
According to members of the VirtualBox team and according to the VirtualBox manual:
Note that the VirtualBox EFI support is experimental and will be enhanced as EFI matures and becomes more widespread. While Mac OS X and Linux guests are known to work fine, Windows guests are currently unable to boot with the VirtualBox EFI implementation.
It's pretty lame, but true. Interestingly enough, it'd be arguably more difficult to implement EFI for Mac OSX than for Windows, as basically every modern motherboard has UEFI firmware that "just works™" with Windows, whereas Apple uses their own proprietary EFI implementation designed for their own hardware.
TL;DR: As of the writing of this post, EFI support doesn't really work with Windows in VirtualBox.
Information seems to be very limited regarding windows efi boot error. I can only find 2 links below, which seems be backup of each other, in Russian
It is not addressing VirtualBox Windows EFI boot. However, it demonstrate how to modify Windows Bootmgfw.efi
for dual booting with grub-efi. Maybe you can use that technique to inspect the bootmgfw.efi content and pin-point the actual issue.
However, there is no mentioning of using efi. So they maybe using old style bios.
According to this post, Windows may ask for activation every single time switching boot mode(VM vs Native). I think this understandable, as switching between the mode is like switching to a different motherboard and cpu.
User contributions licensed under CC BY-SA 3.0