192.168.1.140:/export/shared/mp3
shouldn't work. It isn't a valid export.
192.168.1.140:/export/shared/mp3
shouldn't work. It isn't a valid export.
It shouldn't, but it definitely does.
Obviously the /mp3 directory exists on a network drive.
EDIT: On my laptop the command sudo mount -a works. I understand it uses all the entries from fstab, but for some reason the same entires on boot don't work.
Perhaps it's because the network is not ready yet at the time of mounting? But in theory parameter _netdev should solve it (a system waits with mounting until a network is ready).
EDIT2: Check my boot process and I have services: -.mount, mount-win10.mount, boot-efi.mount and home.mount, then nfs-client.target, then some other services and NetworkManager.service and networkd-dispatcher.service, network.target and network-online.target much later.
Have a look here: https://svgur.com/s/UVG
Do you think this may be a problem?
EDIT3: found another similar problem here: https://ubuntuforums.org/showthread.php?t=2450781
and tried x-systemd.after=network-online.target parameter, but didn't work.
Also found on other forums that disabling ipv6 may help, but in my case it didn't help too.
EDIT4: seems like it was a network issue (network not ready). Added a Systemd service with a small delay and mount. 3 sec delay was too short. It was reporting as Network not reachable. Sleep 10 does the job. It mounts NFS share as intended.
Last edited by kjur; February 28th, 2021 at 11:02 PM.
And as you've found, systemd doesn't give a damn if the network is ready or not, it just runs through fstab with whatever options are there and if it doesn't mount (because the system doesn't have an IP address yet), no matter. This seems to me to be a serious bug. Having to create a service that adds a delay and a mount command is a workaround, one it looks like I'll have to try as well until this is actually fixed.
https://www.freedesktop.org/software...emd.mount.html has the documentation for systemd.mount.
In theory:
Code:fstab .... The NFS mount option bg for NFS background mounts as documented in nfs(5) is detected by systemd-fstab-generator and the options are transformed so that systemd fulfills the job-control implications of that option. Specifically systemd-fstab-generator acts as though "x-systemd.mount-timeout=infinity,retry=10000" was prepended to the option list, and "fg,nofail" was appended. Depending on specific requirements, it may be appropriate to provide some of these options explicitly, or to make use of the "x-systemd.automount" option described below instead of using "bg". _netdev Normally the file system type is used to determine if a mount is a "network mount", i.e. if it should only be started after the network is available. Using this option overrides this detection and specifies that the mount requires network. Network mount units are ordered between remote-fs-pre.target and remote-fs.target, instead of local-fs-pre.target and local-fs.target. They also pull in network-online.target and are ordered after it and network.target. ... Default Dependencies The following dependencies are added unless DefaultDependencies=no is set: ... Network mount units automatically acquire After= dependencies on remote-fs-pre.target, network.target and network-online.target, and gain a Before= dependency on remote-fs.target unless nofail mount option is set. Towards the latter a Wants= unit is added as well.
God bless you, TheFu. I've tried everything. _netdev is mentioned in a lot of places on the 'net but has never worked.
Tonight I read man nfs and thought I had found the answer with options: bg,timeo=150, _netdev,nofail ... and it STILL didn't work. I'd grep nfs syslog and get "mount.nfs: Network is unreachable" shown only once, indicating it didn't retry after the first fail. A reading of the man page suggests it would retry every 15 seconds with those options but nope. Once is all. Network not up yet, systemd says screw it.
What finally made it work is this: x-systemd.automount,nofail
Those are my ONLY options now for 3 NFS mounts. And it finally freaking worked.
It's too bad I didn't see that option mentioned anywhere in the man file, which is irritating. I really wish I could find some thorough, offical, documentation on systemd as I find myself learning it bit-by-bit in my troubleshooting at home and on the servers I manage at work. Combing through forums and posting like a madman eventually gets me what I expect the OS to do but I'll be damned if I can find everything documented the way it actually works. Your description of the services is helpful too, but I do need to read up on all this wants vs. requires vs. after syntax that debian makes a half-assed approach at describing but not as well as you do here. Now, finally, every time this living room PC reboots, I don't have to fire up a command line and run mount -a just so we can access the NFS server. Thanks again.
I prefer to thank Bob, my imaginary friend. He's always right.
Rather than searching the internet for answers from people who often know know anymore than we do, best to read the manpages ALREADY on your computer.
I've bypassed all these issues by using autofs the last 25+ yrs, though it was called automountd in the 1990s. Any storage that isn't internally gets mounted via the autofs settings here - that's NFS, USB, eSATA storage. That way the system doesn't get stuck and, more importantly, systemd-mount isn't used.
Systemd-mount took over the /etc/fstab file and clearly didn't honor the prior settings correctly for many options. It happened in Ubuntu sometime after 16.04 was released with the update pushed out to 16.04 systems.
Always remember that systemd documentation is "aspirational" - it describes what they hope to achieve at some time in the future, not what actually works today. Because of this, I try to avoid it - all of it. systemd-timesync, systemd-resolved, systemd-mount, systemd-{whatever} as much as possible. Usually there are excellent, simple, options. Chrony, /etc/resolv.conf (manually edited), autofs, are examples, respectively.
I haven't mounted NFS storage using the /etc/fstab in at least a decade, but NFS really was the first use for the amd in the 1990s. Whenever people in these forums use the term "automount", it is confusing because 99% of the time, they aren't really talking about the automountd process. They are talking about static mounts listed in /etc/fstab.
Duplicate post deleted. Please see below.
Last edited by scottbomb; April 17th, 2021 at 08:39 PM.
Well, the odd thing is, since it worked on one PC, I changed the fstab on another. The first PC automounts the NFS shares and the second doesn't (although It did with the previous settings). They're both running the exact same Kubuntu 20.04 too. This is most infuriating.
I say automount because I got used to using fstab to automatically mount hard drives when I first learned to use Linux, when 11.04 was the current release and the systemd cancer hadn't reared its ugly head. Things just worked then but no, some folks decided they had to change it for some reason and now we have this more complicated setup that doesn't work as documented. I'll read up on systemd-mount since we're stuck with it. I just wonder why they even kept fstab if systemd-mount was supposed to take over. It makes things very confusing for those of us who are used to doing things a certain way and the tools that we expect to work are still there. It's like Ford giving me a hand throttle to control my speed but leaving the gas pedal in place, but disconnected.
So I read up on autofs and found the man files to be a bit confusing. I found a tutorial that seems pretty straightforward here: https://websiteforstudents.com/how-t...-ubuntu-20-04/
I created /etc/auto.master and populated the last two lines with the following, which refer to folders that exist in /media with 777 permissions:
I then created /etc/auto.nfs and populated it according to the tutorial with:Code:/media/Television /etc/auto.nfs /media/Movies /etc/auto.nfs
Then I didCode:/media/Television -fstype=nfs4 192.168.1.2:/media/Romulus/Television /media/Movies -fstype=nfs4 192.168.1.2:/media/Kronos/Movies
I navigate to /media and check my Television and Movie directories and they're empty when I expect to see a listing of the same contents as are on the NFS server.Code:sudo systemctl restart autofs.service
What in the world am I missing?
Last edited by scottbomb; April 17th, 2021 at 08:40 PM.
I also tried these:
for /etc/auto.master
Code:/media /etc/auto.nfs
for /etc/auto.nfs
But of course it still doesn't work. I'm continuing trying different combinations as I search for more tutorials on this.Code:/media -fstype=nfs4,rw 192.168.1.2:/media/Romulus/Television /media -fstype=nfs4,rw 192.168.1.2:/media/Kronos/Movies
EDIT:
OK, I think I have this working now.
Content of /etc/auto.master (last line):
Apparently all it cares about here is where to find the mount points, which are both in /media.Code:/media /etc/auto.nfs
Content of /etc/auto.nfs
This file defines each mount point within /media.Code:Television -fstype=nfs4,rw 192.168.1.2:/media/Romulus/Television Movies -fstype=nfs4,rw 192.168.1.2:/media/Kronos/Movies
I'll do a reboot and see if it holds.
EDIT: After the reboot, my other hard drives mounted by fstab that were also in /media were gone. It seems autofs now has complete control over /media. I made some changes and created a new folder, /nfs to use for these mounts instead of /media.
I rebooted again. I navigate to /nfs and there are no folders. BUT, if I do cd Television. Voila, it appears! Same with Movies. WTF? So these aren't mounted until I try to navigate to them. The answer to this was to put options in /etc/auto.master with of "--timeout 0 browse". It's a weird syntax they expect, which isn't consistent with anything else in Linux, but there are to be no commas in the options. --timeout 0 prevents autofs from UN-mounting the remote folder (like I ever want that to happen) and browse makes the mounted folders appear before actually accessing them (so they're no longer invisible). They WERE, however, still invisible in the file manager (Dolphin) until I made symbolic links to them in my home directory so that when I open Dolphin, it resolves those sybolic links to their respective places in /nfs.
So the last line in /etc/auto.master is
Code:/nfs /etc/auto.nfs --timeout 0 browse
What a ****ing mess, but at least it seems to be working now on both PCs. I liked it much better when it was just a one-liner in fstab but thanks to systemd, it's a lot more complicated now. I suppose in another 10 years we'll have more poorly-documented changes as they move from systemd to systemf or whatever since we can never seem to leave well enough ALONE.
Last edited by scottbomb; April 17th, 2021 at 10:54 PM.
Bookmarks