[Solved] webdav mounted in fstab times out at bootup.

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

[Solved] webdav mounted in fstab times out at bootup.

Post by lonely_llama »

I have a Nextcloud account on Disroot and they offer WebDAV access, which I configured as a mountable partition as per instructions.

This is my fstab entry -

Code: Select all

https://cloud.disroot.org/remote.php/webdav/ /home/user/disroot davfs user,rw 0 0
It works fine in the sense I can mount it on demand.

At bootup, it tries to connect even though it is not marked as automount, and times out. Is it that it is trying to connect before the network connection could be configured? How do I fix this?
Last edited by lonely_llama on Sun Jun 28, 2020 2:37 am, edited 1 time in total.
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: webdav mounted in fstab times out at bootup.

Post by rene »

Rather than filesystema in /etc/fstab having to be "marked as automount" to mount automatically on boot those you do not want to mount automatically need to be marked noauto so at least it indeed would try and mount it at boot.

systemd has a list of filesystems that automatically imply _netdev which will assumedly (i.e., not checked) include davfs so that's likely not it either: do you have /home and/or /home/user split of from the root filesystem and/or do you use home directory encryption? I.e., does after sudo mkdir /mnt/disroot the fstab line

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs	rw
work? If yes, I'd just do

Code: Select all

rmdir ~/disroot
ln -s /mnt/disroot ~/
and keep it under /mnt. You may want to add e.g. ,uid=you,gid=you to the options after rw with "you" your username.
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

Re: webdav mounted in fstab times out at bootup.

Post by lonely_llama »

rene wrote:
Fri Jun 26, 2020 10:21 am
Rather than filesystema in /etc/fstab having to be "marked as automount" to mount automatically on boot those you do not want to mount automatically need to be marked noauto so at least it indeed would try and mount it at boot.
So should I just add noauto? I didn't get why it was unable to connect at boot - does the network interface get activated only upon login, since I've seen it takes a few seconds for the tray icon to show up. I rarely reboot my laptop and just usually hibernate.

I have everything on one partition - this is a loaned laptop that was migrated directly from Windows to Linux without any repartitioning.
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: webdav mounted in fstab times out at bootup.

Post by rene »

I gave a specific line for /etc/fstab and need to know if that one works to know what to usefully advise.
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

Re: webdav mounted in fstab times out at bootup.

Post by lonely_llama »

Didn't work, still the same timeout at bootup.
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: webdav mounted in fstab times out at bootup.

Post by rene »

Good, as that denies possibility of basically all local issues. Well, lovely again. As can be seen on

https://github.com/systemd/systemd/blob ... til.c#L290

davfs is part of the filesystem types systemd recognizes as network filesystems automatically. Except that it is not in the older version of systemd that is shipped on Mint 19.3. systemd uses this determination exactly to wait or not wait for the network to be up so it'll supposedly in your case work to explicitly add _netdev to the options:

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs	_netdev,rw,uid=foo,gid=foo
or, then, under your home directory after all if you insist, but as reflected in the fact that I now had to get you to mount it elsewhere first as debugging information, this is not best practice: mounting to somewhere under /mnt or perhaps /media and optionally symlinking from your home directory as I advised is better. "foo" you will of course want to replace with your username, that which the command whoami returns.

Now, this supposedly works, but I in fact for any network filesystem tend to advise automounting since there's of course many other potential reasons that a network filesystem isn't reachable at boot, causing the same issue all over again. I.e., what I would advise is this instead:

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs	_netdev,rw,uid=foo,gid=foo,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10m
which only attempts to mount the filesystem when it is in fact accessed. When you link from your home directory that's less useful due to desktop/filemanager startup in fact accessing it at login, but still, works fine, and foregoes most issues.
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

Re: webdav mounted in fstab times out at bootup.

Post by lonely_llama »

I tried the last line

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs	_netdev,rw,uid=foo,gid=foo,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10m
but it says Unknown option x-systemd.mount-timeout=10s.
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: webdav mounted in fstab times out at bootup.

Post by rene »

Yes, it would, terribly sorry, sloppy mental cut & paste.

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs	noauto,_netdev,rw,uid=foo,gid=foo,x-systemd.automount,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10m
I.e., I missed noauto and x-systemd.automount itself. Badbad.

Also, again, you will of course need to change foo to your username (twice).
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

Re: webdav mounted in fstab times out at bootup.

Post by lonely_llama »

Now it even refuses to recognize x-systemd.automount :(
Also, if I set uid and gid, I can't mount it from my user account, have to specify 'user' only. So now it looks like this, but doesn't recognize the automount.

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs 	noauto,_netdev,rw,user,x-systemd.automount,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10m
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: webdav mounted in fstab times out at bootup.

Post by rene »

Ah, you are still manually mounting: the entire idea of the fstab route is that you would no longer be, that it's always mounted, in the x-systemd.automount case conceptually, i.e., only when in fact accessed (I don't see authentication details in there so I've been wondering about that, but I took/take your initial specification for granted.

However, let's now get this straight. Do you want the filesystem always mounted, conceptually or otherwise, as is the normal case when using fstab, or do you simply want to mount manually with e.g. mount /mnt/disroot and just not have the boot sequence complain? In latter case, you'd have

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/disroot	davfs 	noauto,_netdev,user,rw
and supposedly no need for the uid/gid specification. If this is the case/want then the answer would've from the beginning been noauto and I could've saved you a bit of time (_netdev is still good to specify, but not essential in that case).

If as I was assuming the desire is for a permanent mount, and even though the authentication thing might be an issue here, rebooting with that last advised fstab line should work to after reboot have it mounted conceptually always --- although it should also not in fact be the case that a manual mount would complain so still wondering what's up there, but I now expect that above is all you ever needed. Pardon the detours in that case.
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

Re: webdav mounted in fstab times out at bootup.

Post by lonely_llama »

Ideally it would get mounted the first time I access the directory from my user account, but no matter what, it refuses to recognize the automount parameters. I've removed that from fstab and for now at least noauto prevents it from blocking at boot up.
But having to mount the directory manually each time between hibernate/resume has got to be a pain (I very rarely reboot my laptop). Is there anything else I can try? Changing the mount point to under /mnt vs keeping it in my home directory doesn't make a difference.
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: webdav mounted in fstab times out at bootup.

Post by rene »

After sudo apt-get install davfs2 (and allowing mount.davfs to be setuid root as it asks upon install) and with this in my /etc/fstab:

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/mnt/tmp	davfs 	noauto,_netdev,uid=rene,gid=rene,x-systemd.automount,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10m
it is after a reboot enough to just access /mnt/tmp to have the mount attempt triggered as expected. Manual sudo mount /mnt/tmp works as well, insofar that it is requesting username and password. I see you normally have those stored in /etc/davfs2/secrets which I assume you have: I do not have an account so can not test more than that.

Worse still, the systemd automount, while it triggers as a result of simply ls /mnt/tmp say, actually dumps core here:

Code: Select all

jun 27 17:20:36 hp8k mount.davfs[1786]: davfs2 1.5.4
jun 27 17:20:36 hp8k systemd[1]: Created slice system-systemd\x2dcoredump.slice.
jun 27 17:20:36 hp8k systemd[1]: Started Process Core Dump (PID 1787/UID 0).
jun 27 17:20:36 hp8k systemd[1]: mnt-tmp.mount: Mount process exited, code=exited status=255
jun 27 17:20:36 hp8k systemd[1]: mnt-tmp.mount: Failed with result 'exit-code'.
jun 27 17:20:36 hp8k systemd[1]: Failed to mount /mnt/tmp.
jun 27 17:20:36 hp8k systemd-coredump[1788]: Process 1786 (mount.davfs) of user 0 dumped core.
                                             
                                             Stack trace of thread 1786:
                                             #0  0x00007ff70788ce97 __GI_raise (libc.so.6)
                                             #1  0x00007ff70788e801 __GI_abort (libc.so.6)
                                             #2  0x000055f01c9e9040 n/a (mount.davfs)
                                             #3  0x000055f01c9de25c n/a (mount.davfs)
                                             #4  0x00007ff70786fb97 __libc_start_main (libc.so.6)
                                             #5  0x000055f01c9de309 n/a (mount.davfs)
I'm afraid I'm not going to debug that: I have no personal interest in webdav. Might of course just be a result of in my case failed authentication: in any case not seeing anything definitely not working or working differently than normal here other than said segfault.
User avatar
lonely_llama
Level 3
Level 3
Posts: 121
Joined: Mon Jul 22, 2019 12:08 am

Re: webdav mounted in fstab times out at bootup.

Post by lonely_llama »

Finally works! :D
This is what my fstab looks like now

Code: Select all

https://cloud.disroot.org/remote.php/webdav/	/home/user/disroot	davfs	  noauto,_netdev,rw,uid=user,gid=group,x-systemd.automount,x-systemd.mount-timeout=10s,x-systemd.idle-timeout=10m 0 0
No idea why it didn't work before, but well. Thank you so much for your help, you've been very patient!
rene
Level 20
Level 20
Posts: 10674
Joined: Sun Mar 27, 2016 6:58 pm

Re: [Solved] webdav mounted in fstab times out at bootup.

Post by rene »

Very good. Very minor comment: the "0 0" at the end of an fstab line you can always leave out: they are implied if missing (documented in man fstab).
Post Reply

Return to “Software & Applications”