tags:

views:

994

answers:

3

I'm trying to share some directories with NFS among Debian machines. In order to do so, I installed nfs-common and nfs-kernel-server on the server machine. It seemed that starting portmap daemon lasted a long time and I get the following messages in /var/log/messages:

Jan 30 18:18:03 zape kernel: portmap: server localhost not responding, timed out Jan 30 18:18:03 zape kernel: RPC: failed to contact portmap (errno -5).

After that, I edited the /etc/exports file to include the directories to be shared; in particular, I added the following code:

/home 192.168.9.0/24(rw,sync,no_wdelay,subtree_check,root_squash)
/opt 192.168.9.0/24(rw,sync,no_wdelay,subtree_check,root_squash)
/usr/local 192.168.9.0/24(rw,sync,no_wdelay,subtree_check,root_squash)

The next step was to export the directories with exportfs -var. The answer I got is:

exporting 192.168.9.0/24:/usr/local
exporting 192.168.9.0/24:/home
exporting 192.168.9.0/24:/opt

Up to now, nothing really strange. However, when I did showmount -e to see which were the exported directories, I got a timeout whitout any error flag. I also got a timeout when I ran rpcinfo -p.

Everything is properly installed and running in the client (192.168.9.102), but when I try to mount the shared directories, I get the following error:

mount to NFS server '192.168.9.101' failed.
RPC Error: 15 ( Program not registered )
mount to NFS server '192.168.9.101' failed.
RPC Error: 15 ( Program not registered )
mount to NFS server '192.168.9.101' failed.
RPC Error: 15 ( Program not registered )

It seems to me that the problem is in the server.

Any help will be very appreciated!!! Thanks in advance.

P.S.: If I do netstat -tupan I get the following connections running:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State          PID/Program name   
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN     20229/portmap       
tcp6       0      0 :::22                   :::*                    LISTEN     2669/sshd           
tcp6       0    144 ::ffff:192.168.9.101:22 ::ffff:192.168.1.:36023 ESTABLISHED25159/2             
udp        0      0 0.0.0.0:111             0.0.0.0:*                          20229/portmap

P.S.2: These are the processes runing on the server after the whole described process (obtained with ps -faux)

USER       PID CPU MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2   1944   640 ?        Ss   Jan29   0:01 init [2]  
root         2  0.0  0.0      0     0 ?        S    Jan29   0:00 [migration/0]
root         3  0.0  0.0      0     0 ?        SN   Jan29   0:00 [ksoftirqd/0]
root         4  0.0  0.0      0     0 ?        S<   Jan29   0:00 [events/0]
root         5  0.0  0.0      0     0 ?        S<   Jan29   0:00 [khelper]
root         6  0.0  0.0      0     0 ?        S<   Jan29   0:00 [kthread]
root         9  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kblockd/0]
root        26  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kseriod]
root        77  0.0  0.0      0     0 ?        S    Jan29   0:00  \_ [pdflush]
root        78  0.0  0.0      0     0 ?        S    Jan29   0:00  \_ [pdflush]
root        79  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kswapd0]
root        80  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [aio/0]
root       526  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [khubd]
root       885  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kjournald]
root      1333  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kpsmoused]
root      1629  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kmirrord]
root      1664  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kjournald]
root      1666  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kjournald]
root      1668  0.0  0.0      0     0 ?        S<   Jan29   0:00  \_ [kjournald]
root      1045  0.0  0.2   2180   616 ?        S<s  Jan29   0:00 udevd --daemon
root      1114  0.0  0.3   2712   812 ?        S<   Jan29   1:06 /bin/sh -e /lib/udev/net.agent
root     26207  0.0  0.1   1560   396 ?        S<   18:22   0:00  \_ sleep 1
root      1117  0.0  0.3   2708   808 ?        S<   Jan29   0:43 /bin/sh -e /lib/udev/net.agent
root     26201  0.0  0.1   1560   396 ?        S<   18:22   0:00  \_ sleep 1
root      1968  0.0  0.2   1628   640 ?        Ss   Jan29   0:00 /sbin/syslogd
root      1974  0.0  0.1   1580   384 ?        Ss   Jan29   0:00 /sbin/klogd -x
root      2662  0.2  0.3   2712   828 ?        S<   Jan29   2:59 /bin/sh -e /lib/udev/net.agent
root     26204  0.0  0.1   1564   396 ?        S<   18:22   0:00  \_ sleep 1
root      2669  0.0  0.4   4932  1092 ?        Ss   Jan29   0:00 /usr/sbin/sshd
root     25159  0.0  0.9   7704  2360 ?        Ss   12:20   0:00  \_ sshd: root@pts/2 
root     25188  0.0  0.6   3980  1708 pts/2    Ss   12:20   0:00      \_ -bash
root     26208  0.0  0.3   3400   928 pts/2    R+   18:22   0:00          \_ ps -faux
root      3241  0.0  0.2   2192   748 ?        Ss   Jan29   0:00 /usr/sbin/cron
root      3298  0.0  0.1   1572   492 tty1     Ss+  Jan29   0:00 /sbin/getty 38400 tty1
root      3299  0.0  0.1   1576   492 tty2     Ss+  Jan29   0:00 /sbin/getty 38400 tty2
root      3300  0.0  0.1   1572   492 tty3     Ss+  Jan29   0:00 /sbin/getty 38400 tty3
root      3301  0.0  0.1   1572   492 tty4     Ss+  Jan29   0:00 /sbin/getty 38400 tty4
root      3304  0.0  0.1   1572   492 tty5     Ss+  Jan29   0:00 /sbin/getty 38400 tty5
root      3305  0.0  0.1   1572   492 tty6     Ss+  Jan29   0:00 /sbin/getty 38400 tty6
daemon   20229  0.0  0.1   1688   472 ?        Ss   18:12   0:00 /sbin/portmap
root     22603  0.0  0.2   3512   572 ?        Ss   18:16   0:00 /usr/sbin/rpc.idmapd
A: 

Does rpc.mountd run? Try running /usr/sbin/rpc.mountd -d all -F on the server, just as a test, and see if that fixes the problem.

Craig S
I get the following answer: `Cannot register service: RPC: Timed out``mountd: unable to register (mountd, 1, udp).`
Bellman
That's probably because mountd is already running. I don't have a Debian system here atm to try this on myself. But the error messages from your original post sure sound like mountd either isn't running or isn't responding.
Craig S
A: 

First, get rpcinfo to run on the server, and then rpcinfo <server> on the client.

Do you have firewall rules installed? Also check the tcp-wrapper configuration on the server in /etc/hosts.{allow,deny}. Also, it might be worth to restart the services on the server-side in the proper order.

Edit:

Put

ALL : localhost 127.0.0.1 : allow

into hosts.allow and try again. Again, as long as rpcinfo isn't doing anything, there's not much sense in trying the more "advanced" stuff involving the clients. On one of my Linux system I definitely find:

# If you're going to protect the portmapper use the name "portmap" for the
# daemon name. Remember that you can only use the keyword "ALL" and IP
# addresses (NOT host or domain names) for the portmapper, as well as for
# rpc.mountd (the NFS mount daemon). See portmap(8), rpc.mountd(8) and 
# /usr/share/doc/portmap/portmapper.txt.gz for further information.

But if the request is denied, there should be a logfile entry somewhere at least. Strange.

ShiDoiSi
`rpcinfo -p` on the server gives no response for a couple of minutes... I don't have rules neither in `hosts.allow` nor in `hosts.deny`. Although the server is providing routing services, I don't have any firewall rules. And restarting the services in the proper order does not produce any effect.
Bellman
However, it might be worthy to say that stopping and starting portmap daemon takes a long time
Bellman
In the following comments I will include the /var/log/merssages I got after starting (in the proper order) NFS services. Here it is the first `Mar 3 11:40:33 zape kernel: NFSD: Using /var/lib`/nfs/v4recovery as the NFSv4 state recovery directory
Bellman
The second: `Mar 3 11:40:33 zape kernel: NFSD: starting 90-second grace period`
Bellman
And then three times the following sequence of two messages: `Mar 3 11:41:08 zape kernel: portmap: server localhost not responding, timed out``Mar 3 11:41:08 zape kernel: RPC: failed to contact portmap (errno -5).`
Bellman
Produce no effect, i.e. I get the same messages if I restart the services
Bellman
Did you put the ALL...line into hosts.allow?
ShiDoiSi
Yes, and produced no effect
Bellman
This is getting difficult. I could offer free consulting through ssh while being able to chat to someone with root access ;)
ShiDoiSi
A: 

Another wild shot, hence a new answer: on the server, please provide the output of

grep localhost /etc/hosts

and

grep host /etc/nsswitch.conf
ShiDoiSi
This is one: `zape:~# grep localhost /etc/hosts``127.0.0.1 localhost.localdomain localhost``::1 ip6-localhost ip6-loopback`
Bellman
And this is the other: `zape:~# grep host /etc/nsswitch.conf``hosts: files dns`
Bellman