# NFSv4 problems: mount point not found???

## borfig

I have a NFSv4 server and a client with net-fs/nfs-utils-1.1.1 (with nonfsv4 USE flag disabled of course)

My /etc/exports looks like:

```
/exports    1.2.*(ro,fsid=0,secure,no_subtree_check,sync,root_squash)

/exports/portage 1.2.*(rw,secure,no_subtree_check,sync,nohide,no_root_squash)
```

when /exports/portage is a symlink to the server's /usr/portage

When the client tries to mount server:/ it works, but when it tries to mount /portage, I get:

```
client ~ # mount -t nfs4 server:/portage /usr/portage/

mount.nfs4: mount point /usr/portage is not a directory
```

but /usr/portage is a directory...

dmesg shows:

```
nfs4_get_root: lookupfh encountered non-directory
```

What am I doing wrong here???

----------

## gazj

Your mount line needs to be

```
mount -t nfs4 server:/exports/portage /usr/portage/ 
```

i.e you need the absolute path from your server in the mount command

----------

## borfig

 *gazj wrote:*   

> Your mount line needs to be
> 
> ```
> mount -t nfs4 server:/exports/portage /usr/portage/ 
> ```
> ...

 

your suggestion contradicts the documentation. But I will try..

----------

## gazj

I must admit I haven't used it in a mount command for a long time, but it's how it is used in /etc/fstab.  Mine line is full path as follows

server:/data/home /home/docs nfs rw 0 0

----------

## tarpman

 *gazj wrote:*   

> Your mount line needs to be
> 
> ```
> mount -t nfs4 server:/exports/portage /usr/portage/ 
> ```
> ...

 

No.  This format changed in nfsv4.  What he has already is correct.

borfig, I think your problem is that /exports/portage is a symlink, which could be confirmed by the message you posted:

 *borfig wrote:*   

> 
> 
> ```
> nfs4_get_root: lookupfh encountered non-directory
> ```
> ...

 

The correct fix is to use a bind mount instead of a symlink.  To do this, remove the symlink, create an empty directory at /exports/portage, and add the following line in the server's /etc/fstab:

```
/usr/portage /exports/portage none bind 0 0
```

And then to mount it without rebooting:

```
mount /exports/portage
```

----------

## gazj

 *Quote:*   

> No. This format changed in nfsv4. What he has already is correct. 

 

Well you learn something new everyday  :Smile: .  Is nfsv4 backwards compatible with the old way as a matter of interest.  May have to look into new features of nfsv4 for my server.

----------

## tarpman

 *gazj wrote:*   

>  *Quote:*   No. This format changed in nfsv4. What he has already is correct.  
> 
> Well you learn something new everyday .  Is nfsv4 backwards compatible with the old way as a matter of interest.  May have to look into new features of nfsv4 for my server.

 

They are different filesystems as far as the kernel is concerned.  nfsv4 also has slightly different exports and mount options (you've already seen one difference there).  The vast majority of stuff from our point of view does work the same, though.

----------

## chris.c.hogan

Not sure if this adds anything to the topic. However...

I have /usr/portage symlinked to /mnt/net/portage without this problem. However, I have the mount set up in /etc/fstab:

```

server:/portage /mnt/net/portage       nfs4    defaults 0 0

```

(I have some other options set instead of defaults. I'm on a different system and can't remember them off the top of my head)

From the client I can mount like so:

```
mount /usr/portage
```

Mount seems to see that /usr/portage is a symlink to /mnt/net/portage and finds the correct entry in /etc/fstab.

----------

## borfig

Now that I mounted the NFSv4 with bind on the server as tarpman suggested.

ls /usr/portage works, but cat'ing files (and running emerge) freezes.

I get the following message in dmesg:

```
Error: state recovery failed on NFSv4 server 1.2.3.4 with error 121
```

What is that???

----------

## toralf

I've a similar problem. At my nfs server I've this exports

```
n22 ~ # cat /etc/exports

# /etc/exports: NFS file systems being exported.  See exports(5).

/tmp            n22_uml(rw,sync,all_squash,fsid=0,no_subtree_check)

```

 A mount with NFSv3 works fine :

```
n22_uml ~ # mount -t nfs n22:/tmp /mnt/nfs/n22_tmp && ls -ld /mnt/nfs/n22_tmp/ks* && umount /mnt/nfs/n22_tmp

drwx------ 3 tfoerste users 4096 Feb 13 14:33 /mnt/nfs/n22_tmp/ksocket-tfoerste
```

whereas for NFSv4 it failed with :

```
n22_uml ~ # mount -t nfs4 n22:/tmp /mnt/nfs/n22_tmp && ls -ld /mnt/nfs/n22_tmp/ks* && umount /mnt/nfs/n22_tmp

mount.nfs4: mount point /mnt/nfs/n22_tmp does not exist
```

BTW a diff of  the strace files shows this differenc:

tfoerste@n22 /tmp $ grep -B 4 -A 4 WEXITSTATUS v?.out

v3.out-getcwd("/root", 4095)                   = 6

v3.out-readlink("/root/n22:", 0xbfb18b0b, 4096) = -1 ENOENT (No such file or directory)

v3.out-stat64("/sbin/mount.nfs", {st_mode=S_IFREG|S_ISUID|0511, st_size=47352, ...}) = 0

v3.out-clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x40160748) = 2278

v3.out:wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 2278

v3.out---- SIGCHLD (Child exited) @ 0 (0) ---

v3.out-exit_group(0)                           = ?

--

v4.out-getcwd("/root", 4095)                   = 6

v4.out-readlink("/root/n22:", 0xbf93612b, 4096) = -1 ENOENT (No such file or directory)

v4.out-stat64("/sbin/mount.nfs4", {st_mode=S_IFREG|S_ISUID|0511, st_size=47352, ...}) = 0

v4.out-clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x40160748) = 2264

v4.out:wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 32}], 0, NULL) = 2264

v4.out---- SIGCHLD (Child exited) @ 0 (0) ---

v4.out-exit_group(32)                          = ?

----------

