# Cannot mount export RPC: Program not registered



## unknownuser (Mar 31, 2020)

Hello friends,

I am having a strange issue with a FreeBSD 12.1 KVM guest where I am trying to export a few directories though NFS. Issue is I cannot seem to mount any of the exported folders on my FreeBSD 12 RPI3 due to the following errors:


```
[admin@rpi3fBSD ~]$ sudo mount 192.168.122.63:/usr/obj /usr/obj
[tcp] 192.168.122.63:/usr/obj: RPCPROG_NFS: RPC: Program not registered

OR

[admin@rpi3fBSD ~]$ sudo mount 192.168.122.63:/usr/obj /usr/obj
[tcp] 192.168.122.63:/usr/obj: Permission denied
```

Situation on the FreeBSD NFS Server

`/etc/rc.conf`

```
# NFS server
rpcbind_enable="YES"
rpcbind_flags="-d"
nfs_server_enable="YES"
mountd_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
```

`/etc/exports`

```
/usr/obj -ro  172.12.1.99
```

added *rpcbind : ALL : allow *to default `/etc/hosts.allow` config file

NFS client can be reached through rcp from the NFS Server

```
[admin@crossdevd ~]$ sudo rpcinfo -p 172.12.1.99
   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
[admin@crossdevd ~]$
```

While this is the situation on the RPI3, which is the FreeBSD NFS client 
`/etc/rc.conf`

```
# NFS server
rpcbind_enable="YES"
nfs_client_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
```

and NFS Server can be resolved through rpc


```
[admin@rpi3fBSD ~]$ sudo rpcinfo -p 192.168.122.63
   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
[admin@rpi3fBSD ~]$
```

There is no firewall enabled on neither of the two hosts, and while there is a firewall between the two subnets, I automatically excluded a firewall issue since hosts are both coming through on rcpinfo (perhaps am I wrong?). Also, running rcpbind in debug on the NFS Server reports no issue when trying to mount the export.

Do you guys have any idea of what I am doing wrong here? I checked the configuration twice and I can't seem to figure out where the issue is.


----------



## SirDice (Mar 31, 2020)

Restart mountd(8) and nfsd(8) on the server. Both mountd and nfs aren't registered with RPC. You probably restarted rpcbind(8) after nfsd(8) and mountd(8) were already running. This removes their registrations. Order is important here. Always (re)start rpcbind first, then the others to get them to register.

This is what it should look like (molly is an NFS server):

```
% rpcinfo -p molly
   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
    100005    1   udp    677  mountd
    100005    3   udp    677  mountd
    100005    1   tcp    677  mountd
    100005    3   tcp    677  mountd
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100024    1   udp    619  status
    100024    1   tcp    619  status
    100021    0   udp    773  nlockmgr
    100021    0   tcp    904  nlockmgr
    100021    1   udp    773  nlockmgr
    100021    1   tcp    904  nlockmgr
    100021    3   udp    773  nlockmgr
    100021    3   tcp    904  nlockmgr
    100021    4   udp    773  nlockmgr
    100021    4   tcp    904  nlockmgr
```


----------



## unknownuser (Mar 31, 2020)

SirDice said:


> Restart mountd(8) and nfsd(8) on the server. Both mountd and nfs aren't registered with RPC. You probably restarted rpcbind(8) after nfsd(8) and mountd(8) were already running. This removes their registrations. Order is important here. Always (re)start rpcbind first, then the others to get them to register.
> 
> This is what it should look like (molly is an NFS server):
> 
> ...



That is true, effectively I had restarted rpcbind after nfsd and mountd, however, now I am back with the actual issue:

```
[admin@rpi3fBSD ~]$ sudo mount 192.168.122.63:/usr/obj /usr/
[tcp] 192.168.122.63:/usr/obj: Permission denied
[tcp] 192.168.122.63:/usr/obj: Permission denied
^C
[admin@rpi3fBSD ~]$
```

I have gone through my other setups and I do not see anything unusual.


----------



## unknownuser (Mar 31, 2020)

I just realised that if I remove the client IP from the export, effectively allowing everyone to mount the export, the client will mount the export. This is mad.


----------



## getopt (Mar 31, 2020)

unknownuser said:


> [admin@rpi3fBSD ~]$ sudo mount 192.168.122.63:/usr/obj /usr/


Try mount_nfs(8)

In /etc/rc.conf this will increase hints in the logfile

```
nfsuserd_flags="-verbose"
```
nouser,nogroup indicates that  nfsuserd(8) is not running.


----------



## unknownuser (Apr 2, 2020)

getopt said:


> Try mount_nfs(8)
> 
> In /etc/rc.conf this will increase hints in the logfile
> 
> ...



I am not using kerberos, I am using plain sys authentication rather. I reverted the setup. My rpi3 is the server now and KVM guest is the client.

Using mount_nfs I pretty much get the same result


```
[admin@crossdevd ~]$ sudo mount_nfs -o nfsv3,sec=sys 172.12.1.99:/ /mnt/nfsroot
[tcp] 172.12.1.99:/: Permission denied
```

The logs on the server


```
[admin@rpi3fBSD ~]$ grep mountd /var/log/messages
Apr  1 23:18:52 rpi3fBSD mountd[1968]: mount request denied from 172.12.0.134 for /
Apr  1 23:21:06 rpi3fBSD mountd[2034]: mount request denied from 172.12.0.134 for /
[admin@rpi3fBSD ~]$
```

As you can see now, I am trying to export rpi3 rootfs only to 172.12.0.134, but the export can only be mounted if Everyone is allowed. I have tried adding -sec=sys in exports, made no difference whatsoever.

I have gone through EXPORTS() multiple times already and I can't figure out what I am doing wrong.


----------

