Unable to mount nfs share: `Mount.nfs4: Protocol not supported`

Greetings,

I am in the process of migrating away from truenas to nixos. So I have a client and server both running nixos unstable.

Here is the relevant snippet of my server config. I have verified that the directory is exported using showmount from the client.

{
  config,
  lib,
  ...
}:
let
  enable = builtins.elem "storage" config.roles;
in
{
  config = lib.mkIf enable {
    boot.kernelModules = [ "nfsd" "rpc_pipefs" ];

    networking.firewall.allowedTCPPorts = [ 111 2049 4000 4001 4002 20048 ];
    networking.firewall.allowedUDPPorts = [ 111 2049 4000 4001 4002 20048 ];

    services.nfs.server = {
      enable = true;

      statdPort = 4000;
      lockdPort = 4001;
      mountdPort = 4002;

      exports = ''
        /mnt/tank/Files         *(rw,sync,no_subtree_check,sec=sys,root_squash,no_all_squash)
        /export                 *(rw,fsid=0,no_subtree_check)
        /export/test            *(rw,nohide,insecure,no_subtree_check)
      '';
    };

    boot.zfs.extraPools = [ "tank" ];
  };
}

Then on the client when I try to mount the directory I get mount.nfs: Protocol not supported for server:/mnt/tank/Files on /mnt/tank/Files. I have tried mounting manually, i.e mount -t nfs4 server:/mnt/tank/Files /mnt/tank/Files/ and using nix, i.e.

{
  config = {
    boot.kernelModules = [ "nfs" ];
    boot.supportedFilesystems = [ "nfs" ];

    fileSystems = {
      "/mnt/tank/Files" = {
        device = server + ":/mnt/tank/Files";
        fsType = "nfs";
        options = [
          "defaults"
          "nofail"
          "vers=4.2"
        ];
      };
    };
  };
}

I have also tried following the nfs wiki page and the same thing happens when I try mount -t nfs4 server:/test temp.

What am I doing wrong?

1 Like

I was able to get my kubernetes cluster to mount the nfs share properly. So I now believe this is a problem with the client.

# sudo mount -t nfs -v server:/mnt/tank/Files /mnt/tank/Files

mount.nfs: timeout set for Sun Jun 29 16:42:16 2025
mount.nfs: trying text-based options 'vers=4.2,addr=10.1.3.20,clientaddr=10.1.3.105'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4,minorversion=1,addr=10.1.3.20,clientaddr=10.1.3.105'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'vers=4,addr=10.1.3.20,clientaddr=10.1.3.105'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'addr=10.1.3.20'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.1.3.20 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 10.1.3.20 prog 100005 vers 3 prot UDP port 4002
mount.nfs: mount(2): Protocol not supported
mount.nfs: Protocol not supported for server:/mnt/tank/Files on /mnt/tank/Files

# sudo mount -t nfs4 -v server:/mnt/tank/Files /mnt/tank/Files

mount.nfs4: timeout set for Sun Jun 29 16:43:07 2025
mount.nfs4: trying text-based options 'vers=4.2,addr=10.1.3.20,clientaddr=10.1.3.105'
mount.nfs4: mount(2): Protocol not supported
mount.nfs4: trying text-based options 'vers=4,minorversion=1,addr=10.1.3.20,clientaddr=10.1.3.105'
mount.nfs4: mount(2): Protocol not supported
mount.nfs4: trying text-based options 'vers=4,addr=10.1.3.20,clientaddr=10.1.3.105'
mount.nfs4: mount(2): Protocol not supported
mount.nfs4: Protocol not supported for server:/mnt/tank/Files on /mnt/tank/Files
# rpcinfo server | grep nfs
    100003    3    tcp       0.0.0.0.8.1            nfs        superuser
    100003    4    tcp       0.0.0.0.8.1            nfs        superuser
    100227    3    tcp       0.0.0.0.8.1            nfs_acl    superuser
    100003    3    tcp6      ::.8.1                 nfs        superuser
    100003    4    tcp6      ::.8.1                 nfs        superuser
    100227    3    tcp6      ::.8.1                 nfs_acl    superuser