MacOS Guest Additions - What does / doesn't work in 2018?

Discussions about using Mac OS X guests (on Apple hardware) in VirtualBox.
Post Reply
VivaLaRobo
Posts: 7
Joined: 3. May 2018, 19:37

MacOS Guest Additions - What does / doesn't work in 2018?

Post by VivaLaRobo »

Hello,

I am attempting to figure out what features of Guest Additions I can get working on a MacOS Host and MacOS Guest computer.

We would like to be able to query our VMs such as

Code: Select all

VBoxManage guestproperty enumerate <vmname>
but obviously we need Guest Additions installed for this. Are there any current work arounds for getting something like this working on MacOS 10.13.4?
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: MacOS Guest Additions - What does / doesn't work in 2018?

Post by socratis »

Nope, not for 10.13.4, not for 10.13.x, for 10.12.x, 10.11, .10, .9, .8 or to simplify it: no GAs for OSX guests. Period.

What exactly did you want to see? Which property?
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.
VivaLaRobo
Posts: 7
Joined: 3. May 2018, 19:37

Re: MacOS Guest Additions - What does / doesn't work in 2018?

Post by VivaLaRobo »

Trying to view the IP address of our VMs running on the host machine. As well as other normal command line options. There's no way to do this with VirtualBox?
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: MacOS Guest Additions - What does / doesn't work in 2018?

Post by socratis »

Not really... Not the way you're thinking at least, with VBoxManage. There is a script originally by user 'colmsjo', that could get the Bridged and the HostOnly IPs of an OSX guest, based on the output of 'arp -a' of the host. A big thank you to 'colmsjo', although he hasn't been seen since 2014-12-30.

The script needs a couple of adjustments. For example it would fail for VMs that had spaces in their name (e.g. "Mac OS X 10.11") and it was only looking at the 1st NIC only. I usually have 4 NICs on all of my VMs, so it would fail there as well.

I'm going to work on the script tomorrow (too late to do it now) and see if I can update it to work with up to 32 NICs that you are allowed to have in a VM.
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.
VivaLaRobo
Posts: 7
Joined: 3. May 2018, 19:37

Re: MacOS Guest Additions - What does / doesn't work in 2018?

Post by VivaLaRobo »

Thanks for the reply. We are interested in expanding the 2014 script as well, if you could keep this forum updated with new changes that would be awesome.
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: MacOS Guest Additions - What does / doesn't work in 2018?

Post by socratis »

Most probably this weekend, I'll have something cooking. I will definitely post the updated script, that's a given... ;)

But, expanding it? In what ways? What were you thinking more than Bridged and HostOnly options? To get the NAT, NATservice, Internal IPs?
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: MacOS Guest Additions - What does / doesn't work in 2018?

Post by socratis »

It took a little bit more than a weekend, but I found some time and wrote a small script to parse all the running VMs for their ARP entries.

NOTE: The ARP table is NOT always up to date, and the script can't do anything about it.

Code: Select all

#!/bin/bash
#
# Translate a MAC address fetched from VirtualBox into a IP address
#

echo `(arp -a -n | wc -l | awk '{print $1}')` "entries in the ARP table to parse."

MY_MACs=();
IFS=$'\t\n';

# Loop for all the running VMs
for RunningVM in `VBoxManage list runningvms | sort | cut -d'"' -f2`; do
    echo -ne $RunningVM;

    # Loop for all 32 possible NICs
    for i in {1..32}; do
        echo -ne "."        # Just a progress indicator ;)

        # Get a string of the form: macaddressNN="080027abcdef"
        #   then cut it at the equal ("=") sign
        #     then cut it at the right length
        #       then make it all lower case
        MY_MAC=$(VBoxManage showvminfo "$RunningVM" --machinereadable | grep macaddress$i | cut -d'=' -f2 | cut -c2-13 | tr '[A-Z]' '[a-z]');

        # If the MY_MAC is not empty, format it so that the leading zeroes (in pairs of 2) are not shown,
        # and separate each pair number by a colon. That's because this is the way that "arp" outputs the
        # MAC addresses as well. Example: "080027ab0def" becomes "8:0:27:ab:d:ef".
        if [ "${MY_MAC}" != "" ]; then
            MY_MAC=$(echo `expr ${MY_MAC:0:2}`:`expr ${MY_MAC:2:2}`:`expr ${MY_MAC:4:2}`:`expr ${MY_MAC:6:2}`:`expr ${MY_MAC:8:2}`:`expr ${MY_MAC:10:2}`)
            MY_MACs[i]="$MY_MAC"
        fi

    # Loop for all 32 possible NICs
    done

    echo "."                # Restore order for the progress indicator

    IFS=$'\n';

    # Loop for all ARP table entries.
    for MY_ARPentry in $(arp -a -n); do
        # Each entry in the "arp -a -n" output looks like (space separated):
        #
        # ? (192.168.20.102) at (incomplete) on vboxnet0 ifscope [ethernet]
        #  1                2  3            4  5        6       7           <---- These are the spaces
        #
        # Use the space as a delimiter to get the MAC, and the parentheses to get the IP.
        MY_ARP_MAC=$(echo ${MY_ARPentry} | cut -d' ' -f4 | cut -d' ' -f3)
        MY_ARP_IP=$( echo ${MY_ARPentry} | cut -d'(' -f2 | cut -d')' -f1)
    
        # Now loop through each of the MAC addresses stored in the 'VBoxManage showvminfo'.
        # If you find a match, print it out.
        for MY_MAC in "${MY_MACs[@]}"; do
            if test "$MY_MAC" = "$MY_ARP_MAC"; then
                unset IFS
                MY_ARP_MAC="$(printf "%02X:%02X:%02X:%02X:%02X:%02X" 0x${MY_ARP_MAC//:/ 0x})"
                echo "    MAC: $MY_ARP_MAC  IP: $MY_ARP_IP"
            fi

        # Loop for all MAC addresses.
        done

    # Loop for all ARP table entries.
    done

# Loop for all the running VMs
done
The script is as simple as it gets, nothing fancy, but if you've got any ideas for improvements, just let me know...
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