Troubleshooting “mount.nfs: failed to apply fstab options” Error in Fedora 32 NFS Setup


2 views

When setting up NFS shares in Fedora 32, you might encounter the cryptic error:

mount.nfs: failed to apply fstab options

From the provided system status, we can see the NFS server is running:

[dolphin@MiWiFi-R4CM-srv infrastructure]$ sudo systemctl status nfs-server.service
● nfs-server.service - NFS server and services
     Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
     Active: active (exited) since Sun 2020-07-19 04:16:50 EDT

The exports file contains:

/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *(rw,all_squash)

This appears correct, allowing read-write access to all clients with squashed permissions.

The failing mount attempt uses:

mount -t nfs -o v4 192.168.31.2:/home/dolphin/data/k8s/monitoring/infrastructure/jenkins /mnt

1. NFS Version Mismatch

The -o v4 option forces NFSv4, but your server might not support it. Try:

mount -t nfs 192.168.31.2:/home/dolphin/data/k8s/monitoring/infrastructure/jenkins /mnt

2. Firewall Blocking

Ensure the firewall allows NFS traffic:

sudo firewall-cmd --add-service=nfs --permanent
sudo firewall-cmd --add-service=rpc-bind --permanent
sudo firewall-cmd --add-service=mountd --permanent
sudo firewall-cmd --reload

3. SELinux Context Issues

Check SELinux contexts on both export and mount points:

ls -Z /home/dolphin/data/k8s/monitoring/infrastructure/jenkins
ls -Z /mnt

4. RPC Services Not Running

Verify required services:

sudo systemctl status rpcbind nfs-server nfs-mountd nfs-idmapd

Try these variations of the mount command:

# With explicit options
mount -t nfs -o rw,soft,intr 192.168.31.2:/path /mnt

# Using fstab entry
192.168.31.2:/path /mnt nfs rw,soft,intr 0 0

Enable verbose logging:

mount -v -t nfs 192.168.31.2:/path /mnt

Check kernel messages:

dmesg | grep nfs

After making changes, always:

sudo exportfs -rav
sudo systemctl restart nfs-server

When attempting to mount an NFS share in Fedora 32, I encountered the following error:

mount.nfs: failed to apply fstab options

First, let's examine the current NFS server status and configuration:

[dolphin@MiWiFi-R4CM-srv infrastructure]$ sudo systemctl status nfs-server.service
● nfs-server.service - NFS server and services
     Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
    Drop-In: /run/systemd/generator/nfs-server.service.d
             └─order-with-mounts.conf
     Active: active (exited) since Sun 2020-07-19 04:16:50 EDT; 2h 34min ago

The exports configuration appears correct:

[dolphin@MiWiFi-R4CM-srv infrastructure]$ cat /etc/exports
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *(rw,all_squash)

And the export list is visible:

[dolphin@MiWiFi-R4CM-srv infrastructure]$ showmount -e 192.168.31.2
Export list for 192.168.31.2:
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *

Here are several approaches to resolve this issue:

1. Verify NFS Versions

Try specifying different NFS versions in the mount command:

mount -t nfs -o vers=3 192.168.31.2:/path /mnt
mount -t nfs -o vers=4.2 192.168.31.2:/path /mnt

2. Check Firewall Settings

Ensure the firewall allows NFS traffic:

sudo firewall-cmd --add-service={nfs,nfs3,mountd,rpc-bind} --permanent
sudo firewall-cmd --reload

3. Alternative Mount Command

Try a more complete mount command:

mount -t nfs -o rw,hard,intr,proto=tcp,vers=3 192.168.31.2:/path /mnt

4. Verify FSID

For NFSv4, ensure proper FSID is set in exports:

/export/directory *(rw,fsid=0,insecure,no_subtree_check,async)

Enable verbose logging to identify the root cause:

rpcdebug -m nfs -s all

Check kernel messages for NFS-related errors:

dmesg | grep nfs

Ensure these services are running:

sudo systemctl enable --now rpcbind nfs-server

Verify required NFS services are active:

rpcinfo -p localhost

Test basic connectivity:

rpcinfo -p 192.168.31.2

Check if the portmapper is responding:

rpcinfo -t 192.168.31.2 nfs

In my case, the following combination worked:

sudo mount -t nfs4 -o rw,hard,intr,proto=tcp 192.168.31.2:/ /mnt

The key was using NFSv4 explicitly and mounting from the root export point.