Updated NetworkManager calls in suspend/resume scripts. #699
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The org.freedesktop.NetworkManager.Enable method used by the suspend/resume scripts changes the NetworkEnabled state in NM, which is persisted to disk in the state file (typically at
/var/lib/NetworkManager/NetworkManager.state
).If the resume script fails for any reason at all, the system will be left with NetworkManager in a disabled state, where the service is running, but all interfaces are ignored by NM, and most GUI interfaces will show the network as simply disappeared, as opposed to indicating it is disabled.
This code was added in commit 13ab4cc, which indicates that Enabled is tried first due to a bug in NM 0.9 on Ubuntu 11.10. I have confirmed that at least NM 0.9.1 on Ubuntu 11.10 correctly responds to Sleep, and several modern Linux distributions with modern copies of NM appear to respond correctly.
Use of the Sleep method is preferred, as the change does not persist a cold (re)boot, and avoids potentially leaving the system in state that's confusing to users.
I believe this to be the cause of a problem I've recently encountered, as well as a possible culprit of #426, along with many reports of similar problems across the web. A Google search for
vmware "nmcli networking on"
or just"nmcli networking on"
shows many reports where networking "disappears" from guests, where the nmcli command is able to "fix" the problem.With the exception of the nmcli tool itself, this network script appears to be the only widespread user of the Enabled dbus method. Outside of manually editing the state file, this is the only way to toggle the NetworkEnabled state, which is not really represented in the UI, especially in GUI frontends for NetworkManager. Since nothing else will ever toggle the NetworkEnabled state automatically, I believe the issue has to be the resume script not running for whatever reason, and leaving NM disabled.