[solved] Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Discussions related to using VirtualBox on Windows hosts.
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

[solved] Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

Host computer: Windows 10.

I'm trying to boot a Virtual Machine using a vmdk file made from a bootable Ubunbu hard disk:

Code: Select all

RAW host disk access VMDK file ~\RAID.vmdk created successfully.
The createrawvmdk seems to work, but when I start the virtual machine, it boots into "UEFI Interactive Shell 2.2," and I can't get out of it. I attempted to edit the startup.nsh file, but that crashes the machine when I reset, and does not save any changes.

My question is: what is the best way to virtualize an existing, bootable Linux partition from within Windows 10?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by mpack »

Why are you enabling EFI? It doesn't sound like the old PC used it (being Win7), which means that the VM doesn't need it either.

Also, raw VMDK is a stopgap only. It would be better to convert the disk to a dynamic VDI which will be more compact and can be located on any host drive with enough space (way less than a raw image needs). It's a pity that you made a raw image in the first place: almost anything would work better! E.g. a Macrium Reflect (Free) image that you could restore into a VM.

You can convert a VMDK to dynamic VDI using CloneVDI. Be sure to enable the "Compact" option.
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

I enabled EFI because if I did not, I get "FATAL: INT18: BOOT FAILURE" and I am unable to proceed. I read in the VirtualBox documentation that raw disk access is done using vmdk files. Is that out of date?

The system I want to virtualize has its own disk. It is bootable from BIOS. It is a basic Ubuntu installation, whatever the latest patch is. I want to be boot this system inside of Windows 10 using VirtualBox. This OS will keep its own physical disk and I can modify it from inside by booting into it. Given that, what is the best way to virtualize it inside of WIndows 10?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by mpack »

cecoppola wrote:I enabled EFI because if I did not, I get "FATAL: INT18: BOOT FAILURE" and I am unable to proceed. I read in the VirtualBox documentation that raw disk access is done using vmdk files. Is that out of date?
No, that's not out of date, but it also doesn't have any connection to EFI.

Did you image the entire drive? This will never work if all you have is a partition image.

It would be helpful to open the VMDK in CloneVDI and show the header - post a screenshot. We can tell from that if the image is using MBR, GPT or no partitioning (the latter would not be legal).

Btw, the fact that "createrawvmdk" seemed to work means nothing. It will create a VMDK descriptor for any file you ask it to - e.g. try it on an Excel spreadsheet file. All the VMDK descriptor says is: "here is this raw image file, it is this size". VirtualBox does not validate the file contents. The purpose of the descriptor is to allow VirtualBox to associate metadata such as UUID with the image.
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

I made an image of the entire disk. I don't know how to do it only for a partition. It's easy to make a new vmdk if I need to.

Enabling EFI fixed the "INT18" error. EFI seems to enable some users to boot by modifying the startup script. This option is easy to enable and disable, so I can just turn it off when necessary. It's related in that I have not read another solution to the fatal boot error.

I am not familiar with clonevdi. If vmdk is not the best way to boot into an existing disk, what is the best way?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by mpack »

I gave you a link to CloneVDI above.
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

I don't understand what that is.

What is the simplest way to make a virtual instance of an existing physical OS disk?
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by mpack »

cecoppola wrote:I don't understand what that is.
It's a tool which clones virtual disk images into VirtualBox's native VDI format. The importance here is that it includes a "Compact" option which discards unused and deleted areas from the disk image, which is something you can only do with a dynamic image rather than raw VMDK. It also has some diagnostics, for example the "Partition Info..." feature that will tell us if your disk uses MBR or GPT or is a bare partition. It also has a readme (text and PDF) containing usage instructions.
cecoppola wrote:What is the simplest way to make a virtual instance of an existing physical OS disk?
There's no advantage in starting again from scratch. Just run CloneVDI to clone the VMDK to VDI, and do enable the Compact option as I already said.
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

"Starting from scratch" suggests that a significant amount of time is required to type in two commands and start an instance of an OS. None of this is time-consuming to do, and the best thing would be to know what is the proper way to boot from an existing OS disk. I'm not attached to this method, or even this software. I read the official documentation and it didn't work, so what would actually save me time is knowing what the proper way to do this is before I spend time downloading more software that may be totally unnecessary.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by scottgus1 »

cecoppola wrote:spend time downloading more software that may be totally unnecessary.
You of course can do what you want to do. But the wise, when they come to experienced advisers, don't poo-poo the advice. :wink:

Your first question:
cecoppola wrote:what is the best way to virtualize an existing, bootable Linux partition from within Windows 10?
The best way is bring the OS on the physical disk into a virtual disk, not to use raw disk access.
mpack wrote:raw VMDK is a stopgap only. It would be better to convert the disk to a dynamic VDI
Question answered.

Raw disk access is fraught with danger: On Windows hosts you must run the VM as Administrator, which opens further vectors for malware to infect the host. If the host one day decides to enumerate the physical drives differently, the raw disk vmdk will point at a different disk, resulting in data damage. Raw disk access is for experts only (even the manual says that), and we don't help folks do raw disk access.

You later changed your question to force using raw disk:
cecoppola wrote:The system I want to virtualize has its own disk. ... This OS will keep its own physical disk and I can modify it from inside by booting into it. Given that, what is the best way to virtualize it inside of WIndows 10?
This restriction requires raw disk access. Per the above, we don't help folks do raw disk access. A mistake made will destroy the host OS or the disk's data.

The method described in the manual using the vmdk descriptor file https://www.virtualbox.org/manual/ch09.html#rawdisk is the only way to do raw disk access in Virtualbox.

If you are willing to forget about raw disk access and virtualize the drive's OS to a complete virtual disk file on the host (and you may be able to add another disk to the host to hold the virtual disk file so the host does not lose disk space), the easiest method to do that is with CloneVDI, read the instructions with that program.

The boot failure or EFI shell issues may happen no matter what method for running the disk's OS you use. Once any computer, physical or virtual, turns on, it looks for an OS and tries to run it. If the disk's boot loader is an unexpected configuration, errors may happen.

If the original computer for that drive was UEFI, the VM should use EFI. If the original computer for that drive was legacy BIOS, the VM should use BIOS. Further glitches after using the correct boot environment will have to be fixed by web-searching the error and fixing the boot loader directly.
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

scottgus1 wrote:You later changed your question to force using raw disk:
cecoppola wrote:The system I want to virtualize has its own disk. ... This OS will keep its own physical disk and I can modify it from inside by booting into it. Given that, what is the best way to virtualize it inside of WIndows 10?
This restriction requires raw disk access.
I'm not sure why you think this is changing the question. The OS I want to virtualize does have its own dedicated disk, which I can boot into and modify on its own. That's the system I have. Using the second, independent boot disk from within another OS is the feature that I need. I'm not "forcing" anyone to talk about raw disk access, as I don't know if that is necessary. I cited the official VM documentation on this topic as my best understanding. On the contrary, you just said this functionality requires it. If that is the case, that's what I'll be reading about until it works properly. I'd be happy to use another method that actually applies to the hardware configuration I have. I'm not concerned by administrator permissions, data loss, or having to start over if necessary. Unless I have misunderstood the point of this forum, I've used it properly by explaining the error code I get (INT18 BOOT FAILURE) and clearly saying I'm happy to "start from scratch" if that will get the system working. I'm sure your VDI tool is great for what you use it for, but if it's not going to get the functionality I need, why would i use it?
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by scottgus1 »

cecoppola wrote:Using the second, independent boot disk from within another OS is the feature that I need.
if you are set on this method then you must use Raw Disk Access, that's the only way. If you are willing to try it and run the risks, then that is one way to learn and become an expert.

Have fun!
cecoppola
Posts: 11
Joined: 16. Mar 2020, 07:22

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by cecoppola »

I would use any method that worked for my hardware. I'm not set on any particular way of getting this functionality.

I found a solution to the INT18 error. So, for anyone else who wants to boot from a Linux disk in a Windows host, here's what you need to do to be considered an "expert" computer user:

1) Disconnect or disable all bootable disks except the writethrough disk. This probably requires physically removing the NVME disk. My B550 can't disable it electronically.

2) Install Linux on the writethrough disk. Allow the installer to use the default partition types and allocations. Manually configuring the EFI partition did not work for me. I think using a non-Windows filesystem is necessary to avoid creating disk access conflicts later.

3) Re-enable or reconnect all your other disks, and restore your normal boot order.

4) Run VBoxManage as an administrator and create the rawdisk vmdk file. You may need to clear the readonly attribute using diskpart first. Use the whole disk instead of specifying partitions. Mine was 1kb and worked perfectly the first time.

5) Use the Virtual Media Manager to add the vmdk file as a writethrough type disk. Administrator privileges should prevent any VERR problems.

6) Create a new virtual machine with HD as the only boot type. I think any interface specification can work. EFI must be enabled, or you will fail to find bootable media (another booting error failure type).

7) Boot your second disk from the first one!

That solved my problem. This worked for me using a hardware RAID through PCIE. This method works because it sequesters the writethrough bootloader onto its own disk. This is very convenient because you do not have to repair the MBR if you change your disks. Booting into the writethrough disk only requires adjusting your boot device order through your BIOS.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by scottgus1 »

Glad you're up and running!
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Starting VM using a vmdk (from a bootable Ubuntu disk) stops at UEFI 2.2

Post by mpack »

I would point out that RAID is not a backup either. If you delete the file, it's gone.
Post Reply