PrepareFor{Sleep,Shutdown} (false) signals not emitted

Bug #1157122 reported by Iain Lane
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released

Bug Description


"PrepareForShutdown(false) may be subscribed to by applications which want to be notified about system resume events. Note that this will only be sent out for suspend/resume cycles done via logind, i.e. generally only for high-level user-induced suspend cycles, and not automatic, low-level kernel induced ones which might exist on certain devices with more aggressive power management. "

(I think it means s/Shutdown/Sleep in the first sentence)

Our systemd has a patch 0016-Add-poweroff-reboot-suspend-hibernate-fallback.patch which calls the executables from pm-utils in the case that the systemd D-Bus API isn't available (which is the case for us). Usually, logind calls shutdown/suspend/... methods via systemd jobs. In our case, since we call these executables directly, the jobs aren't used and so the standard systemd Job* signals aren't sent. It's these signals that logind listens for to know when to emit the PrepareFor{Sleep,Shutdown} (false) signals.

I attach a strawman patch (diff of a diff - look at it after applying) which explicitly sends the signal and does some other needed cleanups (see bus_message_filter for the call site for where the signal is usually sent). Let me know what you think.

Tags: patch
Revision history for this message
Iain Lane (laney) wrote :
tags: added: patch
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
status: New → Triaged
Revision history for this message
Martin Pitt (pitti) wrote :

Thanks! I simplified the patch a bit to avoid moving the whole function (I just added a forward declaration) and another "ret" variable, but the spirit of it works very well. Tested with

  sudo dbus-monitor --system "type='signal',sender='org.freedesktop.login1',interface='org.freedesktop.login1.Manager'"


  gdbus call --system --dest org.freedesktop.login1 --object-path /org/freedesktop/login1 -m org.freedesktop.login1.Manager.Suspend false

Changed in systemd (Ubuntu):
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 198-0ubuntu9

systemd (198-0ubuntu9) raring; urgency=low

  * debian/tests/control: Add libpam-systemd dependency for logind test, as
    it checks for the mounted cgroup. Mounting that moved into libpam-systemd,
    see 198-0ubuntu7.
  * Drop usr/lib/systemd/ from systemd-services, this doesn't belong there and
    is already installed into systemd.
  * 0016-Add-poweroff-reboot-suspend-hibernate-fallback.patch: Send
    PrepareFor{Sleep,Shutdown}() signals with "false" after the operation
    finished. Thanks to Iain Lane for the initial patch! (LP: #1157122)
 -- Martin Pitt <email address hidden> Tue, 26 Mar 2013 11:08:39 +0100

Changed in systemd (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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