17

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?

  • 1
    Any particular reason you want to do this? – Jared Harley Oct 15 '09 at 0:15
  • 1
    Yes. 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 Oct 15 '09 at 0:52
  • edited my answer to reflect the error you caught. – A Dwarf Oct 15 '09 at 2:08
  • You have any news on this, Roger? Would love to know how it turned out. – A Dwarf Oct 31 '09 at 3:51
  • 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 Nov 4 '09 at 23:42
21

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.

  • 3
    Note 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 Feb 15 '18 at 20:01
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.

  • 1
    Hmm. 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 Oct 15 '09 at 1:22
  • 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 Oct 15 '09 at 1:45
  • 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 Oct 15 '09 at 1:53
  • 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 Oct 15 '09 at 12:06
  • 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 Oct 15 '09 at 17:52
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.

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.
  • 1
    Re 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 Feb 15 '18 at 18:38
  • Ah makes sense! Thanks @ntc2 – josh7weaver Feb 15 at 7:11
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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.