1

I've set up a systemd automount for an sshfs in /etc/fstab approximately as follows:

me@server:  /mount/point  fuse.sshfs  noauto,_netdev,x-systemd.automount,x-systemd.idle-timeout=900,default_permissions,allow_other,uid=josh,gid=josh,transform_symlinks  0  0

This works great, except that sometimes I'll notice that it's mounted even though I've not accessed it recently. Looking in journalctl, apparently there's a process called pool that's causing systemd to mount it every so often:

$ journalctl -u mount-point.automount -n10
Mar 04 22:17:39 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 11546 (pool)
Mar 04 22:53:03 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 27856 (pool)
Mar 05 00:31:36 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 9083 (pool)
Mar 05 01:44:21 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 32232 (pool)
Mar 05 17:32:31 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 10771 (pool)
Mar 05 17:59:01 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 18662 (pool)
Mar 05 20:05:10 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 3259 (pool)
Mar 05 20:36:21 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 16858 (pool)
Mar 05 22:29:33 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 20812 (pool)
Mar 05 23:39:16 hostname systemd[1]: mount-point.automount: Got automount request for /mount/point, triggered by 15976 (pool)

I've looked for binaries called pool on my system, but I can't find any, and there doesn't appear to be any process called pool running at the moment. I'd rather not hang around watching journalctl until something appears to try and find out what this is, though I guess I'll do that if I have to.

What's making systemd mount my automount?

1

I'm guessing that your automount is located under /media.

I had the same problem, very short-lived processes were triggering my automount every few minutes. Capturing any info about them was remarkably challenging.

For the record, what I did was:

  • First, launch a shell with stdbuf -i0 -oL -eL bash
    (This launches a shell with buffering of pipes adjusted to send every line right away, instead of the default which will buffer a bunch of output before it actually sends anything.)
  • In that shell, run this hideous command-line, which I really should have formatted into a proper script in a .sh file but didn't: \
journalctl --unit UNITNAME.automount -f | grep -oP '(?<=^|[^0-9])[0-9]{4,}(?=[^0-9]|$)' | while read pid; do if [ -e /proc/"$pid"/status ] ; then if [ -e proc-capture/"$pid" ] ; then echo "Already captured PID $pid. Ignoring"; else echo "Capturing $pid."; mkdir proc-capture/"$pid"; cp /proc/"$pid"/status proc-capture/"$pid"; fi; else echo "No current status for PID $pid. Skipping"; fi; done

(Adjusting the unit names as needed and the output directory if you like.)

  • Wait.

Note: You may need root for this. I always add my own regular user account to group adm, which gives read access to system log stuff including journalctl (on Debian, but I would guess that's the same on Ubuntu), so I didn't need sudo or anything for the script to work.

Then, whenever the polling process fires up and does its thing, the script will copy its /proc/<PID>/status into proc-capture/<PID>/ (under your current working directory) immediately, before the process ends and that status file ceases to exist. That file will tell you the PPID, that is, the PID of the parent of the PID in question. In my case, the parent was systemd, doing whatever behind-the-scenes magic is involved in automatically mounting USB drives under /media the moment they're plugged in and such. It may be possible to configure that subsystem to ignore specified directories under /media, but in my case just moving the automount from /media to /mnt made the problem go away so I didn't dig any deeper.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.