From 9f2ef0dabec9d7644f3f13e6d9e2037396493c6d Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 22 Jun 2013 11:05:11 +0200 Subject: [PATCH] Filter the systemd cgroup from the current process logind relies on the name=systemd:/ cgroup path to determine the session name and seat through pam_systemd. The problem arises when the user log into a tty or via ssh and restart a service: the name=systemd cgroup is not cleared and it gets inherited by all the child processes spawned by the service. --- sh/runscript.sh.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 58e8eac..ba8eeb4 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -249,6 +249,12 @@ while [ -n "$1" ]; do cd / continue fi + if [ "$1" = start ] && [ -d /sys/fs/cgroup/systemd ]; then + # reset the systemd cgroup so that it won't be + # propagated to children. This makes logind work, + # which otherwise gets confused. + echo $$ > /sys/fs/cgroup/systemd/tasks + fi # See if we have the required function and run it for _cmd in describe start stop status ${extra_commands:-$opts} \ $extra_started_commands $extra_stopped_commands -- 1.8.2.1