Cannot mount NFSv4 exported dirctories

I am using OpenSuSE 11.3 (64 bit) and am trying to force my new server use NFSv4. Later, GSSAPI, sould be added, but for beginning, I want to configure without it for now. If I try using NFSv3, this works good, but I need NFSv4.

I have exported my directory:

omega:/ # cat /etc/exports
/distrib        *(ro,no_root_squash,sync,no_subtree_check)

After mount attempt I have a error:

omega:/ # exportfs -var
exporting *:/distrib
omega:/ # mount -vt nfs4 omega:/ /mnt
mount.nfs4: timeout set for Wed Oct 20 14:21:38 2010
mount.nfs4: trying text-based options 'addr=192.168.0.11,clientaddr=192.168.0.11'
mount.nfs4: mount(2): No such file or directory
mount.nfs4: mounting omega:/ failed, reason given by server:
  No such file or directory

Incresed logging of rpc.nfs4 sais me in /var/log/messages per each mount attempt:

Oct 20 14:20:27 omega kernel: [347487.759279] --> nfs4_create_server()
Oct 20 14:20:27 omega kernel: [347487.759295] --> nfs4_init_server()
Oct 20 14:20:27 omega kernel: [347487.759298] --> nfs4_set_client()
Oct 20 14:20:27 omega kernel: [347487.759300] --> nfs_get_client(omega,v4)
Oct 20 14:20:27 omega kernel: [347487.759306] --> nfs_get_client() = ffff88007d3fd800 [new]
Oct 20 14:20:27 omega kernel: [347487.759843] NFS: Callback listener port = 48699 (af 2)
Oct 20 14:20:27 omega kernel: [347487.759850] NFS: Callback listener port = 33566 (af 10)
Oct 20 14:20:27 omega kernel: [347487.759981] <-- nfs4_set_client() = 0 [new ffff88007d3fd800]
Oct 20 14:20:27 omega kernel: [347487.760001] <-- nfs4_init_server() = 0
Oct 20 14:20:27 omega kernel: [347487.760004] --> nfs4_path_walk(,,/)
Oct 20 14:20:27 omega kernel: [347487.760010] encode_compound: tag=
Oct 20 14:20:27 omega kernel: [347487.760135] nfs4_get_root: getroot error = 2
Oct 20 14:20:27 omega kernel: [347487.760138] --> nfs_free_server()
Oct 20 14:20:27 omega kernel: [347487.760156] --> nfs_put_client({1})
Oct 20 14:20:27 omega kernel: [347487.760158] --> nfs_free_client(4)
Oct 20 14:20:27 omega kernel: [347487.760574] <-- nfs_free_client()
Oct 20 14:20:27 omega kernel: [347487.760582] <-- nfs_free_server()
Oct 20 14:20:27 omega kernel: [347487.760585] <-- nfs4_create_server() = error -2
Oct 20 14:20:27 omega kernel: [347487.760590] <-- nfs4_get_sb() = -2 [error]

It has become trouble to me to resolve the meaning of nfs4_get_root error code 2.
Additional info:

omega:/ # rpcinfo -p omega
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100000    3   tcp    111  portmapper
    100000    2   tcp    111  portmapper
    100000    4   udp    111  portmapper
    100000    3   udp    111  portmapper
    100000    2   udp    111  portmapper
    100005    1   udp  42808  mountd
    100005    1   tcp  34101  mountd
    100005    2   udp  42808  mountd
    100005    2   tcp  34101  mountd
    100005    3   udp  42808  mountd
    100005    3   tcp  34101  mountd
    100024    1   udp  57393  status
    100024    1   tcp  53369  status
    100021    1   udp  52318  nlockmgr
    100021    3   udp  52318  nlockmgr
    100021    4   udp  52318  nlockmgr
    100021    1   tcp  42537  nlockmgr
    100021    3   tcp  42537  nlockmgr
    100021    4   tcp  42537  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100227    2   tcp   2049  nfs_acl
    100227    3   tcp   2049  nfs_acl
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100227    2   udp   2049  nfs_acl
    100227    3   udp   2049  nfs_acl
omega:/ # rpm -q nfs-kernel-server
nfs-kernel-server-1.2.1-7.2.x86_64
omega:/ # uname -a
Linux omega 2.6.34-12-desktop #1 SMP PREEMPT 2010-06-29 02:39:08 +0200 x86_64 x86_64 x86_64 GNU/Linux
omega:/ # ps ax | grep nfs
  634 pts/0    S+     0:00 grep nfs
 9623 ?        S      0:00 [nfsiod]
32745 ?        S      0:00 [nfsd4]
32746 ?        S      0:00 [nfsd]
32747 ?        S      0:00 [nfsd]
32748 ?        S      0:00 [nfsd]
32749 ?        S      0:00 [nfsd]
omega:/ # ps ax | grep rpc
  502 ?        Ss     0:00 /usr/sbin/rpc.gssd
  636 pts/0    S+     0:00 grep rpc
 2012 ?        Ss     0:00 /sbin/rpcbind
 9617 ?        S      0:00 [rpciod/0]
 9618 ?        S      0:00 [rpciod/1]
 9619 ?        S      0:00 [rpciod/2]
 9620 ?        S      0:00 [rpciod/3]
32726 ?        Ss     0:00 /usr/sbin/rpc.svcgssd
32733 ?        Ss     0:00 /usr/sbin/rpc.idmapd
32739 ?        Ss     0:00 /usr/sbin/rpc.mountd
32742 ?        Ss     0:00 /usr/sbin/rpc.statd --no-notify
omega:/ # cat /etc/sysconfig/nfs | grep -v "^#" | grep -v "^$"
USE_KERNEL_NFSD_NUMBER="4"
MOUNTD_PORT=""
NFS_SECURITY_GSS="yes"
NFS3_SERVER_SUPPORT="yes"
NFS4_SUPPORT="yes"
SM_NOTIFY_OPTIONS=""
NFS_START_SERVICES="no"
STATD_OPTIONS=""

The second one today…
In /etc/nfsmount.conf, change


#Defaultvers=4

to


Defaultvers=3

Then do:


su -c 'rcnfs restart'

Mind, you have to remove the “#”, change “4” to “3”. AFAIK openSUSE 11.3 defaults to NFS4. No issues if you have 11.3 on both server and client, other combos may need this change.

The second one today…

As I mentioned earlier:

, but I need NFSv4.

And you can see my commant to mount selects NFSv4 filesystem type explicitly.

I’ve solved my problem. While using NFSv4 you need to set pseudo root to the exported filesystems, so one of the /etc/exports lines have to be set fsid=0 or fsid=root. For me, this became:
pavel@omega:~> cat /etc/exports

/home/exports                   192.168.0.0/24(ro,root_squash,sync,no_subtree_check,fsid=root)
/home/exports/distrib           192.168.0.0/24(ro,no_root_squash,sync,no_subtree_check)

@Gertjan, what I understand from his post, he wants to use version 4 and not 3. That would mean the (new) default is OK, but stressing this by making it

Defaultvers=4

will not make it worse :).

@maednoldor
It is btw not clear to me if your openSUSE system is the server or the client. Sorry, but I can not deduct that from your post. In any case, when it works when you do everything in NFS3, I hope you are aware of the fact hat on NFS4 the exports are handled different and the directory specifications have to change, else you would get what you get: not found.

Sorry, I have my glasses on now…:). I had just replied to another post about NFS, misread this one. Back in third gear, better for me, better for others, lol!