# nfsd not doing anything



## jonostilla (Mar 8, 2016)

Hey guys, 
Currently nfsd(8) is not running and I can't get it to run. Further it gives me no errors or any text whatsoever. 
Running FreeBSD 8, we had a DNS issue and our network filesystems got all messed up. I found that all clients were sleeping *eternally*, so I looked at the server. `ps ax | grep nfs`; nothing.
Tried `sudo /etc/rc.d/nfsd status`, nothing, `start`, nothing.  
mountd(8) and rpcbind(8) were running so I stopped them. Still nothing. To show you what I mean this is how it looks:

```
user@mycomp$ sudo /etc/rc.d/nfsd start
user@mycomp$ sudo /etc/rc.d/nfsd status
user@mycomp$ sudo /etc/rc.d/nfsd poll
...
```
literally nothing is displayed, and nothing hangs. Any ideas what might be wrong?


----------



## SirDice (Mar 8, 2016)

Handbook: 28.3. Network File System (NFS)

Also note that FreeBSD 8 has been End-of-Life since August 2015 and should not be used any more. Please upgrade to a supported version.

https://www.freebsd.org/security/unsupported.html
Topics about unsupported FreeBSD versions


----------



## jonostilla (Mar 8, 2016)

I've followed this document already, but I'm not sure how to troubleshoot it. Googling for help doesn't seem to yield results.

I agree with your assessment on upgrading, I'm taking over projects and this type of stuff takes time with production services but I will do it.

I'm having my client hang with a D status indefinitely. All attempts to touch mounts hangs. Client is becoming ladden with unkillable D+ state processes. My nfsd master stays idle. Any suggestions?


----------



## SirDice (Mar 8, 2016)

What's in /etc/rc.conf? Are there any messages in /var/log/messages when you try to start nfsd(8)?


----------



## jonostilla (Mar 8, 2016)

```
Mar  8 16:45:10 nfsd[88650]: nfssvc: Operation not permitted
Mar  8 16:45:10 nfsd[88648]: nfssvc: Operation not permitted
Mar  8 16:45:10 nfsd[88649]: nfssvc: Operation not permitted
Mar  8 16:45:10 nfsd[88647]: can't bind udp addr *: Address already in use
Mar  8 16:45:10 nfsd[88647]: rpcb_unset failed
Mar  8 16:45:12 nfsd[88657]: nfssvc: Operation not permitted
Mar  8 16:45:12 nfsd[88658]: nfssvc: Operation not permitted
Mar  8 16:45:12 nfsd[88656]: nfssvc: Operation not permitted
Mar  8 16:45:12 nfsd[88655]: can't bind udp addr *: Address already in use
Mar  8 16:45:12 nfsd[88655]: rpcb_unset failed
Mar  8 17:25:19 sudo:   USER : TTY=pts/1 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/nfsd restart
Mar  8 17:25:19 nfsd[90807]: can't bind udp addr *: Address already in use
Mar  8 17:25:41 sudo:   USER : TTY=pts/1 ; PWD=/ ; USER=root ; COMMAND=/usr/sbin/nfsd status
Mar  8 17:25:41 nfsd[90835]: can't bind udp addr *: Address already in use
Mar  8 17:26:11 sudo:   USER : TTY=pts/1 ; PWD=/ ; USER=root ; COMMAND=/etc/rc.d/nfsd status
Mar  8 17:26:13 sudo:   USER : TTY=pts/1 ; PWD=/ ; USER=root ; COMMAND=/etc/rc.d/nfsd stop
Mar  8 17:27:52 nfsd[90982]: nfssvc: Operation not permitted
Mar  8 17:27:52 nfsd[90984]: nfssvc: Operation not permitted
Mar  8 17:27:52 nfsd[90983]: nfssvc: Operation not permitted
Mar  8 17:27:52 nfsd[90981]: can't bind udp addr *: Address already in use
```

I can't figure out how to actually stop and start nfsd again. It doesn't respond to kill commands on it's pid. The same issue as my initial concern happens whenever I do anything with 
	
	



```
/etc/rc.d/nfsd COMMAND
```


----------



## jonostilla (Mar 8, 2016)

It's quite a large rc.conf file. I've attempted to remove homemade services from it.

```
sshd_enable="YES"
fsck_y_enable="YES"
background_fsck="YES"
connwatchd="YES"
check_quotas="NO"
dumpdev="NO"
cron_enable="NO"
syslogd_enable="NO"
newsyslog_enable="NO"
entropy_dir="NO"
harvest_interrupt="NO"
harvest_ethernet="NO"
harvest_p_to_p="NO"
background_dhclient="YES"
tmpmfs="YES"
tmpmfs_flags="-M -S -o async,noatime"
tmpsize="32768"
network_interfaces="em0 lo0"
cloned_interfaces=""
ifconfig_em0="inet xxx.xx.x.x netmask 255.255.255.0 polling"
ifconfig_lo0="inet 127.0.0.1 netmask 255.0.0.0"
ifconfig_pfsync0="-syncdev down"
route_r0="xxx.xx.x.x/16 xxx.xx.x.x"
route_r1="xxx.xx.x.x/16 xxx.xx.x.x"
static_routes="r0 r1"
defaultrouter="172.22.1.40"
apache22_enable="YES"
autocerts_enable="YES"
beanstalkd_enable="YES"
cfgd_enable="NO"
cron_enable="YES"
dbversion_enable="NO"
flowproc_enable="YES"
flowrec_enable="YES"
linkproc_enable="NO"
logmon_enable="YES"
logwriter_enable="YES"
mailer_enable="YES"
memcached_enable="YES"
mountd_enable="YES"
mountd_flags="-r"
nfsd_enable="YES"
ntpd_enable="YES"
parpd_enable="NO"
pf_enable="YES"
pginit_enable="NO"
postgresql_enable="NO"
qa_enable="NO"
rails_cleaner_enable="YES"
redis_enable="YES"
redis_user="root"
reglink_enable="YES"
reglink_flags="--config /etc/reglink.conf"
regperiodic_enable="YES"
routeupd_enable="YES"
rpcbind_enable="YES"
sendmail_enable="YES"
sweepd_enable="YES"
vpnauthd_enable="YES"
webpoke_enable="YES"
websocketshell_enable="YES"
```


----------



## jonostilla (Mar 8, 2016)

For some reason there is no 'portmap' command available on my system.
`sockstat | grep nfs` and 
`sockstat | grep portmap` both show nothing. `ps ax | grep nfs` shows: 
	
	



```
87547  ??  Is     0:00.01 nfsd: master (nfsd)
87548  ??  I      0:00.00 nfsd: server (nfsd)
87549  ??  I      0:00.00 nfsd: server (nfsd)
87550  ??  I      0:00.00 nfsd: server (nfsd)
```
`sockstat | grep mountd`

```
root     mountd     86804 5  udp6   *:977                 *:*
root     mountd     86804 6  tcp6   *:977                 *:*
root     mountd     86804 7  udp4   *:977                 *:*
root     mountd     86804 8  tcp4   *:977                 *:*
```

`sockstat | grep rpc`

```
root     rpcbind    91069 4  udp6   *:*                   *:*
root     rpcbind    91069 5  stream /var/run/rpcbind.sock
root     rpcbind    91069 6  udp6   *:111                 *:*
root     rpcbind    91069 7  udp6   *:872                 *:*
root     rpcbind    91069 8  tcp6   *:111                 *:*
root     rpcbind    91069 9  udp4   *:111                 *:*
root     rpcbind    91069 10 udp4   *:996                 *:*
root     rpcbind    91069 11 tcp4   *:111                 *:*
```


----------



## jonostilla (Mar 10, 2016)

Still haven't figured it out. Did I give too much info and scare you off? Could really use the help. 

I got past the 
	
	



```
can't bind udp addr *: Address already in use
```
 issue. Stopped the service, came back to it after a while, and started it again. Mostly the issue seems to be with RPC though. Another connecting service can't connect and gets:
I've replaced the real IP with xx's

```
Mar  8 22:50:22 mountd[8368]: can't delete exports for /: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't delete exports for /dev: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't delete exports for /bcfg: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't delete exports for /global: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't delete exports for /other: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't delete exports for /var: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't delete exports for /tmp: Operation not permitted
Mar  8 22:50:22 mountd[8368]: can't change attributes for /var/db
Mar  8 22:50:22 mountd[8368]: bad exports list line /var/db -network xxx.xx.1.0 -mask 255.255.255.0
Mar  8 22:50:22 mountd[8369]: bindresvport_sa: Operation not permitted
```

From the client I get: 

```
[tcp] h-reg:/var/db: RPCPROG_NFS: RPC: Program not registered
```


----------



## SirDice (Mar 10, 2016)

Try restarting the rpcbind(8) service too. Then restart mountd(8) again.


----------



## jonostilla (Mar 11, 2016)

Done that a few times, restarted the machine did that again. Could you tell me if the behaviors listed in the very first post is expected? Or under what circumstances NFSD would do that, i.e. display nothing no matter the command? Especially since /var/log/messages only shows the command `sudo /etc/rc.d/nfsd start` and nothing after it?


----------



## Juha Nurmela (Mar 14, 2016)

Should you use `service xyz start` etc instead of directly invoking /etc/rc.d/xyz ? Probably makes no difference.

According to manpage, nfssvc(2) _Operation not permitted_ only happens if the caller is not root. That sounds odd. Is something wrong with the installed sudo ?

Juha


----------



## SirDice (Mar 14, 2016)

jonostilla said:


> Or under what circumstances NFSD would do that, i.e. display nothing no matter the command? Especially since /var/log/messages only shows the command `sudo /etc/rc.d/nfsd start` and nothing after it?


I'm surprised anything is logged at all. 


```
syslogd_enable="NO"
newsyslog_enable="NO"
```


----------



## jonostilla (Mar 14, 2016)

In the version of BSD I have there is no 'service'  But you are right some of the errors above were because I had not used sudo in `sudo /etc/rc.d/....`. I made the mistaken assumption that if it would run without sudo, it didn't NEED it. Poor choice. 

I did find out the problem though a simple line I didn't add to the rc.conf file on the server. It was nfs_server_enable="YES". 

After that I ran `sudo /etc/rc.d/nfsd start` restarted mountd with root the same way. It worked after that!


----------

