# NFS export problem [RESOLVED]

## chunderbunny

I recently emerged the new version of dhcpcd which went into x86 stable. However, when I restarted all the network services I got an error when exporting NFS directories: 

```
 * Stopping NFS mountd...                                                 [ ok ]

 * Stopping NFS daemon...                                                 [ ok ]

 * Stopping NFS statd...                                                  [ ok ]

 * Starting NFS statd...                                                  [ ok ]

 * Exporting NFS directories...

/sbin/runscript.sh: line 534:  9259 Killed                  $exportfs -r 1>&2

 * Error exporting NFS directories                                        [ !! ]

 * Starting NFS daemon...                                                 [ ok ]

 * Starting NFS mountd...                                                 [ ok ]
```

Needless to say, none of the directories are actually exported and no one can mount them. Line 534 of /sbin/runscript.sh is the very last line of the script, so that didn't help much. 

I looked in /var/log/messages, and this error was reported: 

```
Sep 15 13:26:36 Commodore64 rpc.mountd: Caught signal 15, un-registering and exiting.

Sep 15 13:26:36 Commodore64 nfsd: last server has exited

Sep 15 13:26:36 Commodore64 nfsd: unexporting all filesystems

Sep 15 13:26:36 Commodore64 rpc.statd[8850]: Caught signal 15, un-registering and exiting.

Sep 15 13:26:36 Commodore64 rpc.statd[9256]: Version 1.0.6 Starting

Sep 15 13:26:36 Commodore64 rpc.statd[9256]: gethostbyname error for Commodore64

Sep 15 13:27:06 Commodore64 rc-scripts: Error exporting NFS directories

Sep 15 13:27:06 Commodore64 svc: bad direction 65536, dropping request

Sep 15 13:27:06 Commodore64 svc: bad direction 65536, dropping request

```

I did a google search on "gethostbyname error" but nothing interesting turned up. Before I try downgrading dhcpcd, does anyone have any ideas on how I get this up and running again?Last edited by chunderbunny on Thu Sep 23, 2004 12:17 pm; edited 2 times in total

----------

## Nossie

it seems your system map it's own name to a ipnumber with the funcion 'gethostbyname'

Do you have an entry in /etc/hosts ?

[edit]

ehh, i meant /etc/hosts instead of /etc/host   :Embarassed: 

[/edit]Last edited by Nossie on Wed Sep 15, 2004 1:57 pm; edited 1 time in total

----------

## hecatomb

Maybe you have not recieved a new ip-adress after the dhcpd update.

```
/etc/init.d/net.eth0 restart
```

----------

## chunderbunny

Nope, /etc/host is empty. What is supposed to be in there?

And yes, I am getting an IP address. All other network services are up and running (ntp, ssh, etc.)

Edit: BTW, in case you meant /etc/hosts, that looksl ike this 

```
127.0.0.1   localhost

# IPV6 versions of localhost and co

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts
```

And /etc/hostname is 

```
Commodore64
```

----------

## chunderbunny

Ok, I changed my /etc/hosts to this:

```
127.0.0.1       Commodore64.retro Commodore64 localhost

# IPV6 versions of localhost and co

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts
```

And now the "gethostsbyname error" message doesn't appear when i try and restart NFS, but... it still doesn't export any directories. I'm still getting the error 

```
/sbin/runscript.sh: line 534: 10059 Killed                  $exportfs -r 1>&2

 * Error exporting NFS directories                                        [ !! ] 
```

And the message

```
Sep 15 14:18:31 Commodore64 rpc.mountd: Caught signal 15, un-registering and exiting.

Sep 15 14:18:31 Commodore64 nfsd: last server has exited

Sep 15 14:18:31 Commodore64 nfsd: unexporting all filesystems

Sep 15 14:18:31 Commodore64 rpc.statd[9812]: Caught signal 15, un-registering and exiting.

Sep 15 14:18:31 Commodore64 rpc.statd[10056]: Version 1.0.6 Starting

Sep 15 14:19:01 Commodore64 rc-scripts: Error exporting NFS directories

Sep 15 14:19:02 Commodore64 svc: bad direction 65536, dropping request

```

Anything else?

----------

## hecatomb

I found this in the startscript:

```
...

   # Exportfs likes to hang if networking isn't working.

   # If that's the case, then try to kill it so the

   # bootup process can continue.

...
```

Are you sure your network connection is ok? ping some other hosts to test this.

Maybe the NFS servers hostname is also missing in your /etc/hosts?

----------

## chunderbunny

Networking is definitely working, I'm administering this machine through an SSH connection.  :Wink: 

The machine with the trouble IS the NFS server, it's not exporting directories. I don't need a special entry in /etc/hosts for this.

Edit: Ok, this is interesting. If I change my /etc/exports so that I'm only exporting one directory, then it all works fine. With two entries in /etc/exports then it fails. It doesn't matter which entry I use either...

----------

## hecatomb

Sorry, didn't get the point (Commodore64 IS the NFS Server)!

This is strange, exporting one dir is ok but two fail. No idea!

----------

## chunderbunny

I upgraded nfs-utils to ~x86, but that hssn't changed anything. I can still only export one NFS directory at a time.

----------

## chunderbunny

Bump, I'm still not getting anywhere. Only 1 directory can be exported at a time without NFS throwing up an error.

----------

## hecatomb

Maybe the output of exportfs will help.

I have no NFS so this is just a guess. The daemon will be started with a script like every other too. Find the script (e.g.)

```
find /etc -exec grep "Error exporting NFS directories" {} /dev/null \;
```

Then make a backup and edit this file:

```
...

ebegin "Exporting NFS directories"

$exportfs -r 1>&2 &

pid=$!

( sleep 30; kill -9 $pid &>/dev/null ) &

wait $pid

eend $? "Error exporting NFS directories"

...
```

edit these lines so that the command exportfs will NOT be killed after 30 seconds:

```
...

ebegin "Exporting NFS directories"

$exportfs -r

# pid=$!

# ( sleep 30; kill -9 $pid &>/dev/null ) &

# wait $pid

eend $? "Error exporting NFS directories"

...
```

Or maybe you can execute the command by yourself.

```
(/usr/sbin/)exportfs -r
```

Hope you will get some interesting messages!

----------

## barnie

I had the same problem. Running exportfs -r sepearte solved it. So I increased the time in the script. Now everything is working.

----------

## chunderbunny

Which script did you edit to increase the time?

----------

## sf_alpha

May be portmap problems ... Checkit ?

----------

## hecatomb

 *Quote:*   

> Which script did you edit to increase the time?

 

I think he means the startscript /etc/init.d/nfs

```
...

ebegin "Exporting NFS directories"

$exportfs -r 1>&2 &

pid=$!

( sleep 30; kill -9 $pid &>/dev/null ) &

wait $pid

eend $? "Error exporting NFS directories"

...
```

Increase the 30 sec. the script is waiting for the end of exportfs. Maybe this will help!

----------

## chunderbunny

Cool, thanks that worked!   :Very Happy: 

Well, not exactly, the script is a little different in my version (it has a seperate waitfor_exportfs function) but the general principle is the same.

----------

## richardash1981

Your problem is waiting for network name resolution for the _clients_ to time out. You must be able to reverse DNS each client from the server (try running dig there).

The nfs server needs to be able to do a reverse DNS lookup on each client IP that tries to connect to it,(even with IP addresses or masks in /etc/exports).  If it can't, mount will often time out on the clients, and exportfs will take much longer.

Either add the nfs clients to the DNS or the server's hosts file.

----------

