Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 368955 - app-emulation/open-vm-tools default scripts break network connectivity on pause/resume
Summary: app-emulation/open-vm-tools default scripts break network connectivity on pau...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mike Gilbert
Depends on:
Reported: 2011-05-27 21:33 UTC by Brian De Wolf
Modified: 2016-12-31 01:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Brian De Wolf 2011-05-27 21:33:10 UTC
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
Comment 1 Brian De Wolf 2011-05-27 23:58:27 UTC
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).
Comment 2 Alexander Hoogerhuis 2011-12-03 04:55:33 UTC
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.
Comment 3 Alexander Hoogerhuis 2011-12-03 04:56:29 UTC
--- 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

-   if [ $(rc-service -e net.eth0) ]
+   if [ $(/etc/init.d/net.eth0 -q status) ]
Comment 4 Alexander Hoogerhuis 2011-12-03 05:48:53 UTC
Of course, testing it properly would be better. Here's the script hacked up to work proper:


# If you are not using /etc/init.d/network or /etc/init.d/net.eth0

if [ -n ${service} ]; then
        if [ $(/etc/init.d/net.eth0 -q status) ] || service="net.eth0"
        if [ $(/etc/init.d/network -q status) ] || service="network"

case "$1" in
                rc-service $service stop
                rc-service $service start
Comment 5 Mike Gilbert gentoo-dev 2015-09-19 16:28:22 UTC
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.