virtualbox

How to set VirtualBox bios UUID


I'm trying to use my native Windows installation in VirtualBox and since it has an OEM license, I need to reuse the bios UUID for the activation to work.

Some system info:
OS: Arch Linux, kernel 4.1.6-1
Virtualbox: 5.0.4_OSEr102546

The machine uses raw vmdk disk limited to the 6 partitions that were used by native Windows installation.

I have already applied commands like modifyvm --hardwareuuid and setextradata for a lot of dmi data.

The relevant lines from config are:

<ExtraData>
  ...
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiBoardLocInChass" value="Type2 - Board Chassis Location"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" value="Lancer 5A5"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiBoardSerial" value="string:1052326401165"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiBoardVendor" value="LENOVO"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiBoardVersion" value="31900058WIN"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiChassisSerial" value="YB10465037"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiChassisVendor" value="LENOVO"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiChassisVersion" value="Lenovo Z50-70"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiProcManufacturer" value="Intel(R) Corporation"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiProcVersion" value="Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiSystemUuid" value="1abbb2fc-c938-11e4-a961-68f728a77e71"/>
  <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/UUID" value="bytes:Gruy/Mk4EeSpYWj3KKd+cQ=="/><!-- UUID in BASE64 -->
</ExtraData>
<Hardware version="2" uuid="{1abbb2fc-c938-11e4-a961-68f728a77e71}">
  <CPU count="1" hotplug="false">
    <HardwareVirtEx enabled="true"/>
    <HardwareVirtExNestedPaging enabled="true"/>
    <HardwareVirtExVPID enabled="true"/>
    <HardwareVirtExUX enabled="true"/>
    <PAE enabled="true"/>
    <LongMode enabled="true"/>
    <HardwareVirtExLargePages enabled="false"/>
    <HardwareVirtForce enabled="false"/>
  </CPU>
  <Memory RAMSize="2560" PageFusion="false"/>
  <Firmware type="EFI"/>
  <HID Pointing="USBTablet" Keyboard="PS2Keyboard"/>
  <HPET enabled="false"/>
  <Chipset type="PIIX3"/>

Vboxmanage showvminfo returns this line:

Hardware UUID:   1abbb2fc-c938-11e4-a961-68f728a77e71

So as you can see, I have used VirtualBox's hardwareuuid setting, dmi setting DmiSystemUuid and UUID (this one I had to reverse engineer from log and find out how to pass it - via base64 and conversion to bytes).

Yet, when I run the machine, VirtualBox somehow decides it knows better and uses the initial UUID of the machine. It's demonstrated in log (last line):

00:00:00.586671 ************************* CFGM dump *************************
00:00:00.586674 [/] (level 0)
00:00:00.586680   CSAMEnabled       <integer> = 0x0000000000000001 (1)
00:00:00.586683   CpuExecutionCap   <integer> = 0x0000000000000064 (100)
00:00:00.586686   EnablePAE         <integer> = 0x0000000000000001 (1)
00:00:00.586687   HMEnabled         <integer> = 0x0000000000000001 (1)
00:00:00.586689   MemBalloonSize    <integer> = 0x0000000000000000 (0)
00:00:00.586690   Name              <string>  = "Windows 8" (cb=10)
00:00:00.586692   NumCPUs           <integer> = 0x0000000000000001 (1)
00:00:00.586693   PATMEnabled       <integer> = 0x0000000000000001 (1)
00:00:00.586695   PageFusionAllowed <integer> = 0x0000000000000000 (0)
00:00:00.586696   RamHoleSize       <integer> = 0x0000000020000000 (536 870 912, 512 MB)
00:00:00.586699   RamSize           <integer> = 0x00000000a0000000 (2 684 354 560, 2 GB)
00:00:00.586701   RawR0Enabled      <integer> = 0x0000000000000001 (1)
00:00:00.586702   RawR3Enabled      <integer> = 0x0000000000000001 (1)
00:00:00.586704   TimerMillies      <integer> = 0x000000000000000a (10)
00:00:00.586705   UUID              <bytes>   = "fc b2 bb 1a 38 c9 e4 11 a9 61 68 f7 28 a7 7e 71" (cb=16)

Unfortunately, this one is the UUID that matters. In Windows 8 if I use wmic command, it reports UUID: fcb2bb1a-38c9-e411-a961-68f728a77e71 while I want 1abbb2fc-c938-11e4-a961-68f728a77e71.

I have deduced that it could possibly be manipulated by extradata starting at root, so I tried to put in line:

<ExtraDataItem name="VBoxInternal/UUID" value="bytes:Gruy/Mk4EeSpYWj3KKd+cQ=="/>

That changed the log value to the correct one, but wmic still reported the one starting with 'fc'. Also Windows activation didn't work.

So now I'm really out of ideas.

Has anyone been successful in setting this up and if so how?


Solution

  • The important line is:

    <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiSystemUuid" value="1abbb2fc-c938-11e4-a961-68f728a77e71"/>
    

    But byte order is reversed in the first four groups, so it needs to be written as:

    <ExtraDataItem name="VBoxInternal/Devices/efi/0/Config/DmiSystemUuid" value="fcb2bb1a-38c9-e411-a961-68f728a77e71"/>