You are not logged in.
Hi all,
Does anyone know why Arch doesn't run the "exportfs" command during boot when you have an NFS server enabled?
I export some NFS filesystems to other hosts on my network, and after booting my machine I cannot mount these filesystems as I get an "access denied by server" message. I have to run "sudo exportfs -rv" on my Arch machine after every boot before the other hosts can mount any NFS filesystems I'm exporting from Arch.
Is this a bug in the init scripts, or is there some systemd command I haven't enabled in order to get the filesystems exported?
Thanks!
Offline
Not an Arch Discussion, moving to Apps and DEs...
Offline
systemctl list-unit-files --enabled
cat /etc/exports
mountOffline
Sorry I wasn't sure which forum would suit, and since the Arch forum description suggests technical issues are ok if they only affect Arch I thought that meant it was the forum to use!
Here are the results of running those commands: (where clientpc is the hostname of the client)
server$ systemctl list-unit-files --enabled
systemctl: unrecognized option '--enabled'
server$ cat /etc/exports
/ clientpc(rw,sync,insecure,no_subtree_check)
/home clientpc(rw,sync,insecure,no_subtree_check)Do you meant to run 'mount' on the server or the client? Not sure what exactly you're looking for. Just looks like normal NFS mounts on the client, NFSv3.
Looked through the systemctl manpage but can't find an equivalent to --enabled, so assuming you don't want a dump of everything. If you're looking for a particular service let me know.
I tried this if it helps:
server$ systemctl list-unit-files | grep 'nfs\|export'
proc-fs-nfsd.mount static
var-lib-nfs-rpc_pipefs.mount static
nfs-blkmap.service disabled
nfs-idmapd.service static
nfs-mountd.service static
nfs-server.service enabled
nfs-utils.service static
nfs-client.target disabled Looking more closely through the logs, I spotted this during the server boot:
exportfs[594]: exportfs: Failed to resolve clientpc
exportfs[594]: exportfs: Failed to resolve clientpc
exportfs[594]: exportfs: Failed to resolve clientpc
exportfs[594]: exportfs: Failed to resolve clientpc/etc/resolv.conf says it's managed by systemd-resolved so it looks like the problem is that systemd tries to export the filesystems before DNS is configured. Is there a way to change the order so that DNS is set up before exportfs is run?
Offline
Sorry
systemctl list-unit-files --state=enabled
What do you use to configure your network? (though the above will answer that question ;-)
Offline
That worked, thanks.
$ systemctl list-unit-files --state=enabled
UNIT FILE STATE
org.cups.cupsd.path enabled
autovt@.service enabled
bacula-fd.service enabled
cronie.service enabled
dbus-org.freedesktop.resolve1.service enabled
docker.service enabled
getty@.service enabled
haveged.service enabled
iptables.service enabled
lm_sensors.service enabled
mcelog.service enabled
nfs-server.service enabled
ntpd.service enabled
ntpdate.service enabled
org.cups.cupsd.service enabled
sshd.service enabled
systemd-networkd.service enabled
systemd-resolved.service enabled
timidity.service enabled
org.cups.cupsd.socket enabled
systemd-networkd.socket enabled
remote-fs.target enabled
22 unit files listed.Here is /etc/systemd/network/50-static.network, the only file in that directory, where I have configured my network:
[Match]
Name=eth0
[Network]
Address=192.168.0.14/24
Gateway=192.168.0.10
DNS=192.168.0.14
DNS=192.168.0.16
Domains=my.domain.name
Address=fdaa::7e05:7ff:fe0f:dcaa/64
IPv6AcceptRA=trueThe primary DNS server is the machine itself so no doubt that one isn't running when it tries to resolve the hostnames, but the secondary one is working fine. Have I configured multiple DNS servers incorrectly? It seems they are configured property because /etc/resolve.conf says:
nameserver 192.168.0.14
nameserver 192.168.0.16
nameserver fdaa::7e05:7ff:fe0f:dcaa
# Too many DNS servers configured, the following entries may be ignored.
nameserver fdaa::baae:edff:fe72:7d5f
search my.domain.nameHmm, I wonder if it's only resolving using IPv6, and ignoring the secondary server?
Offline
Try to edit /usr/lib/systemd/system/nfs-server.service and change "network.target" to "network-online.target"
Offline
Changed network.target to network-online.target in two places, but no luck unfortunately. Still have to run exportfs manually before the shares are available to clients.
If it gives you any ideas, I also have to run "mount -t cifs -a" to mount all my CIFS shares as well (this machine being a client in this case, and only a server for the NFS shares), because although they are listed as automounted in /etc/fstab, I briefly see error messages during boot when mounting these network filesystems fails.
EDIT: Found the errors in journalctl, not that they are very helpful:
systemd[1]: Mounting /mnt/nas/one...
systemd[1]: Mounting /mnt/nas/two...
systemd[1]: Mounting /mnt/nas/three...
systemd[1]: Mounting /mnt/nas/four...
[...]
systemd[1]: mnt-nas-one.mount: Mount process exited, code=exited status=1
systemd[1]: mnt-nas-one.mount: Failed with result 'exit-code'.
systemd[1]: Failed to mount /mnt/nas/one.
systemd[1]: Dependency failed for Remote File Systems.
systemd[1]: remote-fs.target: Job remote-fs.target/start failed with result 'dependency'.
systemd[1]: mnt-nas-two.mount: Mount process exited, code=exited status=32
systemd[1]: mnt-nas-two.mount: Failed with result 'exit-code'.
systemd[1]: Failed to mount /mnt/nas/two.
systemd[1]: mnt-nas-three.mount: Mount process exited, code=exited status=1
systemd[1]: mnt-nas-three.mount: Failed with result 'exit-code'.
systemd[1]: Failed to mount /mnt/nas/three.
...Last edited by Malvineous (2017-10-15 11:28:32)
Offline
Hmmm... even systemd-resolved should be up and running with the network-online.target.
What happens when you
a) replace "clientpc" with the entire subnet ("192.168.0.0/24(blahfoobar)")?
b) delay the exportfs PreStart call - "bash -c '/usr/bin/sleep 5; /usr/sbin/exportfs -r; /usr/bin/sleep 5'"? (double padding is intended - you could later check whether and which matters - iff)
c) replace systemd-networkd with dhcpcd (notably since this seems to be an ethernet connection anyway)?
Offline
Experienced a similar problem with recent systemd-networkd to the point of switching back to netctl. Problem solved. Maybe the OP could give that a test.
Offline