NFS server daemon fails to start at boot
I´m trying to export an external disk, so, I configured my nfs-server service to wait for disk1 to mount, however it fails.
This is the situation after boot:
$ systemctl status nfs-server.service
● nfs-server.service - NFS server and services
Loaded: loaded (/etc/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2020-04-26 14:46:28 CEST; 3min 7s ago
Process: 307 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=1/FAILURE)
Process: 312 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
Process: 314 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
abr 26 14:46:28 raspberrypi systemd[1]: Starting NFS server and services...
abr 26 14:46:28 raspberrypi exportfs[307]: exportfs: Failed to stat /media/pi/disk1: No such file or directory
abr 26 14:46:28 raspberrypi systemd[1]: nfs-server.service: Control process exited, code=exited, status=1/FAILURE
abr 26 14:46:28 raspberrypi systemd[1]: nfs-server.service: Failed with result 'exit-code'.
abr 26 14:46:28 raspberrypi systemd[1]: Failed to start NFS server and services.
If I just restart the service it just works smoothly
$ sudo systemctl restart nfs-server.service
$ systemctl status nfs-server.service
● nfs-server.service - NFS server and services
Loaded: loaded (/etc/systemd/system/nfs-server.service; enabled; vendor preset: enabled)
Active: active (exited) since Sun 2020-04-26 14:59:51 CEST; 4s ago
Process: 943 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
Process: 944 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
Main PID: 944 (code=exited, status=0/SUCCESS)
abr 26 14:59:51 raspberrypi systemd[1]: Starting NFS server and services...
abr 26 14:59:51 raspberrypi systemd[1]: Started NFS server and services.
I configured the service to "Requires" and "After" disk1 mounts, but it didn´t work:
# /etc/systemd/system/nfs-server.service
[Unit]
Description=NFS server and services
DefaultDependencies=no
Requires=network.target proc-fs-nfsd.mount media-pi-disk1.mount
Requires=nfs-mountd.service
Wants=rpcbind.socket
Wants=nfs-idmapd.service
After=local-fs.target media-pi-disk1.mount
After=network.target proc-fs-nfsd.mount rpcbind.socket nfs-mountd.service
After=nfs-idmapd.service rpc-statd.service
Before=rpc-statd-notify.service
Extra info requested:
$ systemctl status media-pi-disk1.mount
● media-pi-disk1.mount - /media/pi/disk1
Loaded: loaded
Active: active (mounted) since Sun 2020-04-26 14:47:34 CEST; 3h 22min ago
Where: /media/pi/disk1
What: /dev/sda1
$ egrep -v '^#|^$' /etc/fstab
proc /proc proc defaults 0 0
/dev/mmcblk0p8 /boot vfat defaults 0 2
/dev/mmcblk0p9 /
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 931,5G 0 disk
└─sda1 8:1 0 931,5G 0 part /media/pi/disk1
mmcblk0 179:0 0 29,7G 0 disk
├─mmcblk0p1 179:1 0 2,4G 0 part
├─mmcblk0p2 179:2 0 1K 0 part
├─mmcblk0p5 179:5 0 32M 0 part
├─mmcblk0p6 179:6 0 512M 0 part /media/pi/System
├─mmcblk0p7 179:7 0 12,1G 0 part /media/pi/Storage
├─mmcblk0p8 179:8 0 256M 0 part /boot
└─mmcblk0p9 179:9 0 14,5G 0 part /
$ mount
/dev/mmcblk0p9 on / type ext4 (rw,noatime)
devtmpfs on /dev type devtmpfs (rw,relatime,size=217076k,nr_inodes=54269,mode=755)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/net_cls type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
mqueue on /dev/mqueue type mqueue (rw,relatime)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
configfs on /sys/kernel/config type configfs (rw,relatime)
/dev/mmcblk0p8 on /boot type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=44280k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
/dev/sda1 on /media/pi/disk1 type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)
/dev/mmcblk0p7 on /media/pi/Storage type ext4 (rw,nosuid,nodev,relatime,uhelper=udisks2)
/dev/mmcblk0p6 on /media/pi/System type vfat (rw,nosuid,nodev,relatime,uid=1000,gid=1000,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,showexec,utf8,flush,errors=remount-ro,uhelper=udisks2)
I was letting the system to automount the disk. I´ve just configured the disk to mount in /etc/fstab
following to Gerald question and it just worked!. Thank you very much, guys.
I have problems with Error of nfs server daemon fails on booting process. I don't know exactly why, but the problem was from LVM.
Before the reboot I remove my LV, VG and PV. I make the mount permanent by adding them to /etc/fstab
. After removing my PVs reference from /etc/fstab
my problem solved.