You are not logged in.

#1 2017-10-11 00:43:11

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

Arch doesn't run exportfs on boot

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

#2 2017-10-11 00:51:12

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Arch doesn't run exportfs on boot

Not an Arch Discussion, moving to Apps and DEs...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-10-11 09:06:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,129

Re: Arch doesn't run exportfs on boot

systemctl list-unit-files --enabled
cat /etc/exports
mount

Offline

#4 2017-10-11 09:32:56

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

Re: Arch doesn't run exportfs on boot

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

#5 2017-10-11 10:32:15

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,129

Re: Arch doesn't run exportfs on boot

Sorry
systemctl list-unit-files --state=enabled

What do you use to configure your network? (though the above will answer that question ;-)

Offline

#6 2017-10-15 06:42:13

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

Re: Arch doesn't run exportfs on boot

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=true

The 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.name

Hmm, I wonder if it's only resolving using IPv6, and ignoring the secondary server?

Offline

#7 2017-10-15 07:04:09

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,129

Re: Arch doesn't run exportfs on boot

Try to edit /usr/lib/systemd/system/nfs-server.service and change "network.target" to "network-online.target"

Offline

#8 2017-10-15 11:23:31

Malvineous
Member
From: Brisbane, Australia
Registered: 2011-02-03
Posts: 195
Website

Re: Arch doesn't run exportfs on boot

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

#9 2017-10-15 14:58:44

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,129

Re: Arch doesn't run exportfs on boot

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

#10 2017-10-15 15:01:51

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,734
Website

Re: Arch doesn't run exportfs on boot

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

Board footer

Powered by FluxBB