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

Bug #1007924 reported by Daniel Hahler
70
This bug affects 15 people
Affects Status Importance Assigned to Milestone
pm-utils
Won't Fix
Medium
pm-utils (Debian)
Confirmed
Unknown
pm-utils (Ubuntu)
Triaged
Medium
Unassigned
Nominated for Precise by Daniel Hahler

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)

Revision history for this message
In , Jklimes (jklimes) wrote :

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

Revision history for this message
In , Michael Wild (themiwi) wrote :

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.

Revision history for this message
In , Michael Wild (themiwi) wrote :

Created attachment 53060
Patch fixing the NetworkManager DBus calls

Revision history for this message
In , Bin Li (binli) wrote :

Victor,

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

Revision history for this message
In , Bin Li (binli) wrote :

Looks same with 30701.

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

Revision history for this message
In , Bin Li (binli) wrote :

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

Revision history for this message