On 2017-08-17 08:13, Per Jessen wrote:
My test case is just auto mounting an ISO image:
/tmp/openSUSE-13.2-NET-i586.iso /tmp/anton iso9660 loop,noauto,x-systemd.automount,x-systemd.idle-timeout=60,nofail 0 0
systemctl daemon-reload systemctl --all | grep anton
tmp-anton.automount tmp-anton.mount
ls -l /tmp/anton
office36:~ # l /tmp/anton/ total 752 dr-xr-xr-x 5 root root 2048 Nov 10 2011 ./ drwxrwxrwt 13 root root 745472 Aug 17 08:08 ../ -r--r--r-- 1 root root 133 Nov 10 2011 ARCHIVES.gz dr-xr-xr-x 3 root root 2048 Nov 10 2011 boot/ -r--r--r-- 1 root root 200 Nov 10 2011 ChangeLog -r--r--r-- 1 root root 3470 Nov 10 2011 content -r--r--r-- 1 root root 481 Nov 10 2011 content.asc -r--r--r-- 1 root root 81 Nov 10 2011 directory.yast -r--r--r-- 1 root root 683 Nov 10 2011 INDEX.gz -r--r--r-- 1 root root 1514 Nov 10 2011 ls-lR.gz dr-xr-xr-x 2 root root 2048 Nov 10 2011 media.1/ dr-xr-xr-x 3 root root 2048 Nov 10 2011 suse/
Here is what systemd did, including the unmount after the idle timeout:
Aug 17 08:08:21 office36 systemd[1]: tmp-anton.automount: Got automount request for /tmp/anton, triggered by 14925 (ls) Aug 17 08:08:21 office36 systemd[1]: Mounting /tmp/anton... Aug 17 08:08:21 office36 mount[14926]: mount: /dev/loop0 is write-protected, mounting read-only Aug 17 08:08:21 office36 kernel: ISO 9660 Extensions: Microsoft Joliet Level 3 Dec 31 23:59:58 office36 kernel[885]: Last message 'ISO 9660 Extensions:' repeated 1 times, suppressed by syslog-ng on office36.local.net Aug 17 08:08:21 office36 kernel: ISO 9660 Extensions: RRIP_1991A Aug 17 08:08:21 office36 systemd[1]: Mounted /tmp/anton. Aug 17 08:09:21 office36 systemd[1]: Unmounting /tmp/anton... Aug 17 08:09:21 office36 systemd[1]: Unmounted /tmp/anton.
Very interesting. I'll try with one new nfs mount I'm setting up. I did: telcontar.valinor:/data/storage_c/repositorios_zypp/ /var/cache/zypp/nfs_packages nfs defaults,noauto,x-systemd.automount,x-systemd.idle-timeout=300,_netdev,nfsvers=4 0 0 I verified that I can mount it manually. The mount point is not empty, contains some safety links. Isengard:~ # ls /var/cache/zypp/nfs_packages 42.2 LocalRPMs not_mounted Isengard:~ # systemctl daemon-reload Isengard:~ # systemctl --all | grep nfs_packages var-cache-zypp-nfs_packages.automount loaded inactive dead var-cache-zypp-nfs_packages.automount var-cache-zypp-nfs_packages.mount loaded inactive dead /var/cache/zypp/nfs_packages Isengard:~ # ls /var/cache/zypp/nfs_packages 42.2 LocalRPMs not_mounted Isengard:~ # Isengard:~ # systemctl status var-cache-zypp-nfs_packages.automount ● var-cache-zypp-nfs_packages.automount Loaded: loaded (/etc/fstab; bad; vendor preset: disabled) Active: inactive (dead) Where: /var/cache/zypp/nfs_packages Docs: man:fstab(5) man:systemd-fstab-generator(8) Isengard:~ # systemctl status var-cache-zypp-nfs_packages.mount ● var-cache-zypp-nfs_packages.mount - /var/cache/zypp/nfs_packages Loaded: loaded (/etc/fstab; bad; vendor preset: disabled) Active: inactive (dead) Where: /var/cache/zypp/nfs_packages What: telcontar.valinor:/data/storage_c/repositorios_zypp/ Docs: man:fstab(5) man:systemd-fstab-generator(8) Isengard:~ # Doesn't work here.... I have not rebooted yet. Log: <4.6> 2017-08-17T12:32:06.129930+02:00 Isengard sshd 1432 - - Accepted publickey for root from 192.168.1.14 port 33556 ssh2: DSA SHA256:IL5fWYgcmeebsYvfWB41P1Z/+UrPHNRpaw77F/UWRf0 <10.6> 2017-08-17T12:32:06.131884+02:00 Isengard sshd 1432 - - pam_unix(sshd:session): session opened for user root by (uid=0) <4.6> 2017-08-17T12:32:06.137686+02:00 Isengard systemd-logind 1230 - - New session 3765 of user root. <3.6> 2017-08-17T12:32:06.166072+02:00 Isengard systemd 1 - - Started Session 3765 of user root. <0.5> 2017-08-17T12:32:25.716194+02:00 Isengard kernel - - - [676987.563945] FS-Cache: Loaded <0.5> 2017-08-17T12:32:25.731445+02:00 Isengard kernel - - - [676987.578756] FS-Cache: Netfs 'nfs' registered for caching <0.5> 2017-08-17T12:32:25.735579+02:00 Isengard kernel - - - [676987.583888] Key type dns_resolver registered <0.5> 2017-08-17T12:32:25.748427+02:00 Isengard kernel - - - [676987.595807] NFS: Registering the id_resolver key type <0.5> 2017-08-17T12:32:25.748460+02:00 Isengard kernel - - - [676987.595848] Key type id_resolver registered <0.5> 2017-08-17T12:32:25.748463+02:00 Isengard kernel - - - [676987.595849] Key type id_legacy registered <10.6> 2017-08-17T12:35:01.684069+02:00 Isengard cron 1566 - - pam_unix(crond:session): session opened for user root by (uid=0) <3.6> 2017-08-17T12:35:01.701435+02:00 Isengard systemd 1 - - Started Session 3766 of user root. <10.6> 2017-08-17T12:35:03.931190+02:00 Isengard CRON 1566 - - pam_unix(crond:session): session closed for user root <3.6> 2017-08-17T12:38:49.393551+02:00 Isengard systemd 1 - - Reloading. <3.4> 2017-08-17T12:38:49.617059+02:00 Isengard systemd 1 - - nss-lookup.target: Dependency Before=nss-lookup.target dropped <10.6> 2017-08-17T12:40:01.941073+02:00 Isengard cron 1684 - - pam_unix(crond:session): session opened for user root by (uid=0) <3.6> 2017-08-17T12:40:01.961454+02:00 Isengard systemd 1 - - Started Session 3767 of user root. <10.6> 2017-08-17T12:40:04.187497+02:00 Isengard CRON 1684 - - pam_unix(crond:session): session closed for user root <4.6> 2017-08-17T12:40:32.078181+02:00 Isengard sshd 1713 - - Accepted publickey for root from 192.168.1.14 port 33614 ssh2: DSA SHA256:IL5fWYgcmeebsYvfWB41P1Z/+UrPHNRpaw77F/UWRf0 <10.6> 2017-08-17T12:40:32.080128+02:00 Isengard sshd 1713 - - pam_unix(sshd:session): session opened for user root by (uid=0) <4.6> 2017-08-17T12:40:32.087533+02:00 Isengard systemd-logind 1230 - - New session 3768 of user root. <3.6> 2017-08-17T12:40:32.113514+02:00 Isengard systemd 1 - - Started Session 3768 of user root. The NFS entries there correspond to the manual "mount /var/cache/zypp/nfs_packages" command. -- Cheers / Saludos, Carlos E. R. (from 42.2 x86_64 "Malachite" at Telcontar)