Bug 69989

Summary: StopWhenUnneeded=yes does not stop service even though there's nothing depending on it
Product: systemd Reporter: Bruno Dutra <brunocodutra>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Bruno Dutra 2013-10-01 02:18:08 UTC
I have a very simple mount file like follows

[Unit]
BindsTo=dev-disk-by\<DEVICE DESCRIPTOR>.device
Conflicts=umount.target
Before=umount.target
After=dev-disk-by\<DEVICE DESCRIPTOR>.device
StopWhenUnneeded=true

[Mount]
What=/dev/disk/by-uuid/<DEVICE UUID>
Where=/mount/point
Type=ext4

I also have a service which BindsTo and is set to be executed After the previous mount file. 

When this service is started, after plugging the device in and having udev detect it, the mount file is started as expected and the mount point successfully established. The service executes a simple task and finishes successfully. The mount file is expected to be sopped given StopWhenUnneeded is set to true, but that does not occur and the mount point is left mounted until manual intervention.

In a previous version, which I sadly cannot precise, this setup used to behave as expected.
Comment 1 Bruno Dutra 2013-10-01 02:30:02 UTC
My current setup is an Archlinux x86_64 box running systemd 207:

uname -a
Linux _____ 3.11.2-1-ARCH #1 SMP PREEMPT Fri Sep 27 07:35:36 CEST 2013 x86_64 GNU/Linux

systemctl --version
systemd 207
+PAM -LIBWRAP -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ
Comment 2 Lennart Poettering 2014-02-21 17:17:54 UTC
This should be fixed in 209. Please test.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.