Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Discussions related to using VirtualBox on Linux hosts.
openminded
Posts: 13
Joined: 17. May 2020, 12:53

Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by openminded »

Hi,
I want to boot my physically installed Windows 10 as VirtualBox Guest with Ubuntu 20.04 host. There is some tutorial here: https://www.jamieweb.net/blog/booting-a ... -on-linux/

I tried it on VirtualBox 6.1.8 and it's not working :( Default Windows 10 installation on a Lonovo P1.

Code: Select all

markus@markus-ThinkPad-P1:~$ VBoxManage internalcommands createrawvmdk -filename ~/win10.vmdk -rawdisk /dev/nvme0n1p3
RAW host disk access VMDK file /home/markus/win10.vmdk created successfully.

Code: Select all

markus@markus-ThinkPad-P1:~$ cat win10.vmdk 
# Disk DescriptorFile
version=1
CID=0909571a
parentCID=ffffffff
createType="fullDevice"

# Extent description
RW 1782579200 FLAT "/dev/nvme0n1p3" 0

# The disk Data Base 
#DDB

ddb.virtualHWVersion = "4"
ddb.adapterType="ide"
ddb.geometry.cylinders="16383"
ddb.geometry.heads="16"
ddb.geometry.sectors="63"
ddb.uuid.image="45f71ca2-b801-4e1c-8f82-2015038f511f"
ddb.uuid.parent="00000000-0000-0000-0000-000000000000"
ddb.uuid.modification="00000000-0000-0000-0000-000000000000"
ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"
I'm not sure but I think "Enable EFI" should be set to true. However, I tried both. Results, see screenshots.

Thank you in advance!

best regards,
Markus Benter
Attachments
Storage settings
Storage settings
Screenshot VirtualBox Windows 10 Storage.png (65.26 KiB) Viewed 25159 times
Windows 10 with "Boot EFI" set to false
Windows 10 with "Boot EFI" set to false
Screenshot Windows 10 Boot No EFI.png (19.22 KiB) Viewed 25159 times
Windows 10 with "Boot EFI" set to true
Windows 10 with "Boot EFI" set to true
Screenshot Windows 10 Boot EFI.png (24.63 KiB) Viewed 25159 times
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by scottgus1 »

Earlier Windows (7) could boot in a Virtualbox guest after being installed on the physical computer, though activation was a concern, because in a Virtualbox (or any other hypervisor) the 'hardware' the OS sees is all different, so reactivation is requested, which can only be done a couple times before Microsoft gets cranky.

Reports are that Windows 10 will not cooperate. You will need to do a new Windows 10 in the Virtualbox guest. If you want to use your existing Windows 10 on the physical drive only in the Virtualbox guest for the future and never go back to booting it on the physical hardware, you could try booting a Windows 10 install ISO in Virtualbox and repairing the OS. But you won't be able to go back to booting physically. I strongly recommend backing up the physical drive before doing this, and know how to restore. Even better, use backup software to clone the physical drive to another physical drive and use the clone as the repair test. If you do get the OS working you will need to reactivate.

Also Windows 10 has been a ticklish beast to get running reliably in Virtualbox for some. Try a test install in a fresh new Virtualbox guest with a virtual drive, and see how it performs. If it performs well, consider abandoning the physical drive, and reinstall programs and data in the completely virtual guest.
openminded
Posts: 13
Joined: 17. May 2020, 12:53

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by openminded »

My intention was to regularly switch between booting physically and booting in VirtualBox. This is because it is easy and fast to boot a VirtualBox and switching between Windows/Ubuntu, but some software is only working properly on a physical installation. It would be a nice trade-off to have both. The tutorial suggested that this is possible. If it is not, I need a Windows 10 in VirtualBox and a bootable physical installation. That is somehow disappointing :(

Thank you for your fast response!
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by scottgus1 »

Glad to (try to) help! :lol:

The tutorial says how to boot physical 10 in a Virtualbox guest; it doesn't (that I saw) show how to toggle back and forth. It should be possible to get your 10 to boot in the guest, though I have never tried it. Maybe something in the tutorial got missed, or Microsoft has changed something. But you will be stuck either physical or virtual one day. Toggling is not possible with 10 yet.
openminded
Posts: 13
Joined: 17. May 2020, 12:53

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by openminded »

scottgus1 wrote:Toggling is not possible with 10 yet.
It is possible. I finally achieved it and it's working properly!

You can find a tutorial that I've wrote here: https://the-digital-native.de/?p=366
Sorry for German only, maybe use a translator. But it's working!

best regards,
Markus
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by scottgus1 »

That's very intriguing, Markus! It seemed to translate to English understandably.

I'm bookmarking this, please let us know how it performs after some time. Thanks!

Just to double-check, you can boot 10 in Virtualbox, then boot 10 on bare metal, and go back and forth without Windows 10 complaining for reactivation?
SteveNick
Posts: 2
Joined: 19. Oct 2020, 00:14

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by SteveNick »

Thanks Markus! The guide that expands on jamieweb's was perfect!

Does anyone find that they can boot in the VM many times, but as soon as they boot from the physical hardware windows "fixes" the bootloader eliminating access to linux installation?

Every time I switch to booting windows hardware back to linux, I have to boot a linux recovery and reinstall grub.

FYI can get around and help the activation process by changing the VM's Mahine UUID to the UUID of the hardware motherboard.

Either way, I tried for hours to make this work. Was trying a separate GRUB.vdmk and using os-prober to detect and install grub for the vm on it. Combining the partitions command from Markus was great!! I suppose I can live with reinstalling grub every time I boot from windows hardware, when I want to go back to linux. Just dont do it often ;)
SteveNick
Posts: 2
Joined: 19. Oct 2020, 00:14

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by SteveNick »

I was able to solve the windows "fixing" overwriting GRUB problem.

Solution is to have your linux grub boot partition, a windows boot partition, the MSR partition, the linux partition, and the windows partition.
You can change the type of the linux partition to something else, not EFI so windows doesn't try to store it's EFI images there.

Works great. Can flip back and forth between windows and linux booting on hardware, no reactivation since the motherboard and hard drive UUIDs were copied from the physical hardware and put in the linux vm file and the config xml file in virtualbox.
dr.UV
Posts: 1
Joined: 6. Jan 2021, 22:49

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by dr.UV »

First a bit of context:
I managed to get a triple boot system going with ubuntu20, windows10,macosMojave.

The system came with windows10. I added ubuntu20 which placed GRUB on the MBR.
Then came the Macos on a third partition booted from clover on a USB stick.
I managed to move clover onto the UEFI partition and boot all the three without a stick.
-----
From ubuntu I used the windows partition in the virtualbox many times. as well as mounting the NTFS.
its important to shutdown the virtualbox after each use or mount the ntfs partition in linux read only to avoid corruption.

I think running linux inside virtualbox from windows only works when its on a separate drive not just partition due to windows permissions restrictions accessing the raw partitions on the system drive.
I also never managed to boot the macos partition in a virtualbox. the boot was hanging.

The interesting bit is now the UEFI boot list.
Each system puts itself in the top of the uefi boot list. this way the hibernate works in the windows host as well as the linux host.
To get back to the clover i need to access the uefi boot list and change this back again.

However, i never really managed to correctly configure the uefi boot configuration within the virtualbox.
I think this is where a lot can be fixed of the issues I and others are having.
Atlassianguy
Posts: 1
Joined: 17. Mar 2021, 21:51

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by Atlassianguy »

I am using usually Ubuntu but I still need Windows 10 installed in the hard drive of my laptop. I do it using a virtualized raw disk that points to the physical Windows 10 drive without problem and setted the vm to use UEFI.

The problem I have is when I boot the physical computer with Windows 10, that always ask me to repair...

Does anyone know if this is something that can be fixed from Virtualbox using some settings like bios serialnumber or is this something related to the UEFI boot of the PC?

The use case is to be able to use indistinctly Windows 10 virtualized or not.

Any help will be very welcome!!
teuladi
Posts: 3
Joined: 6. Jun 2021, 13:22

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by teuladi »

scottgus1 wrote:That's very intriguing, Markus! It seemed to translate to English understandably.

I'm bookmarking this, please let us know how it performs after some time. Thanks!

Just to double-check, you can boot 10 in Virtualbox, then boot 10 on bare metal, and go back and forth without Windows 10 complaining for reactivation?
Hello scottgus1,

I followed Markus guide and I can successfully use my bare metal (computer original/native) Windows10 from Linux. I have been using it for a week and I have even upgraded Windows version and applied other additional upgrades from VirtualBox, then come back to native Windows, and back to Linux, etc, without no incidences regarding the activation. In total, I may have switched 10-15 times.

The only problems I have is that I cannot move from SVGA resolution, it appears blocked/grey color in the Windows display settings menu when running my native Windows inside VirtualBox (I tried the solutions Markus suggest, but none of them worked). In addition, the clipboard sharing doesn't work -none of the combinations: bidirectional, host guest, guest to host- (and I have installed the guest additions and the extension pack). However, I do not experience none of these two problems in a Windows10 virtual machine I downloaded from Microsoft and which is my workaround for running Adobe Software from Linux (Ubuntu 20.04LTS in my case).

Both of the issues are painful because I cannot run my native Windows10 from VirtualBox in Linux on a dedicated monitor in full screen at its maximum resolution and neither share the clipboard.

Can you guess what might be happening?
Many thanks! Best regards,
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by scottgus1 »

teuladi, The problems you experience suggest that the Guest Additions either did not install or are being damaged somehow in the native-vs-VM scenario.

Start the VM from full normal shutdown, not save-state. Run until you see the problem happen, then shut down the VM from within the VM's OS if possible. If not possible, close the Virtualbox window for the VM with the Power Off option set.

Right-click the VM in the main Virtualbox window's VM list, choose Show Log. Save the far left tab's log and the hardening log next to it, zip them, and post the zip file, using the forum's Upload Attachment tab.
teuladi
Posts: 3
Joined: 6. Jun 2021, 13:22

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by teuladi »

scottgus1 wrote:teuladi, The problems you experience suggest that the Guest Additions either did not install or are being damaged somehow in the native-vs-VM scenario.

Start the VM from full normal shutdown, not save-state. Run until you see the problem happen, then shut down the VM from within the VM's OS if possible. If not possible, close the Virtualbox window for the VM with the Power Off option set.

Right-click the VM in the main Virtualbox window's VM list, choose Show Log. Save the far left tab's log and the hardening log next to it, zip them, and post the zip file, using the forum's Upload Attachment tab.

Hello scottgus1,

Sorry for coming back to you 10 days later. It is my first post here and I thought I would receive an automatic notification email in case of response.

Thanks for insisting in the Guest Additions checking: That was indeed the problem. I didn't realize they didn't really get installed the first time in this second Windows WM I have ever created. Now the problem is completely solved and everything works amazingly well. I even tend to forget I am accessing to my 'old' Windows from Linux. I'm just feeling so grateful to VirtualBox to enable me to use Linux full time!!

I checked the log you mentioned in the way you mentioned and I saw that the Guest Additions were indeed missing. Then I "inserted" again the Guest Addtions image from the Devices menu option. And the installation started. But at some point it crashed. However, the Guest Additions were successfully installed or at least they work fine for me. Even they crated an icon in my Windows systray.

I just attach you a screen capture of the crash moment and the log that it is mentioned there (despite the name is not the same -in the directory there is only this log I am attaching-).

My hardware is a Dell XPS 15'' 9560 laptop. Before installig Linux, I had to disable the "Intel RST" RAID controller in the BIOS because it is not supported by Linux (I saw in an Arch forum that there is a way to make it run, but I didn't want to test it by now). I tell you this because I have the Intel RST icon in the Windows systray that says the service is not running, and I was guessing if that could be related somehow to the missing thing VirtualBox complained for.

In case this issue is of your interest and you want more information, just please ask what you need and how I can get it.

Best regards,
Attachments
WinGuestAdds_installError.png
WinGuestAdds_installError.png (119.51 KiB) Viewed 20286 times
install_drivers.log
(1.82 KiB) Downloaded 52 times
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by fth0 »

FWIW, your Windows VM has its own graphics adapter (e.g. "VirtualBox Graphics Adapter (WDDM)"), which is different from the native one, and the VirtualBox Guest Additions installer complains that it cannot find it. If you alternate between booting native and from the VM, you're changing the available graphics hardware, with all consequences that may have.
teuladi
Posts: 3
Joined: 6. Jun 2021, 13:22

Re: Booting a Physical Windows 10 Disk Using VirtualBox on Linux

Post by teuladi »

fth0 wrote:FWIW, your Windows VM has its own graphics adapter (e.g. "VirtualBox Graphics Adapter (WDDM)"), which is different from the native one, and the VirtualBox Guest Additions installer complains that it cannot find it. If you alternate between booting native and from the VM, you're changing the available graphics hardware, with all consequences that may have.
Hello fth0, Thank you very much for your comment!! I see ... When running native Windows from VirtualBox on Linux, the system has the "VirtualBox Graphics Adapter (WDDM)" graphics card which I now recognize in the error logs I posted earlier. And when I start the computer from native Windows, I see both Intel and nVidia GForce cards that my laptop has built in.

But I don't have a problem with that, I don't lose any settings or see any installation in progress when starting from Windows (or at least I'm not aware of it) when coming from a previous start from Linux. It seems that Windows does all the changes automatically, transparently and quickly for me.

The only problem I have when starting the computer from Windows is that the Windows system clock usually is in UTC (I live in UTC+1). Sometimes Windows automatically syncs quickly, sometimes I just force it to sync with a command. But this phenomenon will be minimal because now I don't need to start Windows anymore unless I want to see how works at its full capabilities some small hardware/peripheral that is not fully supported in Linux.
Post Reply