2

Is there any way to get a Guest VM's UUID from within the Guest VM itself? From the Host I can do vboxmanage list vms to get a list of all vm names and their user ids. From the Guest, even with VirtualBox Additions, I can't see a way to do it. The closest I've come was vboxcontrol guestproperty enumerate, but it doesn't seem to have UUID as a guest property.

Claudiu
  • 1,207
  • 5
  • 21
  • 28

2 Answers2

2

I was able to extract the UUID of the machine on Linux guests with dmidecode.

$ uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-79-generic #123-Ubuntu SMP Fri Feb 19 14:27:58 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ dmidecode
Handle 0x0001, DMI type 1, 27 bytes
System Information
  Manufacturer: innotek GmbH
  Product Name: VirtualBox
  Version: 1.2
  Serial Number: 0
  UUID: 7CB408DB-F8D3-45D8-AB90-BD8EA68C841E
  Wake-up Type: Power Switch
  SKU Number: Not Specified
  Family: Virtual Machine

This UUID matches the one reported by the host:

$ VBoxManage list runningvms
"vagrant_box_1463038978001_98686" {7cb408db-f8d3-45d8-ab90-bd8ea68c841e}

To extract the UUID only you might run:

dmidecode | grep UUID | awk '{print $2}'

As of version 3.0 of dmidecode, the following works:

dmidecode -s system-uuid
asteiner
  • 3
  • 2
0

Best I could come up with:

  • On the host, make a script that uses vboxmanage to list all the vms, and set a custom property (like /Custom/UUID) to the UUID. Run this manually whenever a new VM is created.
  • On the guest, just read that property /Custom/UUID. If it's not there, explode.
Claudiu
  • 1,207
  • 5
  • 21
  • 28