In this package, the default scripts are patched to use gentoo-specific commands for handling events. One script specifically manages the network on a pause/resume event, by restarting the net.eth0 or network services, but due to a bug will only ever attempt to restart the network service. For systems not using the network service, this causes all routes to be flushed and thus network connectivity is lost. Reproducible: Sometimes Steps to Reproduce: 1. Install open-vm-tools. 2. Start open-vm-tools service. 3. Wonder where your routes went. (Note: Only on pause/resume events, and inexplicably on the first run) Here is a patch to the patch to fix the broken behavior: --- /usr/portage/app-emulation/open-vm-tools/files/default-scripts.patch 2010-07-08 08:58:29.000000000 -0700 +++ /usr/portage/app-emulation/open-vm-tools/files/default-scripts.patch 2011-05-27 13:54:11.000000000 -0700 @@ -182,7 +182,7 @@ + # net.eth0, net.eth1, network, wicd, NetworkManager + service="net.eth0" + -+ if [ $(rc-service -e net.eth0) ] ++ if rc-service -e $service + then + service="net.eth0" + else
After re-reading my patch, it doesn't seem like sensible behavior, but the if statement I have changed still needs to be corrected. As it stands, it never works in the way it is implied that it should (that it should default to "network" instead of "net.eth0" if "net.eth0" doesn't exist, but as is the if statement can never be true).
The patch will not work; the flaw seems to be that /etc/init.d/net.eth0 and /etc/init.d/network can both exist. The script doesn't determine which one was used to start the network services, it only determines if the given service is present. The route I've gone is to modify it this way: if [ $(/etc/init.d/net.eth0 -q status) ] instead of: if [ $(rc-service -e net.eth0) ] This will return zero if that given service is started. Either you've started with net.eth0, and if you didn't then you used /etc/init.d/network.
--- network.orig 2011-12-03 05:55:54.000000000 +0100 +++ network 2011-12-03 05:56:16.000000000 +0100 @@ -50,7 +50,7 @@ # net.eth0, net.eth1, network, wicd, NetworkManager service="net.eth0" - if [ $(rc-service -e net.eth0) ] + if [ $(/etc/init.d/net.eth0 -q status) ] then service="net.eth0" else
Of course, testing it properly would be better. Here's the script hacked up to work proper: #!/bin/sh # If you are not using /etc/init.d/network or /etc/init.d/net.eth0 #service="net.foo" if [ -n ${service} ]; then if [ $(/etc/init.d/net.eth0 -q status) ] || service="net.eth0" if [ $(/etc/init.d/network -q status) ] || service="network" fi case "$1" in suspend-vm) rc-service $service stop ;; resume-vm) rc-service $service start ;; *) ;; esac
With 10.0.0, I reverted back to using upstream's network script. This should work with systemd, but may further break openrc systems. If someone can patch/test it to work with openrc as well, I would welcome the help.