# Can not mount nfs partition (SOLVED)

## andrewwalker27

I'm having a nightmare trying to get nfs working on my Gentoo box. I've set up a NAS box to export a directory which I can access from my laptop running Kubuntu but I can't get my Gentoo box to access it at all.

Here's what I get

athlon64 linux # mount 192.168.0.2:/home/fred /mnt/stora

mount.nfs: an incorrect mount option was specified

athlon64 linux # 

This is exactly the same command I run with Kubuntu which works so I don't understand what is wrong with Gentoo.

I've installed nfs-utils with the following use flags

net-fs/nfs-utils-1.2.2-r2  USE="ipv6 nfsv3 nfsv4 tcpd -caps -kerberos"

I've also checked my kernel options are set correctly and the following daemons are running as default, netmount and nfsmount. I believe portmap is also required but is started by netmount?

The /etc/exports on the NAS are as follows

/home/fred 192.168.0.0/24(rw,anonuid=1003,anongid=1003,all_squash,no_root_squash)

and the /mnt/stora directory exists on my Gentoo box.

Anyone got any suggestions?Last edited by andrewwalker27 on Thu Sep 16, 2010 10:19 pm; edited 1 time in total

----------

## tony-curtis

What does 

```
rpcinfo -p 192.168.0.2
```

 say?  Do you see portmapper and various NFS versions?

----------

## andrewwalker27

Looks like it's available on the NAS box ok

athlon64 fred # rpcinfo -p 192.168.0.2

   program vers proto   port  service

    100000    2   tcp    111  portmapper

    100000    2   udp    111  portmapper

    100003    3   udp   2049  nfs

    100003    3   tcp   2049  nfs

    100005    1   udp   2049  mountd

    100005    3   udp   2049  mountd

    100005    1   tcp   2049  mountd

    100005    3   tcp   2049  mountd

athlon64 fred #

----------

## tony-curtis

Try telling mount explicitly to use nfs v3 (since that's the only one being offered by the server).

----------

## andrewwalker27

Not quite sure how you mean, I'm assuming this is explicitly setting nfs v3

mount -t nfs 192.160.0.2:/home/fred  /mnt/stora

here's what I get as an error

mount.nfs: an incorrect mount option was specified

----------

## andrewwalker27

Upon further reading I think I understand what you meant!

I tried the following method and it worked correctly

mount -t nfs -o nfsvers=3 192.168.0.2:/home/fred /mnt/stora

This seems like a bug to me, or is it meant to do this? I'll mark this thread as solved as it seems to work but can anyone confirm that this is a bug so I can report it?

----------

## tony-curtis

I was just going to add something about nfsvers=3   :Very Happy: 

Your nfs-utils is built with nfsv4 support, so I suppose "nfs" translates to v4 by default unless you explicitly say otherwise.  Seems like trying 4 then 3 automatically might be a good idea when both are configured, but I'm not familiar enough with the NFS specs.

BTW, a tcpdump watching the failed mount attempt would probably have spotted the v4/v3 mismatch.  I would have suggested this if the rpcinfo output hadn't been what I expected.

----------

## andrewwalker27

I re-compiled nfs-utils with -ntfsv4 flag but the problem still occurs, I'm pretty sure nfs4 isn't even compiled into the kernel I'm using. I'm thinking it must be a bug, surely it should be able to spot an nfs v3 without failing? How do I specify nfsv3 to an /etc/fstab by the way?

Can anyone verify this behavoiur or is it just my system that can't cope with nfs correctly?

Thanks for your help by the way, I've been struggling with this for days!

----------

## krinn

nfsserver   mountpoint   nfs    nfsvers=3,rw...      0  0

try add -v to see, but default is to ask for v4 now. and the bug might comes from the server that don't answer to that unknown query.

nfs mount doesn't "detect" the server version, it try 4 and wait for a the server to tell him it can't.

i suppose it will try 3 next... 

same for the "nfs" keyword, nfs was use to v3 and nfs4 for 4, but now a mount -t nfs always ask 4 at first.

----------

## overshoot

Updating nfs-tools, no other changes.

The fun part comes when you use NIS and autofs -- I'm still trying to figure out where to put the NFS version to force V3.  Suggestions welcome.

----------

## Seron

 *overshoot wrote:*   

> Updating nfs-tools, no other changes.
> 
> The fun part comes when you use NIS and autofs -- I'm still trying to figure out where to put the NFS version to force V3.  Suggestions welcome.

 

I had the same problem as the op and am able to mount now with autofs. I have this line in /etc/autofs/auto.net:

```
opts="-fstype=nfs,nfsvers=3,hard,intr,nodev,nosuid"
```

That file I believe comes with autofs and needs to be made executable.

----------

