How can I change the BIOS serial number in VirtualBox?

17

7

VirtualBox sets the BIOS serial number of every VM instance to 0. It seems to be possible to change some BIOS settings, but I haven't seen anything that directly references the serial number.

Can anyone suggest a way to do this?

Roger

Posted 2009-10-14T23:54:01.480

Reputation: 1 407

1Any particular reason you want to do this? – Jared Harley – 2009-10-15T00:15:14.230

1Yes. I have a PC inventory software tool that uses the BIOS serial number to uniquely identify computers. It works fine for physical hardware and for VMs from other vendors, but doesn't know how to handle multiple VirtualBox VMs. – Roger – 2009-10-15T00:52:34.647

edited my answer to reflect the error you caught. – A Dwarf – 2009-10-15T02:08:12.557

You have any news on this, Roger? Would love to know how it turned out. – A Dwarf – 2009-10-31T03:51:59.833

I never determined how to do it. I got a few responses on the VirtualBox forums, but found nothing that worked. If I run across the answer, I'll be sure to add an update here. – Roger – 2009-11-04T23:42:52.873

Answers

22

http://www.virtualbox.org/manual/ch09.html#changedmi

Really has detailed answer for this.

You can set the bios serial number by doing this:

VBoxManage setextradata "VM name" 
"VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "System Serial"

The error you were getting is caused by the serial not being set as a string value, if you have a pure number you should prepend it with string: like so:

VBoxManage setextradata "VM name" 
"VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "string:1234"

Note: In case your VM is configured to use EFI firmware you need to replace pcbios by efi in the keys.

Alex R

Posted 2009-10-14T23:54:01.480

Reputation: 405

3Note that these instructions are for systems using BIOS. If your system uses EFI -- controlled by "Settings -> System -> Motherboard -> Enable EFI" -- then you need to replace "pcbios" with "efi" in the above commands. – ntc2 – 2018-02-15T20:01:58.227

8

Not from any external settings. But you can from the code and then build it yourself:

Source file: DevPcBios.cpp
Line: 1014 READCFGSTR("DmiSystemSerial", pszDmiSystemSerial, "0");

Change "0" to whatever value you need.


EDIT: You can apparently use VBoxManage setextradata. I have used it in the past for other type of configurations (not bios related) and didn't test this particular setting. Give it a go:

VBoxManage setextradata *YourVMName* VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial "*yourserial*"

Otherwise... revert back to source code editing and building.

Best of luck.

A Dwarf

Posted 2009-10-14T23:54:01.480

Reputation: 17 756

1Hmm. Thanks - so close, but not there yet.

I tried this:

"c:\Program Files\Sun\VirtualBox\VBoxManage.exe" setextradata "Demo Server" VBoxInternal/Devices/pcbios/0/Config /DmiSerial "123"

It seemed to work, but when I launched the VM I got this error message:

Failed to start the virtual machine Demo Server.

Invalid configuration for device pcbios device (VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES).

Unknown error creating VM (VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES).

Deleting and recreating the machine definition fixed it, so no harm done. I think you're really close - any other suggestions? – Roger – 2009-10-15T01:22:20.823

hmm... did you make a verbatim copy/paste of your command to the comment box? Because there's no spave between /Config and /DmiSerial. Regardless I'll explore this further. Guess I will have to install VirtualBox. So far was relying only on my notes :) – A Dwarf – 2009-10-15T01:45:31.247

Bah! This head of mine. I post the relevant code line and then don't even check it against my much older notes. It's not /DmiSerial. It has been renamed sometime between version 1.5 and now. It is now /DmiSystemSerial – A Dwarf – 2009-10-15T01:53:36.167

Thanks, A Dwarf, for all your help. I tried replacing DmiSerial with DmiSystemSerial, reran the command line (without the space, which was a typo), and got the same error. – Roger – 2009-10-15T12:06:22.560

To my knowledge it can only mean this isn't fully implemented yet and you can't do it this way. At this point I'm afraid I cease to be useful. You should go to the VirtualBox forums and try from there. They are excellent folks and you'll get a more informed answer. I would however love to know the end result, if you would be so kind and post an answer to your own question when that happens. All the best. – A Dwarf – 2009-10-15T17:52:33.590

3

If you run that command, and get the error referenced by Roger, you need to back out the command by running the command without the last parameter (VALUE).

This removes the entry causing the error.

If you are unsure of what the last offending command was, open the ~~~.vbox (XML) file in the root of the VirtualMachines folder of the specific VM and review the EXTRADATA section.

Running the command-line call to vboxmanage is the best way to modify these. Editing the xml file does not stick 100% of the time.

Alex

Posted 2009-10-14T23:54:01.480

Reputation: 31

2

The accepted answer didn't update the serial number correctly for me; instead, I followed these steps to successfully update the serial number. Note the guest OS was macOS and the host was windows.

NOTE: You must close virtualbox before running this command for it to be saved.

  1. Open the windows command prompt as administrator
  2. cd "C:\Program Files\Oracle\VirtualBox\"
  3. VBoxManage.exe setextradata "VM NAME" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "SERIAL_HERE" see source.*
    Not sure why the pcbios command didn't work but efi did.

HELPFUL LINKS

  • If you have trouble finding a valid serial follow the instructions here.
  • If you're not sure what your vm name is run VBoxManage.exe list vms.

josh7weaver

Posted 2009-10-14T23:54:01.480

Reputation: 21

1Re you needing "efi" and accepted answer using "pcbios", this is probably because you're using (U)EFI and that person was using traditional BIOS. Whether you're using EFI or BIOS is determined by the "Settings -> System -> Motherboard -> Enable EFI" check box in VirtualBox. – ntc2 – 2018-02-15T18:38:20.033

Ah makes sense! Thanks @ntc2 – josh7weaver – 2019-02-15T07:11:17.020

1

Try using a serial number that contains 20 byte hexadecimal string:

VBoxManage setextradata "VM name" "VBoxInternal/Devices/ahci/0/Config/Port0/SerialNumber" "serial"

(Reference)

Ricardo Kiyoshi Batori

Posted 2009-10-14T23:54:01.480

Reputation: 11