Assigning a serial number to Mojave Guest VMs

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.
Post Reply
SteveMacGeek
Posts: 72
Joined: 15. Oct 2019, 22:11

Assigning a serial number to Mojave Guest VMs

Post by SteveMacGeek »

In granada29's whatroute.net instructions for making a Mojave Guest, it refers to the user might want to assign a serial number to the Mojave Guest machine. I noticed it shows the serial number as "0".

I couldn't find any reference for how to do that.

Also, what are the disadvantages if no serial number is assigned?

Stephen
granada29
Volunteer
Posts: 708
Joined: 3. Mar 2015, 07:27
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, macOS, Windows

Re: Assigning a serial number to Mojave Guest VMs

Post by granada29 »

I just looked this up. It's in the Help document in Section 9.11
• DMI system information (type 1)
VBoxManage setextradata "VM name" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "System Serial"
I get a serial number by taking the host system serial number as shown in "About this Mac", and changing the last character.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

granada29, that was so close... reaaaally close... ;)

That command that you entered would work if you had a BIOS booting VM:
VBoxManage setextradata "VM name" "VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial" "System Serial"
For an OSX Guest you need its EFI counterpart:
  • 
    VBoxManage setextradata "VM name" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" "System Serial"
You simply missed the following from the same User Manual ch. 9.11 Configuring the BIOS DMI Information that you quoted ;):
In case your VM is configured to use EFI firmware you need to replace pcbios by efi in the keys.
granada29 wrote:I get a serial number by taking the host system serial number as shown in "About this Mac", and changing the last character.
THIEF!!! :P :D

You just stole someone else's serial number, your realize that, right? Hope you're not getting into iTunes/AppStore/etc in your VM. But from what it seems you were changing the "pcbios" and not the "efi" part, so all is good... ;)
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
SteveMacGeek
Posts: 72
Joined: 15. Oct 2019, 22:11

Re: Assigning a serial number to Mojave Guest VMs

Post by SteveMacGeek »

Would the following work, if I wanted the user of the VM to simply set their VM to the same serial number as their Host mac?

Code: Select all

ioreg -l | grep IOPlatformSerialNumber | awk '{print $NF}' sn.tmp
...and then use sn.tmp instead of "System Serial"? would that be:

Code: Select all

VBoxManage setextradata "VM name" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" < sn.tmp
Stephen
Last edited by socratis on 25. Oct 2019, 04:08, edited 1 time in total.
Reason: Enclosed the information in [code] tag for better readability
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

The commands you gave failed for me. What worked was the following (no intermediary "sn.tmp" needed):
VBoxManage setextradata "<VM>" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" \
        `ioreg -l | grep IOPlatformSerialNumber | awk '{print $NF}' | tr -d \"`
Second raw scans the I/O registry (ioreg -l), filters for IOPlatformSerialNumber (grep IOPlatformSerialNumber), chops just the serial (awk '{print $NF}'), and finally removes the quotes (tr -d \") from that serial number.

First line modifies the VM's config to change the DMI SerialNumber with the output of the 2nd line.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

BTW, you know you can simply copy the serial from the "About this Mac" and paste it to the Terminal, right? :P


Hats off to 'granada29' for pointing to the more ... convoluted Copy/Paste solution! :D
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
SteveMacGeek
Posts: 72
Joined: 15. Oct 2019, 22:11

Re: Assigning a serial number to Mojave Guest VMs

Post by SteveMacGeek »

The idea was to provide a .sh shell script so that my clients could do the process automatically.

Stephen
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

There's an even shorter version that doesn't use 'grep', just 'awk' (credit @granada29):
VBoxManage setextradata "<VM>" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" \
        `ioreg -l | awk '/IOPlatformSerialNumber/ { print $4 }' | tr -d \"`
The only thing that I still have a problem with is that the "setextradata" command wouldn't take a quoted value, got to look further into that part...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
SteveMacGeek
Posts: 72
Joined: 15. Oct 2019, 22:11

Re: Assigning a serial number to Mojave Guest VMs

Post by SteveMacGeek »

VBoxManage setextradata "<VM>" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" \
        `ioreg -l | grep IOPlatformSerialNumber | awk '{print $NF}' | tr -d \"`
@socratis, that first version looks good, so long as the standard MacOS terminal bash shell is fine with that syntax. It would be executed by running a .command shell file.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

As already mentioned, the 2nd version is even better, one less tool involved:
VBoxManage setextradata "<VM>" "VBoxInternal/Devices/efi/0/Config/DmiSystemSerial" \
        `ioreg -l | awk '/IOPlatformSerialNumber/ { print $4 }' | tr -d \"`
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
SteveMacGeek
Posts: 72
Joined: 15. Oct 2019, 22:11

Re: Assigning a serial number to Mojave Guest VMs

Post by SteveMacGeek »

Didn't you say it wouldn't take quoted value, and you needed to look into it further?

Stephen
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

Stephen, I thought you were a programmer... ;) :P

The quoted value is irrelevant, the
  • 
    tr -d \"
removes them quotes, in both cases. My comment about the quoted values is for both commands...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
SteveMacGeek
Posts: 72
Joined: 15. Oct 2019, 22:11

Re: Assigning a serial number to Mojave Guest VMs

Post by SteveMacGeek »

Ohhhhhhhh.....
My comment about the quoted values is for both commands...
I get what you're saying. It is weird, because in other examples on the web I've seen people use quoted values.

But I'm totally happy with your provided solution! Thank you!

Stephen
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Assigning a serial number to Mojave Guest VMs

Post by socratis »

SteveMacGeek wrote: It is weird, because in other examples on the web I've seen people use quoted values.
Exactly, that's what I'm saying. And the command itself allows for quoted values, if not asking for them.

I have a feeling that they're double-quoted, as in ""123456"".
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply