No oom-kill notifications on some systems
At Tails we would like our users to be notified when the system is running out of memory. The systemd OOM notification functionality of gnome-settings-daemon seems perfect for that. Unfortunately it doesn't seem to work in Debian, which Tails is based on - neither in Debian stable (gnome-settings-daemon version 43.0-4) nor Debian unstable (currently version 46.0-1).
I investigated and found that on Debian, systemd doesn't send any signals about units being started or stopped unless the Subscribe()
method of org.freedesktop.systemd1.Manager
is being called - and according to the documentation, that seems to be expected:
Subscribe() enables most bus signals to be sent out. Clients which are interested in signals need to call this method. Signals are only sent out if at least one client invoked this method.
On Fedora, it works without calling that method, but given the systemd documentation, I suspect that gnome-settings-daemon should call that method to ensure that signals are sent.
It works on Debian unstable when I apply this patch and rebuild the package:
diff --git a/plugins/housekeeping/gsd-systemd-notify.c b/plugins/housekeeping/gsd-systemd-notify.c
index 39984f5d..57421cc5 100644
--- a/plugins/housekeeping/gsd-systemd-notify.c
+++ b/plugins/housekeeping/gsd-systemd-notify.c
@@ -204,6 +204,22 @@ on_bus_gotten (GDBusConnection *obj,
}
self->session = con;
+
+ // Subscribe to systemd events by calling Subscribe on
+ // org.freedesktop.systemd1.Manager
+ g_dbus_connection_call (self->session,
+ "org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "Subscribe",
+ NULL,
+ G_VARIANT_TYPE ("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+
self->sub_service = g_dbus_connection_signal_subscribe (self->session,
"org.freedesktop.systemd1",
"org.freedesktop.DBus.Properties",