VMware Communities
headkaze
Contributor
Contributor

Unable to open file ".../Boot Camp.vmwarevm/Boot Camp.vmdk": The system cannot find the file specified

If you have a BOOTCAMP volume and you randomly get Unable to open file ".../Boot Camp.vmwarevm/Boot Camp.vmdk" errors when launching VMWare Fusion it could be because the disk volume has changed upon boot. You cannot be guaranteed that the disk assigned to your BOOTCAMP volume is the same each boot. For me it will randomly change between disk0 and disk1.

So I wrote a little script to run at startup that will change the disk to the correct one.

The script assumes your BOOTCAMP volume is named BOOTCAMP. Also replace YOUR_USERNAME with your user name.

Create a script called vmware_fix.sh:

#!/bin/bash

FILE_VMDK="/Users/YOUR_USERNAME/Library/Application Support/VMware Fusion/Virtual Machines/Boot Camp/Boot Camp.vmwarevm/Boot Camp.vmdk"

DRIVE_NEW=$(diskutil list | awk '/BOOTCAMP/{print $NF}' | cut -c 1-5)

if grep -q disk0 "$FILE_VMDK"; then

  DRIVE_OLD=disk0

fi

if grep -q disk1 "$FILE_VMDK"; then

  DRIVE_OLD=disk1

fi

sed -i.bak "s/$DRIVE_OLD/$DRIVE_NEW/g" "$FILE_VMDK"

Make sure you change the FILE_VMDK value to be the full path to your Boot Camp vmdk file.

Set the script to executable:

chmod +x ./vmware_fix.sh

Copy the file to /Users/YOUR_USERNAME/Applications/

Create a file called com.vmware.Fix.plist and paste the following:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

  <dict>

    <key>EnvironmentVariables</key>

    <dict>

      <key>PATH</key>

      <string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:</string>

    </dict>

    <key>Label</key>

    <string>com.startup</string>

    <key>Program</key>

    <string>/Users/YOUR_USERNAME/Applications/vmware_fix.sh</string>

    <key>RunAtLoad</key>

    <true/>

    <key>KeepAlive</key>

    <false/>

    <key>LaunchOnlyOnce</key>       

    <true/>

    <key>StandardOutPath</key>

    <string>/tmp/startup.stdout</string>

    <key>StandardErrorPath</key>

    <string>/tmp/startup.stderr</string>

    <key>UserName</key>

    <string>admin</string>

    <key>GroupName</key>

    <string>admin</string>

    <key>InitGroups</key>

    <true/>

  </dict>

</plist>

Copy com.vmware.Fix.plist to /Library/LaunchDaemons and run the following commands:

sudo chown root /Library/LaunchDaemons/com.vmware.Fix.plist

sudo chgrp wheel /Library/LaunchDaemons/com.vmware.Fix.plist

sudo launchctl load -w /Library/LaunchDaemons/com.vmware.Fix.plist

Hope this helps anyone else in a similar situation.

5 Replies
vmjoe_private
Contributor
Contributor

Thank you very much for the solution! I just applied macOS (10.13) security update 2019-004 and my Boot Camp did not start anymore in Fusion.

For now, I opted to edit the .vmdk manually (two changes: disk0s1 to disk1s1 and disk0s3 to disk1s3).

If actually changes often, I consider using your script. 😉

Or better, VMware should implement that in a Fusion update!

Reply
0 Kudos
vmjoe_private
Contributor
Contributor

Voilá - today I had to install macOS 10.13.6 security update, and also updated to Fusion 11.5, and Boot Camp did not start again. 😞

Edited the vmdk and reverted back to disk0s1 and disk0s3 and everything works again.

Amazing - not.

Reply
0 Kudos
vmjoe_private
Contributor
Contributor

Updated Fusion to 11.5.2 and the problem reoccured. Basically every (rare) reboot of my iMac or update to Fusion, the very same problem happens. It's fixable, but it's really beyond me why VMware does not implement such a simple fix...?!

Reply
0 Kudos
vmjoe_private
Contributor
Contributor

I keep having this problem... after each reboot of the Mac (High Sierra 10.13.6, Fusion 11.5.3) the disks of my Boot Camp installation have to be renamed. From disk0sx to disk1sx, next time vice versa. Crazy.

Reply
0 Kudos
panosru0
Contributor
Contributor

Thanks! That resolved my issue!

I also updated the bash script to detect the old and new drives more dynamically since, for instance, I have 8 drives and it juggles between 0 and 7. My Bootcamp volume is set to Windows, modify the script to match your Bootcamp volume name. Change the FILE_VMDK variable to match your path.

Reply
0 Kudos