Hello, I'm trying to migrate my setup from systemd.mount[1] to autofs/automount userspace daemon. I have a local disk encrypted with LUKS and a samba share with a keyfile for this disk. The goal is to automatically mount and decrypt this disk when connected to my home network. Below is my configuration. I'm mounting the encrypted disk with /sbin/mount.crypt helper from pam_mount[2]. # Master map file /- /home/mliszcz/var/autofs/router.map --timeout=60 /- /home/mliszcz/var/autofs/disk.map --timeout=60 # router.map /mnt/router -fstype=cifs,ro,guest,vers=2.0 ://172.18.0.5/USB_DISK # disk map /mnt/data -fstype=crypt,keyfile=/mnt/router/encryption.keyfile,fsk_cipher=none :/dev/loop0p1 While /mnt/data is being mounted I'm seeing below logs: attempting to mount entry /mnt/data mount(generic): failed to mount /dev/loop0p1 (type crypt) on /mnt/data failed to mount /mnt/data I debugged this a bit. The mount helper for /mnt/data tries to access /mnt/router/encryption.keyfile, but it does not trigger automounting of /mnt/router. It seems that this is by design - there is already some code in autofs for handling dependent mounts (open(2) call with changed uid/gid to trigger mounting of the dependency before executing the actual mount command). But it only works if the two mounts share the mountpoint prefix. I verified this by changing the daemon/spawn.c file as follows: @@ -454,6 +454,9 @@ static int do_spawn(unsigned logopt, unsigned int wait, * let the VFS handle returns to each individual * waiter. */ + if(strcmp(argv[loc], "/dev/loop0p1") == 0) + fd = open("/mnt/router", O_DIRECTORY); + else fd = open(argv[loc], O_DIRECTORY); if (fd != -1) close(fd); Now I'm wondering if it would be possible to add a generic mechanism for declaring dependencies in autofs maps to make this work. If this could be accepted I can even work on a patch, provided that I get some pointers. Kind regards, Michal [1]: https://www.freedesktop.org/software/systemd/man/systemd.mount.html [2]: https://inai.de/projects/pam_mount/