[vbox-dev] vm detection
Knut St. Osmundsen
bird at sun.com
Mon Jan 4 20:15:17 GMT 2010
On Jan 2, 2010, at 7:15 PM, Frank Mehnert wrote:
> Stéphane,
>
> On Wednesday 30 December 2009, Stéphane Charette wrote:
>> On Wed, Dec 30, 2009 at 12:09, Larry Finger <Larry.Finger at lwfinger.net>
> wrote:
>>> For my edification, why does it matter?
>>
>> Some extra installation steps we have to run when our appliance is
>> deployed in a virtual environment. I was hoping to have a single
>> easy-to-run check which can help determine between native and
>> virtualized environments.
>>
>> Unless someone has an easier solution, I've decided to run
>> /usr/sbin/dmidecode and grep for certain keywords to tell the
>> difference. There are two problems I know about with doing it this
>> way:
>>
>> 1) greping for text strings isn't as "deterministic" as I'd like it to
>> be; running some instructions or calling some sort of API (if such a
>> solution existed) would make me feel a bit better
>>
>> 2) vboxmanage can be used to customize the dmi strings, meaning that
>> "innotek GmbH" and "VirtualBox" may not even appear in the dmidecode
>> output; in my opinion, this solution is about on-par with checking the
>> organizational unique identifier in the MAC address
>
> Correct, dmidecode isn't the ideal solution, the information can
> be faked. Why not using 'lspci -d 80ee:beef'? That PCI is always
> present if the VM is running under VirtualBox. Of course this ID
> will eventually change but I don't have a better idea at the moment.
>
80ee:beef is the graphics device. While the graphics device probably won't change, unless we decide to change the vendor id at some point, I think the VirtualBox VMM device that the guest additions talks to (and VT-x currently relies upon for real-mode emulation) would be a slightly better choice for identifying the VirtualBox hardware. The PCI VendorID:DeviceID for this device is 80ee:cafe.
Kind Regards,
Knut
More information about the vbox-dev
mailing list