Migrate windows to virtualbox - issues at boot

Discussions about using Windows guests in VirtualBox.
Post Reply
Ned
Posts: 3
Joined: 1. May 2024, 10:24

Migrate windows to virtualbox - issues at boot

Post by Ned »

I'm trying to port my current Windows 10 installation on a VM on a Linux host. I tried in two ways with no success:

1. Via Disk2VHD, converting the .VHDX image to .VDI through virtualboxmanage.

Then loading the .VDI file to a new instance choosing the "Use an Existing Virtual Hard Disk File" option enabling EFI (special OSes only).
Done this at start the virtual machine drops on Shell

Code: Select all

UEFI Interactive Shell v2.2
EDK II
EFI v2.70 (EDK II, 0x00010000)
Mapping table
BLK0: Alias(s):
PciRoot(0x0)/Pci(Ox1F,0x2)/Sata(0x0,0XFFFF,0x0)
Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Shell>
I exit shell and navigate to Boot Maintenance Manager > Boot Options > Change Boot Order>Uefi Vbox Harddisk
No change, it stays on Shell.

2. Using Raw Disk Access:

- I copy all related Windows installation partitions on a separate drive with GParted
- Make a .VMDK file following section 9.7.1.2. of Virtualbox manual makign sure to identify the correct partitions for boot and data.
- for some reason the .VMDK does not get read (VERR_ACCESS_DENIED). Among the possible causes of this there is data corruption. I run file system check/repair on Windows before doing all this.

Code: Select all

Result Code:
VBOX_E_FILE_ERROR (0X80BB0004)
Component:
MediumWrap
Interface:
IMedium {ad47ad09-787b-44ab-b343-a082a3f2dfb1}
Callee:
IVirtualBox {7682d5eb-f00e-44f1-8ca2-99d08b1cd607}
Callee RC:
VBOX_E_OBJECT_NOT_FOUND (0X80BB0001)
- I convert .VMDK to .VDI via virtualboxmanage and load it as Existing Virtual Hard Disk File option" enabling EFI (special OSes only).
- I start the virtual machine

Code: Select all

BdsDxe: loading Boot0001 “UEFI VBOX HARDDISK VB892112c4-e3d579aa “ from PciRoot(0x0)/Pci(0xD, 0x0)/Sata(0x0,0xFFFF,0x0)
BdsDxe: starting Boot0001 “UEFI VBOX HARDDISK VB892112c4-e3d579aa “ from PciRoot(0x0)/Pci(0xD, 0x0)/Sata(0x0,0xFFFF,0x0)
error: unknown filesystem.
Entering rescue mode...
grub rescue>
To rule out any other possible issues with Virtulbox, at a point I decided to install from scratch a Windows 11 version. Process was successful.

Now, Windows 11 was a fresh install so I needed to have an .ISO. As for existing Windows migration in none of the guides I followed I seem to remember the use of a .ISO image to boot what is in .VDI/.VMDK but I suspect I may need one.

Any ideas?
multiOS
Volunteer
Posts: 939
Joined: 14. Sep 2019, 16:51
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WIN11,10, 7, Linux (various)
Location: United Kingdom

Re: Migrate windows to virtualbox - issues at boot

Post by multiOS »

One frequent cause of migration failure is not copying all necessary partitions from the 'old' system, but your description suggests that you avoided that 'gotcha'.

So, one question for now: What is the partition style of the original installation you are copying from? i.e. Is it MBR or GPT? UEFI only understands GPT, so if the image was created on an MBR system it's not going to work if you select the UEFI option for the VM.

Note: If you are successful in migrating the existing Windows system it will lose the original activation as soon as the 'hardware' change is recognised by Microsoft's servers, so the VM will need to be re-activated. This sometimes means that it may be easier to start with a clean Windows installation and transfer the activation (if allowed); then reinstall only the required software and migrate your user data.
Ned
Posts: 3
Joined: 1. May 2024, 10:24

Re: Migrate windows to virtualbox - issues at boot

Post by Ned »

I suspect I may need one.
I removed the .ISO after installation and Windows 11 it boots normally. So, no, it doesn't seem so.
So, one question for now: What is the partition style of the original installation you are copying from?
Every time I run the boot loader at boot there is a section mentioning EFI, plus in GParted the boot partition is labeled as fat32/boot/efi. I remember more clues about UEFI on BIOS as well. Do these clues make it safe to assume it is a GPT?
Windows system it will lose the original activation
I am aware of it. I'll be happy to deal with that if I manage to make it boot.
fth0
Volunteer
Posts: 5690
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Migrate windows to virtualbox - issues at boot

Post by fth0 »

FWIW, GParted will show if the original media uses MBR or GPT formatting.
Ned
Posts: 3
Joined: 1. May 2024, 10:24

Re: Migrate windows to virtualbox - issues at boot

Post by Ned »

I check with parted -l

Code: Select all

Model: Samsung SSD 970 EVO Plus 500GB (nvme)
Disk /dev/nvme0n1: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  556MB  555MB   ntfs            Basic data partition          hidden, diag, no_automount
 2      556MB   661MB  105MB   fat32           EFI system partition          boot, esp, no_automount
 3      661MB   677MB  16,8MB                  Microsoft reserved partition  msftres, no_automount
 4      677MB   250GB  250GB   ntfs            Basic data partition          msftdata
Wonder why in Raw Disk Access it does not recognize the file system. Is there any chance the partitions got corrupted during GParted copying? I merely copied those partition you see listed above.

When I mede the .VMDK if I remember correctly I selected

Code: Select all

 
 2      556MB   661MB  105MB   fat32           EFI system partition          boot, esp, no_automount
 4      677MB   250GB  250GB   ntfs            Basic data partition          msftdata
 
Should I have added all of them?

The .VMDK didn't go through and I had to convert it in .VDI. Could this be one more reason for corruption?
Post Reply