Jump to content

nfs-server startup problem after boot


Recommended Posts

I did install an apt install nfs-kernel-server nfs-common on my bananaPi M1.

I did export some dirs and successfully mounted them from my clients.

After a reboot the mounts did not work.

Then I manually invoked  exportfs -a and the client were able to mount.

What is the correct way to get the nfs server started after a reboot?

 

 

Edited by armdran
rework
Link to comment
Share on other sites

  • armdran changed the title to nfs-server startup problem after boot

I have found that the systemd nfs-server unit fails because it cannot resolve hostnames when the service starts up after reboot.

I tried to add the following to the Unit, but it still fails.
 

Requires=network-online.target

After=network-online.target

It seems that others are also struggling with it and there is no good solution but only workarounds.

 

Link to comment
Share on other sites

I am running a nfs share on my rpi4 and got curious (I use ip addresses rather than host-names, so that could be an extra layer you have to make sure is loaded before it is trying to connect), because I just created the /etc/exports, exportfs -ra, reloaded the systemd daemon and enabled nfs-server.service.

So I checked the service file itself.

This is on raspberry pi os, not armbian.
Mine contains way more dependencies than just network-online.target, maybe you can use this to figure it out:

 

$ cat /lib/systemd/system/nfs-server.service

[Unit]
Description=NFS server and services
DefaultDependencies=no
Requires=network.target proc-fs-nfsd.mount
Requires=nfs-mountd.service
Wants=rpcbind.socket
Wants=nfs-idmapd.service

After=local-fs.target
After=network.target proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service
After=nfs-idmapd.service rpc-statd.service
Before=rpc-statd-notify.service

# GSS services dependencies and ordering
Wants=auth-rpcgss-module.service
After=rpc-gssd.service gssproxy.service rpc-svcgssd.service

# start/stop server before/after client
Before=remote-fs-pre.target

Wants=nfs-config.service
After=nfs-config.service

[Service]
EnvironmentFile=-/run/sysconfig/nfs-utils

Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

ExecReload=/usr/sbin/exportfs -r

[Install]
WantedBy=multi-user.target

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines