Systemd automount using davfs2 not working

Hello,

I’m failing to configure systemd automount using davfs2 in /etc/fstab, means this config
https://cloud.<mydomain>/remote.php/dav/files/<user>/ /home/osmc/nextcloud davfs ro,user,noexec,nofail,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=30 0 0
fails with error

osmc@osmc:~$ mount nextcloud/
Unknown option x-systemd.automount.
Usage:
    mount.davfs -V,--version   : print version string
    mount.davfs -h,--help      : print this message

To mount a WebDAV-resource don't call mount.davfs directly, but use
`mount' instead.
    mount <mountpoint>  : or
    mount <server-url>  : mount the WebDAV-resource as specified in
                          /etc/fstab.
    mount -t davfs <server-url> <mountpoint> [-o options]
                        : mount the WebDAV-resource <server-url>
                          on mountpoint <mountpoint>. Only root
                          is allowed to do this. options is a
                          comma separated list of options.

Recognised options:
    conf=        : absolute path of user configuration file
    uid=         : owner of the filesystem (username or numeric id)
    gid=         : group of the filesystem (group name or numeric id)
    file_mode=   : default file mode (octal)
    dir_mode=    : default directory mode (octal)
    ro           : mount read-only
    rw           : mount read-write
    [no]exec     : (don't) allow execution of binaries
    [no]suid     : (don't) allow suid and sgid bits to take effect
    [no]grpid    : new files (don't) get the group id of the directory
                   in which they are created.
    [no]_netdev  : (no) network connection needed

With Arch LInux systemd automount works w/o problems, therefore my conclusion is that issue is related to davfs2 version.
In Debian davfs2 1.6.0-1 is installed, in Arch Linux davfs2 1.7.0-1.

Would you agree with this conclusion?
Or is systemd automount generally not working?

THX

Hi,

mounting davfs is not something I’m overly familiar with, but a google search suggests it should.

I also found this:

https://bbs.archlinux.org/viewtopic.php?id=148440

Does it still fail after a reboot?

Regards Tom.

Well, the error message is pointing to the cause:
Unknown option x-systemd.automount.

In addition to this issue, the network device is not mounted after booting with this line in /etc/fstab:
https://cloud.<mydomain>/remote.php/dav/files/<user>/ /home/osmc/nextcloud davfs ro,user,uid=osmc,noexec,nofail,_netdev,auto 0 0

This means I must mount the network device manually, and this is not for usage w/o CLI.

Hi,

I’ll test with my nextcloud instance and get back to you.

Regards Tom.

Some additional info…
Checking system journal I can see this error:

Nov 26 23:52:01 osmc systemd[1]: Mounting /home/osmc/nextcloud...
-- Subject: A start job for unit home-osmc-nextcloud.mount has begun execution
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit home-osmc-nextcloud.mount has begun execution.
-- 
-- The job identifier is 657.
Nov 26 23:52:01 osmc mount.davfs[3348]: davfs2 1.6.0
Nov 26 23:52:01 osmc systemd[1]: home-osmc-nextcloud.mount: Mount process exited, code=exited, status=255/EXCEPTION
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- An n/a= process belonging to unit home-osmc-nextcloud.mount has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 255.
Nov 26 23:52:01 osmc systemd[1]: home-osmc-nextcloud.mount: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- The unit home-osmc-nextcloud.mount has entered the 'failed' state with result 'exit-code'.
Nov 26 23:52:01 osmc systemd[1]: Failed to mount /home/osmc/nextcloud.
-- Subject: A start job for unit home-osmc-nextcloud.mount has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
-- 
-- A start job for unit home-osmc-nextcloud.mount has finished with a failure.
-- 
-- The job identifier is 657 and the job result is failed.

This error can be reproduced by executing this command:
sudo systemctl start home-osmc-nextcloud.mount

However, executing command mount ~/nextcloud works w/o problems and network device is mounted:

osmc@osmc:~$ mount ~/nextcloud/
osmc@osmc:~$ mount | grep davfs
https://cloud.<mydomain>/remote.php/dav/files/<user>/ on /home/osmc/nextcloud type fuse (ro,nosuid,nodev,noexec,relatime,user_id=1000,group_id=1000,allow_other,max_read=16384,uid=1000,gid=1000,user=osmc,helper=davfs)

I see a correlation to systemd.mount, but I think the root cause is davfs2.

Hi,

Working fine here:

sudo apt-get install davfs2
sudo vi /etc/davfs2/secrets:
     https://nc.example.co.uk/remote.php/dav/files/example-user "example-user" "!Password!"
sudo vi /etc/fstab:
     https://nc.example.co.uk/remote.php/dav/files/example-user /home/osmc/nextcloud davfs ro,user,noexec,nofail,_netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=30 0 0
sudo systemctl daemon-reload
sudo mount nextcloud

At this point its mounted and I can see my files.

After reboot, its not mounted till I cd or ls nextcloud/. Which is as expected with fstab options used.

So its not davfs2, but its not clear why its not working for yourself at this point.

Regards Tom.

Hi Tom,
thanks for sharing your results.

What hardware are you using?
What Linux kernel have you installed?
What version of systemd have you installed?
What version of davfs2 have you installed?

Your finding meets my expectation, and you’re using exactly the same configuration (davfs2/secrects and /etc/fstab). Therefore the cause must be software related.

Hi,

Tested on vero4k+, latest update.

This clearly isn’t the case, presuming you are running the latest update of OSMC.

Regards Tom.

Regards Tom.

Actually I’m running latest OSMC.

Please share the versions of Linux kernel, systemd and davfs2.

4.9.269-16-osmc
systemd 247 (247.3-7+deb11u1)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=unified

davfs2 armhf 1.6.0-1

Thanks.

This means everthing is identical in your device.
But yours is working, and mine is failing.

Update:
I have identified the root cause and fixed the issue.
Files /etc/davfs2/secrets and ~/.davfs/secrets must be identical.

1 Like