vmware-vdiskmanager utility depends on com.vmware.DiskHelper and com.vmware.MountHelper to get privilege
search cancel

vmware-vdiskmanager utility depends on com.vmware.DiskHelper and com.vmware.MountHelper to get privilege

book

Article ID: 304389

calendar_today

Updated On:

Products

VMware Desktop Hypervisor

Issue/Introduction

Symptoms:
While Fusion is not running, the /Applications/VMware Fusion.app/Contents/Library/vmware-vdiskmanager utility fails to run and returns error:

AppleXPC: Failed to connect to service com.vmware.MountHelper
AppleXPC: Failed to connect to service com.vmware.MountHelper
HOSTDISK-MACOS: Failed communicating with mount helper.
AppleXPC: Failed to connect to service com.vmware.MountHelper
Failed to convert disk: This function cannot be performed because the handle is executing another function (0x5).


Environment

VMware Fusion 11.x

Cause

Starting from Fusion 11, the vmware-vdiskmanager utility depends on com.vmware.DiskHelper and com.vmware.MountHelper to get privilege. If you run the vmware-vdiskmanager utility after Fusion is launched, the com.vmware.DiskHelper and com.vmware.MountHelper services can be launched automatically when needed, and help the vmware-vdiskmanager utility get appropriate privilege to run; however if you run the vmware-vdiskmanager utility without launching Fusion first, the com.vmware.DiskHelper and com.vmware.MountHelper services won't launch, as a result the vmware-vdiskmanager utility fails to work.

Resolution

Currently, there is no resolution.

Workaround:
To workaround this issue, use one of these options:
  • Launch Fusion first before run the vmware-vdiskmanager utility.
  • Write a script to load com.vmware.DiskHelper and com.vmware.MountHelper before running vmware-vdiskmanager utility, then unload the two services.
For example:
# example.sh
# The script will help launch mountHelper and diskHelper
# Then the user could use vmware-vdiskmanager
# Finally, the script will stop the mountHelper and diskHelper

Fusion="/Applications/VMware Fusion.app"

LIBDIR='/Applications/VMware Fusion.app/Contents/Library'
HELPER_DIR='/Library/PrivilegedHelperTools'
HELPERPLIST_DIR='/Library/LaunchDaemons'

# Stage and start a privileged helper in exactly the same fashion as SMJobBless.
startPrivilegedHelper() {
local helper="$1"

cp -f -- "$LIBDIR"/LaunchServices/"$helper" "$HELPER_DIR"
chmod 544 "$HELPER_DIR"/"$helper"
cp -f -- "$LIBDIR"/LaunchServices/"$helper".plist "$HELPERPLIST_DIR"
chmod 644 "$HELPERPLIST_DIR"/"$helper".plist
launchctl load "$HELPERPLIST_DIR"/"$helper".plist
}

# Stop and remove a privileged helper.
stopPrivilegedHelper() {
local helper="$1"

launchctl stop "$helper"
launchctl unload "$HELPERPLIST_DIR"/"$helper".plist
rm "$HELPER_DIR"/"$helper"
rm "$HELPERPLIST_DIR"/"$helper".plist
}

startPrivilegedHelper com.vmware.MountHelper
startPrivilegedHelper com.vmware.DiskHelper

#
# HERE: Use vmware-vdiskmanager utility to do the intended work
#

stopPrivilegedHelper com.vmware.MountHelper
stopPrivilegedHelper com.vmware.DiskHelper