FS#31607 - [autofs] autofs does not unmount under systemd

Attached to Project: Community Packages
Opened by hydro (hydro) - Wednesday, 19 September 2012, 10:46 GMT
Last edited by Dave Reisner (falconindy) - Tuesday, 23 October 2012, 09:59 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Dave Reisner (falconindy)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
When switching to systemd using init=/usr/lib/systemd/systemd (and with rc.conf renamed) autofs no longer unmounts media or network shares after timeout. Rebooting with sysvinit (and rc.conf restored) makes autofs unmount expired media as before.

In openSUSE 12.2 (uses systemd) autofs works (i.e. does mount and unmount).

Additional info:
* package version(s)
autofs 5.0.7-1
systemd 189-4

I uninstalled gamin (mentioned in #25720), gvfs, udisks and udisks2 before testing.

* config and/or log files etc.
Sample configuration used for testing in console session:

#/etc/conf.d/autofs
daemonoptions='--debug'
OPTIONS=--debug

#/etc/autofs/auto.master
/media/misc /etc/autofs/auto.misc --timeout=5

#/etc/autofs/auto.misc
usbstick -fstype=ext4 :/dev/disk/by-uuid/ba50053b-2db7-44ad-9d44-50bad3d4638e

Excerpts of /var/log/daemon.log (for systemd and sysvinit) attached.

Steps to reproduce:
Install and configure autofs. Boot with systemd. Access directory observed by autofs to make it mount. Leave mounted device unused (check with fuser) and wait for timeout. Device never gets umounted.
This task depends upon

Closed by  Dave Reisner (falconindy)
Tuesday, 23 October 2012, 09:59 GMT
Reason for closing:  Fixed
Additional comments about closing:  systemd-194
Comment by hydro (hydro) - Thursday, 20 September 2012, 08:17 GMT
I have now disabled all services and enabled them one by one to see whether they affect autofs unmounting.
The following services must be stopped/disabled to make autofs work properly:

ntpd.service
cupsd.service
colord-service
colord-sane.service

The latter two are started as dependencies of cupsd.
Comment by hydro (hydro) - Thursday, 20 September 2012, 14:43 GMT
If I start ntpd manually or via the old rc-script, autofs is not affected.
The daemons mentioned above all have PrivateTmp=yes or PrivateTmp=true in their service file. Except for cups.service there is no other service file in /usr/lib/systemd/system/ that contains PrivateTmp.
If I set PrivateTmp=no in ntpd.service, autofs is not affected.
Comment by Dave Reisner (falconindy) - Thursday, 20 September 2012, 14:45 GMT
Makes zero sense. You need to provide logs to show some sort of a failure by autofs.
Comment by hydro (hydro) - Thursday, 20 September 2012, 18:18 GMT
daemon_sysvinit.log shows autofs unmounting (starting with "handle_packet: type = 4"), daemon_systemd.log does not, that's all. I don't think autofs can be more verbose.
Comment by Dave Reisner (falconindy) - Thursday, 20 September 2012, 19:04 GMT
automount(8) describes a --verbose flag that you need to use....
Comment by hydro (hydro) - Thursday, 20 September 2012, 19:35 GMT
I used --debug, which is more verbose than --verbose
Comment by hydro (hydro) - Friday, 21 September 2012, 17:48 GMT Comment by Dave Reisner (falconindy) - Friday, 21 September 2012, 18:06 GMT
It might be related... can you post the output of /proc/$pid/mountinfo, where $pid is the PID for a service with a PrivateTmp? Notably, you're looking for the autofs mountpoint in that mountinfo.

You might also try:

- stopping all services with PrivateTmp
- mount --make-private /
- restarting services with PrivateTmp
- triggering autofs mount, then see if it times out.
Comment by hydro (hydro) - Saturday, 22 September 2012, 11:11 GMT
Attached /proc/ntpd/mountinfo
a) after boot and autofs mount
b) after boot followed by procedure described above followed by autofs mount

Not timeout in both cases. Autofs mountpoint is /media/misc/usbstick.
Comment by Dave Reisner (falconindy) - Saturday, 22 September 2012, 13:53 GMT
Well you didn't quite do what I wanted, since / still shows as shared in mountinfo_b. Regardless, yes this is related to the redhat bug you posted.
Comment by hydro (hydro) - Tuesday, 25 September 2012, 13:28 GMT
I found out that the problem is solved when only the mountpoints specified in /etc/autofs/auto.master are marked as private before they are accessed/automounted. So I copied /usr/lib/systemd/system/autofs.service to /etc/systemd/system/ and added this to the [Service] section:

ExecStartPost=/bin/mount --make-private /media/misc/
ExecStartPost=/bin/mount --make-private /media/net/

After "systemctl --system daemon-reload" and reboot this make autofs unmount as before.
Comment by Dave Reisner (falconindy) - Tuesday, 25 September 2012, 13:53 GMT
If you're on x86_64, please test systemd-191 without the altered propagation flags.
Comment by hydro (hydro) - Tuesday, 25 September 2012, 14:38 GMT
No timeout with systemd-191. Modification of autofs.service still required.
Same with systemd-192 and 194.
Comment by hydro (hydro) - Tuesday, 23 October 2012, 08:12 GMT
Checked again today with systemd 194-4. Seems to be fixed. Custom autofs.service is no longer required.
Edit: This was actually a kernel issue. Update 3.5.6 -> 3.6.2 solved it.

Loading...