Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Discussions about using Windows guests in VirtualBox.
Post Reply
rfkrocktk
Posts: 8
Joined: 10. Oct 2009, 22:31
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP

Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by rfkrocktk »

I've got a pretty complicated setup, but I'll work through bringing you up to speed. Here's what my disk, /dev/sdb, looks like:

Code: Select all

Model: INTEL RS2BL080 (scsi)
Disk /dev/sdb: 1020GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt

Number  Start   End     Size    File system  Name                          Flags
 1      17.4kB  5000kB  4983kB               primary                       bios_grub
 2      5243kB  530MB   524MB   fat32                                      boot
 3      530MB   752GB   752GB   btrfs
 4      752GB   752GB   134MB                Microsoft reserved partition  msftres
 5      752GB   1020GB  268GB   ntfs         Basic data partition

The disk is a hardware RAID virtual device. Partition 1 is unformatted space for a legacy GRUB BIOS bootloader no longer being used. Partition two is my FAT-32 EFI boot partition. (This is how I'm booting. I have rEFInd as a boot manager allowing me to switch between Windows 7 and my Linux installation on boot) Partition 3 is my main Linux filesystem. Partition 4 is the msftres partition used by Windows 7. Finally, partition 5 is the NTFS Windows boot drive. It contains Windows 7 64bit SP1. I can boot to either my Linux installation or to my Windows 7 installation on physical machine startup, so boot definitely works. GRUB BIOS boot works too, but only for Linux, as Windows 7 in installed in GPT/EFI mode.

What I'd like to do is to simply boot my Windows 7 installation on /dev/sdb5 from within my Linux operating system using VirtualBox. I've done the following to get things rolling:

Code: Select all

$ sudo usermod -a -G disk myuser
That allows me to access my disks as a non-root user. Followed by a log out and a log back in...

Code: Select all

$ id
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),6(disk),24(cdrom),27(sudo),46(plugdev),109(lpadmin),123(sambashare),124(vboxusers)
Great, the groups modification worked. Now, let's create a raw disk file:

Code: Select all

VBoxManage internalcommands createrawvmdk -filename ".VirtualBox/Hard Disks/Windows 7 Local.vmdk" -rawdisk /dev/sdb
Cool, now, add that to the Windows 7 virtual system in the VirtualBox UI and then enable EFI booting.

Now, onto the problematic stuff...

Ok, so now that our Windows 7 64bit virtual system is ready to go, let's boot.

Image

Ok, fine, so that's not working, so let's type "exit" and get to the console. I select "Boot Maintenance Manager," then "Boot from File," and I select "ESP:/EFI/Microsoft/Boot/bootmgfw.efi", and then I see this terrible, terrible screen:

Image

What is this problem being caused by and how do I get around it? I feel like I'm so close to booting my Windows 7 installation from within my Linux installation.

PS: I've tried also using the Windows 7 installation CD to try and do a startup repair in case something was wrong there, but it prompts me to reinstall Windows, apparently not finding the Windows installation at all. Additionally, I've verified that it's definitely working, as it CAN boot into the rEFInd manager, but I get the same code above when I then try to boot into Windows.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by noteirak »

This EFI custom boot is not a Virtualbox problem and is out of scope of this forum. You would have the same issue on real hardware, therefore I don't think you'll get any support here about this.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
rfkrocktk
Posts: 8
Joined: 10. Oct 2009, 22:31
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by rfkrocktk »

EFI custom boot?

On my actual hardware, both booting directly from the Microsoft Windows Boot Manager and chain-loading it through rEFInd works great. This seems to definitely be a bug with the VirtualBox EFI implementation.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by noteirak »

rfkrocktk wrote:EFI custom boot?
Possibly some missuse of the words on this one - what I meant is that I am not aware that Microsoft supports this - hence my use of the "custom" word.
rfkrocktk wrote:On my actual hardware, both booting directly from the Microsoft Windows Boot Manager and chain-loading it through rEFInd works great. This seems to definitely be a bug with the VirtualBox EFI implementation.
If your setup doesn't work only on Virtualbox, and you can reproduce all the steps precisly, feel free to submit a bug report using the bug tracker, and post back here the ticket link
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by Perryg »

Section 3.12 of the users manual.
<Snip>
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.
That said I was able to make it work but it is very nasty and not something I wish to get into. It took a lot of scripting and nasty booting with RAW and such. If you understand the process you may get it to work but I just didn't see the benefit other than seeing if it could be done. One of the biggest issues was the ISO standard that Windows used. Not the same as Mac or Linux EFI and once you figure out how to work around that the install should work.
rfkrocktk
Posts: 8
Joined: 10. Oct 2009, 22:31
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by rfkrocktk »

Perryg wrote:Section 3.12 of the users manual.
<Snip>
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.
That said I was able to make it work but it is very nasty and not something I wish to get into. It took a lot of scripting and nasty booting with RAW and such. If you understand the process you may get it to work but I just didn't see the benefit other than seeing if it could be done. One of the biggest issues was the ISO standard that Windows used. Not the same as Mac or Linux EFI and once you figure out how to work around that the install should work.
Do you have any guide for getting started on it? I'd really like to get it working if at all possible.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by Perryg »

Not really. Everything I did was by the seat of my pants. I failed more time than I succeed and as such I have no notes. Its just a frame of mind. If you want it to work and stick with it you should be able to make it work, but only if you have more than basic knowledge of UEFI/EFI. VirtualBox really had nothing to do with it. Google installing windows EFI like I did and pull in information form everywhere you can.

That said since Windows EFI was not intended to work in VirtualBox there really is no support, until the DEVs have time to make it work.
rfkrocktk
Posts: 8
Joined: 10. Oct 2009, 22:31
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by rfkrocktk »

Will do. The nightmare that is EFI seems to be a recurring one.

It's amazing to me that it's so difficult to get the Windows EFI boot working. I'd assume that it'd be the most compatible boot loader out there. All UEFI motherboards don't have much trouble booting it.
RushPL
Posts: 5
Joined: 26. Feb 2012, 19:55

Re: Booting a Local Windows 7 64bit EFI from a Raw Disk VMDK

Post by RushPL »

I have set up my new PC with dual-boot UEFI (>2TB partitions) and I wanted to get my Windows bootable from native partition and VirtualBox .. have you been able to make it work @rfkrocktk ?
Post Reply