4

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

boot error

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?

Update

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).

6
  • Did you try installing Win 7 into that partition, within Virtualbox?
    – John Siu
    Jan 23, 2013 at 19:53
  • What do you mean? This is a VMDK image which is pointing to my real Windows 7 installation on disk. I can boot into Windows 7 just fine on physical system startup, it's just not working in VirtualBox. I'm beginning to think it's an EFI error. Jan 23, 2013 at 20:08
  • Does it give you the same error with the new VMDK setup?
    – John Siu
    Jan 23, 2013 at 21:35
  • Yes, it does give the same error. Jan 23, 2013 at 22:15
  • 1
    That may very much be bios/efi info different as the 2 efi, vb and mb is reporting very different thing to Bootmgfw.efi. If you have a spare HD, we can test by setting it up as another VMDK, then install Win7 on it with Virtualbox, then bootup the machine with that drive, very likely it will show the same error.
    – John Siu
    Jan 23, 2013 at 22:26

2 Answers 2

2

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.

1
  • If I remember correctly virtualbox actually removed(used to be an option) OS X from the OS option per Apple request.
    – John Siu
    Jan 28, 2013 at 23:46
0

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

  1. http://habrahabr.ru/post/160655/ Google Translate
  2. http://savepearlharbor.com/?p=160655 Google Translate

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.

Success Stories

  1. This post, claiming QEMU, KVM and VirtualBox success.
  2. This post, claiming KVM and VMWare Workstation(non-free) can do it with ease.

However, there is no mentioning of using efi. So they maybe using old style bios.

Potential Problem - Activation

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.

2
  • Very interesting. I've just made edits to the original post: I think there may be a problem with reading the disk that VirtualBox is having. Jan 23, 2013 at 21:07
  • I am suspecting the issue is due to the difference between VirtualBox bios(bios the VM "see") and the motherboard bios. I am guessing Win7 installation process modified bootmgfw.efi or related boot file with bios specific info.
    – John Siu
    Jan 23, 2013 at 21:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .