Skip to content

Instantly share code, notes, and snippets.

@drakkhen
Last active December 21, 2020 14:30
  • Star 18 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save drakkhen/5473067 to your computer and use it in GitHub Desktop.
Workaround for Ubuntu guest suspension warning in VMware Fusion

I see this error when I try to suspend an Ubuntu 10 guest in Fusion:

The request to Suspend this virtual machine failed because the corresponding VMware Tools script did not run successfully.

If you have configured a custom suspend script in this virtual machine, make sure that it contains no errors. Attempting the operation again will ignore the script failure. You can also submit a support request to report this issue.

As the dialog states, the second time you try to suspend the VM it ignores the non-zero return code of the script and it seems to work. But it's annoying.

The problem appears to not be VMware actually, but Ubuntu (or Ubuntu's service script). I tried to figure out where exactly Ubuntu's initctl configuration/scripts is broken to no avail but found a work-around that I'm happy with.

Edit /etc/vmware-tools/scripts/vmware/network and make the following change:

@@ -78,13 +78,13 @@ run_network_script()
    [ "$script" != "error" ] || Panic "Cannot find system networking script."

    # Using SysV "service" if it exists, otherwise fall back to run the script directly
-   service=`which service 2>/dev/null`
-   if [ $? = 0 -a -n "$service" ]; then
-      serviceName=`basename "$script"`
-      "$service" "$serviceName" "$1"
-   else
+   #service=`which service 2>/dev/null`
+   #if [ $? = 0 -a -n "$service" ]; then
+   #   serviceName=`basename "$script"`
+   #   "$service" "$serviceName" "$1"
+   #else
       "$script" "$1"
-   fi
+   #fi
 }

Now instead of using the (seemingly broken) service script, it will just call the networking script directly which seems to return a non-zero result correctly.

NOTE: when you re-install vmware-tools in the VM (which you will need to do whenever Fusion is updated -- which isn't too often), your changes will be reverted and you'll have to edit this file again.

@andrwj
Copy link

andrwj commented Dec 26, 2013

thanks a lot!!

@mwf
Copy link

mwf commented Feb 17, 2014

Thanks, man!

This worked for me on Ubuntu 12.04

@skpabba
Copy link

skpabba commented Mar 4, 2014

Thanks. That helped

@eswierk
Copy link

eswierk commented May 20, 2014

The problem isn't Ubuntu's service script, but rather its upstart networking script (/etc/init/networking.conf), which no longer supports stopping or restarting.

Another solution is to install the following script as /etc/init.d/network (and make it executable). The vmware-tools network script will call it in place of the upstart networking script and run ifdown/ifup as Ubuntu now recommends.

It will be preserved across vmware-tools upgrades.

#!/bin/sh
# Hack for /etc/vmware-tools/scripts/vmware/network which
# otherwise runs deprecated "service networking stop|start"

case "$1" in
stop)
    ifdown -a
    ;;
start)
    ifup -a
    ;;
restart)
    ifdown -a
    ifup -a
    ;;
esac

@vwal
Copy link

vwal commented May 21, 2014

@eswierk, thanks for that info and the script. Persisting over vmware-tools upgrades is definitely preferable!

@web-bert
Copy link

Thanks @eswirk, works for me with Ubuntu 14.04 and VMWare 6

@mfrister
Copy link

Thanks for the fix @eswierk.

I put this into a gist for simple installation: https://gist.github.com/meeee/5e252e93ba4589e67cf3

@kcraigie
Copy link

even easier, just make a symlink to /bin/true (which always returns success):

sudo ln -s /bin/true /etc/init.d/network

@ekkis
Copy link

ekkis commented May 11, 2018

Doesn't seem to work for me on Ubuntu 16.04 and VMWare Fusion 8.5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment