Ubuntu

pm-utils uses wrong interface for NetworkManager hook (should be org.freedesktop.NetworkManager.Sleep)

Reported by Daniel Hahler on 2012-06-02
64
This bug affects 13 people
Affects Status Importance Assigned to Milestone
pm-utils
Confirmed
Medium
pm-utils (Debian)
Confirmed
Unknown
pm-utils (Ubuntu)
Medium
Unassigned

Bug Description

While looking at /var/log/pm-suspend.log I have noticed that the NetworkManager hooks fail:

 Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager suspend suspend_hybrid:
 Having NetworkManager put all interaces to sleep...Failed.

 Running hook /usr/lib/pm-utils/sleep.d/55NetworkManager resume suspend_hybrid:
 Having NetworkManager wake interfaces back up...Failed.

Looking at the script is uses org.freedesktop.NetworkManager.sleep and org.freedesktop.NetworkManager.wake.

Calling this results in errors like this:
 % sudo dbus-send --print-reply --system --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.sleep
 Error org.freedesktop.DBus.Error.UnknownMethod: Method "sleep" with signature "" on interface "org.freedesktop.NetworkManager" doesn't exist

According to the documentation [1], the interface is different / has changed.

The correct usage would be to call org.freedesktop.NetworkManager.Sleep with a boolean value, like:

 sudo dbus-send --print-reply --system --dest=org.freedesktop.NetworkManager /org/freedesktop/NetworkManager org.freedesktop.NetworkManager.Sleep boolean:true

1: http://projects.gnome.org/NetworkManager/developers/api/09/spec.htmlorg.freedesktop.NetworkManager.Sleep

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: pm-utils 1.4.1-9
ProcVersionSignature: Ubuntu 3.2.0-25.40-generic 3.2.18
Uname: Linux 3.2.0-25-generic x86_64
ApportVersion: 2.0.1-0ubuntu8
Architecture: amd64
Date: Sat Jun 2 21:36:40 2012
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
PackageArchitecture: all
SourcePackage: pm-utils
UpgradeStatus: No upgrade log present (probably fresh install)

Created attachment 39281
add '--print-reply' and use Sleep() method

The patch adds '--print-reply' to 55NetworkManager hook. This works around a bug that D-Bus loses messages for short-lived processes.
In reality this means that without '--print-reply' the message is not delivered to NetworkManager and it's not woken up on resume.
You can see these bugs for reference:
https://bugs.freedesktop.org/show_bug.cgi?id=896 (the core D-Bus bug)
https://bugzilla.redhat.com/show_bug.cgi?id=477964

Moreover the patch uses Sleep() method instead of deprecated sleep() and wake()
http://projects.gnome.org/NetworkManager/developers/spec-08.html

pm/sleep.d/55NetworkManager calls the org.freedesktop.NetworkManager.sleep and org.freedesktop.NetworkManager.wake methods. However, since NetworkManager version 7 they don't exist any more, and have been replaced by org.freedesktop.NetworkManager.Sleep which takes a boolean argument.

Created attachment 53060
Patch fixing the NetworkManager DBus calls

Victor,

 I've also met this issue in openSUSE, could you let it in upstream. Thanks!

Looks same with 30701.

*** This bug has been marked as a duplicate of bug 30701 ***

*** Bug 42500 has been marked as a duplicate of this bug. ***

Daniel Hahler (blueyed) wrote :

This is not a duplicate of bug 30701 - un-duplicating.

JFI: the bug is reported in Launchpad at: https://launchpad.net/bugs/1007924

Changed in pm-utils (Debian):
status: Unknown → Confirmed

Ok, looking at the patch for the other bug, it would fix this issue, too.

So much for fixing multiple issues with a single patch..

*** This bug has been marked as a duplicate of bug 30701 ***

*** Bug 42500 has been marked as a duplicate of this bug. ***

Changed in pm-utils:
importance: Unknown → Medium
status: Unknown → Confirmed

The patch fixes two issues with the NetworkManager hook, whereas the interface is by now not only deprecated, but not available any more.
This is a currently unfixed issue in Debian/Ubuntu.

I am setting the bug status to NEW, in case the bug is just not being handled because of its NEEDINFO state.

Daniel Hahler (blueyed) on 2012-06-02
Changed in pm-utils (Ubuntu):
status: New → Triaged
importance: Undecided → Medium

(In reply to comment #4)
> The patch fixes two issues with the NetworkManager hook, whereas the interface
> is by now not only deprecated, but not available any more.
> This is a currently unfixed issue in Debian/Ubuntu.

What interface do you mean, whole pm-utils?
Then yes, there are other ways how to handle sleep/resume now, e.g. UPower daemon.
NetworkManager listen to UPower's Sleeping and Resuming D-Bus signals too. So, the patch for pm-utils is not vital for NM. But still it would be nice to fix the script as it is broken, and some can use it.

http://projects.gnome.org/NetworkManager/developers/api/09/spec.html#org.freedesktop.NetworkManager

Changed in pm-utils:
status: Confirmed → Invalid
Daniel Hahler (blueyed) on 2012-06-05
Changed in pm-utils:
importance: Medium → Unknown
status: Invalid → Unknown

> What interface do you mean, whole pm-utils?

I am referring to the NetworkManager DBUS interface, where pm-utils uses a non-existent interface method: see bug 42500.

(In reply to comment #6)
> > What interface do you mean, whole pm-utils?
>
> I am referring to the NetworkManager DBUS interface, where pm-utils uses a
> non-existent interface method: see bug 42500.

But, the patch fixes that too - e.g. uses Sleep() instead of sleep() and wake() (it's written in the Description :).

Changed in pm-utils:
importance: Unknown → Medium
status: Unknown → Confirmed
Dirk Möbius (dmoebius) wrote :

I had exactly the same problem, and using the patch from https://bugs.freedesktop.org/show_bug.cgi?id=30701 (especially using the Sleep method) fixed it.

Dirk Möbius (dmoebius) wrote :

Btw. I suggest changing the subject of this bug to "NetworkManager doesn't re-enable network devices after suspend/resume" so that it is easier to find for other users.

Would be great to get this fixed; the patch already attached still applies cleanly to git master and fixes the problem for me in Ubuntu. Without this, the network is lost on resume when using pm-utils.

Can someone tell me how to apply this patch - I have the log errors mentioned so I figured I'd try it to see if it fixed my crashing on suspend/resume. I can't get the patched code in without encountering a syntax error in the logs.

Thanks

This problem exists in LTS 12.04. It causes machines coming back from resume to use illegal IP addresses since it uses the address that it had when it suspended and does not renew it on resume. This means if the lease expired while suspended, it is against network and security policies (of some/many corporate networks) to use it.

When will this problem be fixed?

Can we get a comment from the maintainer whether this patch is or will (not) be applied and explanation as to why not if not?

This bug is percolating to many downstream consumers of this package. It's not really reasonable to ignore it here and expect them all to fix it themselves.

ping - are there any specific issues blocking merging this?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.