SOLVED NFS service not starting at boot missing /etc/exports

aacebedo

Dabbler
Joined
Aug 27, 2016
Messages
13
Hi all

Just migrated a VM from CORE to SCALE by rebuilding it.
Everything worked nice except the NFS service which is not starting at first boot.

It complains about not finding /etc/exports file (despite the fact I have configured some shares in the GUI) which seems to be generated by the middlewared service. I guess the nfs server service is started before the middlewared one. If I restart the NFS service manually through SSH it works (the /etc/exports file is then present).
Here is the log of the nfs server:

Code:
● nfs-server.service - NFS server and services
     Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Fri 2022-03-04 23:37:38 CET; 14s ago

Mar 04 23:37:38 <REDACTED> systemd[1]: Starting NFS server and services...
Mar 04 23:37:38 <REDACTED> exportfs[3754]: exportfs: can't open /etc/exports for reading
Mar 04 23:37:38 <REDACTED> systemd[1]: nfs-server.service: Control process exited, code=exited, status=1/FAILURE
Mar 04 23:37:38 <REDACTED> systemd[1]: nfs-server.service: Failed with result 'exit-code'.
Mar 04 23:37:38 <REDACTED> systemd[1]: Stopped NFS server and services.
 

aacebedo

Dabbler
Joined
Aug 27, 2016
Messages
13
Thank you for the answer.
I have recreated completely the install (did not migrated any conf from CORE)
When I restart manually the service without changing the configuration, I am able to mount the export that's not an issue.
The issue is the /etc/exports file does not seem do be available when the machine boots and become available a little bit after.
I also tried to remove and readd the share in config without success.
 

aacebedo

Dabbler
Joined
Aug 27, 2016
Messages
13
I think I found something, my ZFS pool is plugged onto a SCSI card in passtrough and this log makes me thing maybe the pool has not been mounted yet when the middlewared is started:
Code:
 - /mnt/<POOL_NAME>/<DATASET>: path does not exist, omitting from NFS exports


When the machine has finished its booting process, the datapool is mounted and accessible.
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
I think I found something, my ZFS pool is plugged onto a SCSI card in passtrough and this log makes me thing maybe the pool has not been mounted yet when the middlewared is started:
Code:
 - /mnt/<POOL_NAME>/<DATASET>: path does not exist, omitting from NFS exports


When the machine has finished its booting process, the datapool is mounted and accessible.
Okay. You can probably add a post-init script to `midclt call service.restart nfs`
 

aacebedo

Dabbler
Joined
Aug 27, 2016
Messages
13
Okay. You can probably add a post-init script to `midclt call service.restart nfs`
That's working ! Thanks
However don't you think the start of the nfs service shall wait for the zpool to be available ? I guess it can happen sometimes especially if it depends on the speed of the machine executing truenas
 

anodos

Sambassador
iXsystems
Joined
Mar 6, 2014
Messages
9,554
That's working ! Thanks
However don't you think the start of the nfs service shall wait for the zpool to be available ? I guess it can happen sometimes especially if it depends on the speed of the machine executing truenas
Right, it's a race condition that we'll need to fix. I proposed a workaround for you for now :)
 

soleous

Dabbler
Joined
Apr 14, 2021
Messages
30
Not to add any valuable contribution, but I also experienced this. It only happened once, additional reboots have not resulted in NFS failing to start.

It is also in a VM scenario with pass though.
 
Top