Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 180329

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

$
0
0

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.


Viewing all articles
Browse latest Browse all 180329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>