about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2014-04-12 12:46:34 +0200
committerMichael Biebl <biebl@debian.org>2014-04-12 12:56:33 +0200
commit3b5d274bf03bffc800173d619def8b8e467d504c (patch)
tree75f56715cd031a8486f4fcbfe8d17f55e00c5007
parentd7fc4e779a6ad704def2f942b1af0d3ecffb26ea (diff)
Don't setup Sleep Monitor if system was not booted with systemd
With a standalone logind we don't receive the Resume signal after a suspend
request and NetworkManager remains in sleep mode where the devices are
unmanaged.

Closes: #742933
-rw-r--r--debian/changelog7
-rw-r--r--debian/patches/0004-Don-t-setup-Sleep-Monitor-if-not-booted-with-systemd.patch76
-rw-r--r--debian/patches/series1
3 files changed, 84 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index f0690fdc..d7110551 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,15 @@
 network-manager (0.9.8.8-6) UNRELEASED; urgency=medium
 
+  [ Laurent Bigonville ]
   * Rework the fix for #734460, kill NetworkManager in the postinst script
     instead of the preinst one to minimize downtime on big upgrades
 
+  [ Michael Biebl ]
+  * Don't setup Sleep Monitor if system was not booted with systemd. With a
+    standalone logind we don't receive the Resume signal after a suspend
+    request and NetworkManager remains in sleep mode where the devices are
+    unmanaged. (Closes: #742933)
+
  -- Laurent Bigonville <bigon@debian.org>  Fri, 04 Apr 2014 01:42:47 +0200
 
 network-manager (0.9.8.8-5) unstable; urgency=medium
diff --git a/debian/patches/0004-Don-t-setup-Sleep-Monitor-if-not-booted-with-systemd.patch b/debian/patches/0004-Don-t-setup-Sleep-Monitor-if-not-booted-with-systemd.patch
new file mode 100644
index 00000000..3be32612
--- /dev/null
+++ b/debian/patches/0004-Don-t-setup-Sleep-Monitor-if-not-booted-with-systemd.patch
@@ -0,0 +1,76 @@
+From: Michael Biebl <biebl@debian.org>
+Date: Sat, 12 Apr 2014 12:38:09 +0200
+Subject: Don't setup Sleep Monitor if not booted with systemd
+
+NetworkManager uses systemd for suspend/resume support. It listens for
+the PrepareForSleep and Resume D-Bus signal sent by logind/systemd and
+deactivates the interfaces on sleep and reactivates them on resume.
+With a standalone logind we don't get a Resume signal and
+NetworkManager remains in sleep mode where the devices are unmanaged.
+As a workaround, skip the Sleep Monitor setup if not booted with
+systemd.
+
+Closes: #742933
+---
+ configure.ac                   | 3 ++-
+ src/Makefile.am                | 2 ++
+ src/nm-sleep-monitor-systemd.c | 5 +++++
+ 3 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 6f40bad..e14e98c 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -322,7 +322,8 @@ fi
+ case $with_suspend_resume in
+     upower) ;;
+     systemd)
+-	PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183])
++	# Link against libsystemd-daemon for sd_booted()
++	PKG_CHECK_MODULES(SYSTEMD_INHIBIT, [libsystemd-login >= 183 libsystemd-daemon])
+         ;;
+     *)
+ 	AC_MSG_ERROR(--with-suspend-resume must be one of [upower, systemd])
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 3ca5a7d..c03706e 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -300,6 +300,7 @@ NetworkManager_CPPFLAGS = \
+ 	$(LIBNL_CFLAGS) \
+ 	$(POLKIT_CFLAGS) \
+ 	$(SYSTEMD_LOGIN_CFLAGS) \
++	$(SYSTEMD_INHIBIT_CFLAGS) \
+ 	$(LIBSOUP_CFLAGS) \
+ 	-DBINDIR=\"$(bindir)\" \
+ 	-DSBINDIR=\"$(sbindir)\" \
+@@ -341,6 +342,7 @@ NetworkManager_LDADD = \
+ 	$(LIBNL_LIBS) \
+ 	$(POLKIT_LIBS) \
+ 	$(SYSTEMD_LOGIN_LIBS) \
++	$(SYSTEMD_INHIBIT_LIBS) \
+ 	$(LIBSOUP_LIBS) \
+ 	$(LIBM) \
+ 	$(LIBDL)
+diff --git a/src/nm-sleep-monitor-systemd.c b/src/nm-sleep-monitor-systemd.c
+index 576cb14..3eb6091 100644
+--- a/src/nm-sleep-monitor-systemd.c
++++ b/src/nm-sleep-monitor-systemd.c
+@@ -25,6 +25,7 @@
+ #include <dbus/dbus-glib.h>
+ #include <gio/gio.h>
+ #include <gio/gunixfdlist.h>
++#include <systemd/sd-daemon.h>
+ 
+ #include "nm-logging.h"
+ #include "nm-dbus-manager.h"
+@@ -304,6 +305,10 @@ sleep_setup (NMSleepMonitor *self)
+ static void
+ nm_sleep_monitor_init (NMSleepMonitor *self)
+ {
++	if (!sd_booted()) {
++		nm_log_warn (LOGD_SUSPEND, "Skipping Sleep Monitor setup, system not booted with systemd");
++		return;
++	}
+ 	self->inhibit_fd = -1;
+ 	sleep_setup (self);
+ 	take_inhibitor (self);
diff --git a/debian/patches/series b/debian/patches/series
index 251dba2a..43a216a5 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Add-D-Bus-policy-for-group-netdev.patch
 0002-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch
 0003-Force-online-state-with-unmanaged-devices.patch
+0004-Don-t-setup-Sleep-Monitor-if-not-booted-with-systemd.patch