Package: systemd Version: 44-5 Severity: normal Hello systemd maintainers,
Filing this as a bug report so that it is publicly accessible for future reference. I am trying to prepare a systemd service file for Laptop Mode Tools and have run into some problems. LMT is a power saving tool written in shell. It has a polling script that starts from the main script, and then detaches itself to keep running in a loop. >From what I have investigated so far, it looks like systemd prefers to create a cgroup for each service and keep all its associated processes together. This seems to create problems for LMT. It's polling script does not seem to be getting detached from the parent calling process. rrs@champaran:/run/lock$ sudo systemctl status laptop-mode.service [sudo] password for rrs: laptop-mode.service - Laptop Mode Tools Loaded: loaded (/lib/systemd/system/laptop-mode.service; enabled) Active: active (running) since Sun, 28 Oct 2012 13:59:28 +0530; 17min ago Process: 14102 ExecStopPost=/bin/rm -f /var/run/laptop-mode-tools/enabled (code=exited, status=0/SUCCESS) Process: 13394 ExecStop=/usr/sbin/laptop_mode stop (code=exited, status=0/SUCCESS) Process: 14174 ExecStartPre=/usr/bin/touch /var/run/laptop-mode-tools/enabled (code=exited, status=0/SUCCESS) Process: 14172 ExecStartPre=/usr/bin/install -d /var/run/laptop-mode-tools (code=exited, status=0/SUCCESS) Main PID: 14176 (laptop_mode) CGroup: name=systemd:/system/laptop-mode.service ├ 14176 /bin/sh /usr/sbin/laptop_mode auto ├ 14197 /bin/sh /usr/share/laptop-mode-tools/module-helpers/lm-polling-daemon └ 15964 sleep 150 Ideally, pid 14197 should have been backgrounded, and pid 14176 should have clean exited, leaving pid 14197 to loop. It does not allow that. Here is the list of locks not released: rrs@champaran:/run/lock$ sudo lsof lm* COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME laptop_mo 14176 root 7w REG 0,14 0 3664 lmt-battpoll.lock laptop_mo 14176 root 8w REG 0,14 0 6980 lmt-req.lock laptop_mo 14176 root 9w REG 0,14 0 3682 lmt-invoc.lock lm-pollin 14197 root 7w REG 0,14 0 3664 lmt-battpoll.lock sleep 16138 root 7w REG 0,14 0 3664 lmt-battpoll.lock The lock for lmt-battpoll.lock should only be with lm-polling-daemon. But since systemd never disassociated it from the group, the lock is held. This leads to further invocations of LMT to fail because they can't acquire the lock. I have verified this with SysV init and it works perfectly fine there. Here is my .service file: rrs@champaran:/run/lock$ cat /lib/systemd/system/laptop-mode.service [Unit] Description=Laptop Mode Tools [Service] Type=simple ExecStartPre=/usr/bin/install -d /var/run/laptop-mode-tools ; /usr/bin/touch /var/run/laptop-mode-tools/enabled ExecStart=/usr/sbin/laptop_mode auto ExecStop=/usr/sbin/laptop_mode stop ExecStopPost=/bin/rm -f /var/run/laptop-mode-tools/enabled StandardOutput=tty StandardError=tty [Install] WantedBy=multi-user.target I have tried for Type=simple and Type=oneshot. Both seem to be inheriting the same problem. Ritesh -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (100, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.5-trunk-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages systemd depends on: ii dpkg 1.16.9 ii initscripts 2.88dsf-32 ii libacl1 2.2.51-8 ii libaudit0 1:1.7.18-1.1 ii libc6 2.13-36 ii libcap2 1:2.22-1.2 ii libcryptsetup4 2:1.4.3-2 ii libdbus-1-3 1.6.8-1 ii libkmod2 9-2 ii liblzma5 5.1.1alpha+20120614-1 ii libpam0g 1.1.3-7.1 ii libselinux1 2.1.9-5 ii libsystemd-daemon0 44-5 ii libsystemd-id128-0 44-5 ii libsystemd-journal0 44-5 ii libsystemd-login0 44-5 ii libudev0 175-7 ii libwrap0 7.6.q-24 ii udev 175-7 ii util-linux 2.20.1-5.2 Versions of packages systemd recommends: ii libpam-systemd 44-5 Versions of packages systemd suggests: ii python 2.7.3-3 ii python-cairo 1.8.8-1+b2 ii python-dbus 1.1.1-1 ii systemd-gui 44-5 -- Configuration Files: /etc/systemd/system.conf changed: [Manager] LogLevel=info LogTarget=journal-or-kmsg LogColor=yes ShowStatus=yes SysVConsole=yes MountAuto=yes SwapAuto=yes -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org