# remote directory not mounted at boot

## jody

Hi

I have a directory ('/raid2/morpho') on a remote computer which is properly exported.

When i boot my local machine the directory does not get mounted, even though it

is in the '/etc/fstab':

```
server_1:/raid2/morpho/   /morpho      nfs             tcp,rw,hard,intr,nosuid,rsize=32768,wsize=32768     0 0 

```

However, when i call 'mount -a' as root, the remote directory is mounted correctly.

nfs and netmount are added at the default level:

```
jody@localhost ~ $ rc-update -s

            bootmisc | boot                          

             checkfs | boot                          

           checkroot | boot                          

               clock | boot                          

         consolefont | boot                          

               cupsd |      default                  

                dbus |      default                  

                hald |      default                  

            hostname | boot                          

             keymaps | boot                          

               local |      default nonetwork        

          localmount | boot                          

             modules | boot                          

            net.eth0 |      default                  

              net.lo | boot                          

            netmount |      default                  

                 nfs |      default                  

          ntp-client | boot                          

                ntpd |      default                  

           rmnologin | boot                          

                sshd |      default                  

           syslog-ng |      default                  

      udev-postmount |      default                  

             urandom | boot                          

          vixie-cron |      default                  

                 xdm |      default                  

```

There are some messages relating to nfs in '/var/log/messages' which i don't understand

(the 'Running as root' and the two 'nfsdreopen') :

```
Apr 26 09:46:53 localhost kernel: e1000e: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None

Apr 26 09:46:54 localhost kernel: NET: Registered protocol family 10

Apr 26 09:46:54 localhost kernel: lo: Disabled Privacy Extensions

Apr 26 09:46:57 localhost ntpdate[13852]: step time server 81.94.123.17 offset -0.008413 sec

Apr 26 09:46:57 localhost rpc.statd[13966]: Version 1.2.3 starting

Apr 26 09:46:57 localhost rpc.statd[13966]: Flags: TI-RPC 

Apr 26 09:46:57 localhost rpc.statd[13966]: Running as root.  chown /var/lib/nfs to choose different user

Apr 26 09:46:58 localhost kernel: Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

Apr 26 09:46:58 localhost rpc.idmapd[14078]: nfsdreopen: Opening '/proc/net/rpc/nfs4.nametoid/channel' failed: errno 2 (No such file or directory)

Apr 26 09:46:58 localhost rpc.idmapd[14078]: nfsdreopen: Opening '/proc/net/rpc/nfs4.idtoname/channel' failed: errno 2 (No such file or directory)

Apr 26 09:46:58 localhost rpc.mountd[14141]: Version 1.2.3 starting

Apr 26 09:46:58 localhost sm-notify[14152]: Version 1.2.3 starting

Apr 26 09:46:58 localhost ntpd[14258]: ntpd 4.2.4p7@1.1607-o Mon Mar 28 14:13:14 UTC 2011 (1)

Apr 26 09:46:58 localhost ntpd[14259]: precision = 1.000 usec

```

Am i overlooking something?

Thank You

  jody

----------

## Hu

It is traditional to mark NFS mounts as _netdev in the options field, so that the boot-time mount of local filesystems does not try to mount the NFS share.  That may or may not be your problem here.

----------

## jody

Hi

I added _netdev to my remote directory's options in fstab,

restarted my computer, but still the directory did not get mounted.

(Again, everything mounted correctly after doing "mount -a" on the console)

In the boot sequence, nfs gets started after the network, 

so that should not be a problem (i think).

And "mounting file systems" has a "[ok]" and not a "[!!]"

Is there a way to see if nfs even tries to mount the remote directory?

Like in a log file or so, or some sort of debug options to set for more output?

Thank You

  Jody

----------

## jody

*shy bump*?

----------

## Hu

Sorry, no idea.  I do not use NFS4 yet.

----------

## jody

hmmmm

actually i don't need NFS 4.

In .config i disabled all items referring to NFS4:

```
chefli /usr/src/linux $ grep NFS4 .config

chefli /usr/src/linux $ grep NFS .config

CONFIG_NFS_FS=y

CONFIG_NFS_V3=y

CONFIG_NFS_V3_ACL=y

# CONFIG_NFS_V4 is not set

CONFIG_ROOT_NFS=y

CONFIG_NFSD=m

CONFIG_NFSD_DEPRECATED=y

CONFIG_NFSD_V3=y

# CONFIG_NFSD_V3_ACL is not set

# CONFIG_NFSD_V4 is not set

CONFIG_NFS_ACL_SUPPORT=y

CONFIG_NFS_COMMON=y
```

and rebuilt the kernel (2.6.37-gentoo-r4). But during the boot i still get the same NFS4-related messages

```
Apr 26 09:46:58 localhost rpc.idmapd[14078]: nfsdreopen: Opening '/proc/net/rpc/nfs4.nametoid/channel' failed: errno 2 (No such file or directory)
```

 as well as the chown-message

```
Apr 26 09:46:57 localhost rpc.statd[13966]: Running as root.  chown /var/lib/nfs to choose different 
```

nfsstat seems to say that there is no NFS4 on my system:

```
chefli linux # nfsstat

Server rpc stats:

calls      badcalls   badauth    badclnt    xdrcall

0          0          0          0          0       

Client rpc stats:

calls      retrans    authrefrsh

0          0          0       
```

After i do 'mount -a' (which works perfectly) nfsstat says this:

```
chefli linux # nfsstat

Server rpc stats:

calls      badcalls   badauth    badclnt    xdrcall

0          0          0          0          0       

Client rpc stats:

calls      retrans    authrefrsh

27         0          27      

Client nfs v3:

null         getattr      setattr      lookup       access       readlink     

0         0% 5        19% 0         0% 4        15% 3        11% 0         0% 

read         write        create       mkdir        symlink      mknod        

0         0% 0         0% 0         0% 0         0% 0         0% 0         0% 

remove       rmdir        rename       link         readdir      readdirplus  

0         0% 0         0% 0         0% 0         0% 0         0% 8        30% 

fsstat       fsinfo       pathconf     commit       

0         0% 4        15% 2         7% 0         0% 
```

So i suspect it is not a NFS4 problem. 

Is there perhaps a way to have NFS print more messages into /var/log/messages to see what is the matter with my remote directories?

Is it possible that some nfs-related daemons are started in the wrong order so that a certain service is not present during the booting

making it impossible for NFS to mount the remote directories. But when booting is complete the "missing" service is runnning, so

it is possible to mount the remote dirs with 'mount -a'

Thank you for any suggestions.

  jody

----------

## depontius

My systems at home have /home on nfsv4, and I don't have "_netdev" in the options field.

I've never had trouble (not of my own misconfiguration) mounting things at boot time.

----------

## grimm26

I have this same problem now but it only started happening after update to baselayout 2.

----------

## jody

This is really weird...

I updated to baselayout_2 and openRC yesterday

(following http://www.gentoo.org/doc/en/openrc-migration.xml)

and did an 'emerge --update world' after that,

and when i started my computer today the 

directories were mounted as requested!

I don't recall anything nfs-like being emerged,

so i don't understand this.

@grimm26: should i leave this topic as "not SOLVED" for you,

or do you want to open a new topic for your case?

----------

## grimm26

Right after I posted I realized that /etc/init.d/nfs was not started and once I did that I was able to mount stuff.  Then I did a 

```
chown -hR nobody /var/lib/nfs
```

 and no more error.  doy.

----------

## dberkholz

Did you have the netmount service enabled in your default runlevel? The lack of that could've caused the issue.

----------

## grimm26

I have nfsmount enabled at the default runlevel.

----------

## RobPearce

I've had this problem as of last week, without updating to baselayout-2

After some digging, I think it's due to another recent change. The portmap ebuild has been removed due to a clash with the latest nfs-utils, which all works fine except for one thing: the /etc/init.d/netmount script removes all NFS mounts if a service called portmap has not been started.

My simple fix was to add the nfsmount service, which hadn't previously been needed because netmount is supposed to handle NFS, but since that has got broken the explicit nfsmount works instead. Probably the right fix is for netmount to be updated not to rely on an obsolete package.  :Wink: 

----------

## mieses

I have the same problem with a fresh install and with older systems.

netmount is in the default runlevel.

rc.log contains:

```
 * ERROR: netmount needs service(s) rpc.statd, portmap
```

netmount status reports that it has started:

```
# /etc/init.d/netmount status

 * status: started
```

but the NFS shares are not mounted.

The odd thing is that a manual restart of netmount does mount the NFS shares.

the nfsmount init script works.

My fstab (with names and paths replaced) :

```
192.168.0.3:/aaa  /aaa    nfs    nfsvers=3,ro               0 0

192.168.0.3:/bbb  /bbb    nfs    nfsvers=3,rw               0 0

192.168.0.3:/ccc  /ccc    nfs    nfsvers=3,defaults         0 0

192.168.0.3:/ddd  /ddd    nfs    nfsvers=3,defaults,user    0 0
```

----------

## mieses

It looks as though the bug was marked "WON'T FIX"

https://bugs.gentoo.org/show_bug.cgi?id=362331

As this affects everyone,  shouldn't we stop pretending that netmount supports NFS and remove all NFS features from netmount?

----------

## depontius

So now the big question is, "Why are all of my systems working perfectly?"

Oh, now that I look, I have "nfsmount" in the default runlevel as well as "netmount".  Maybe that's why.  If so, why isn't that the official fix for this?

----------

## cach0rr0

happens for me on baselayout-1

i can of course, swiftly go in and mount it without issue - basically, exact same symptoms 

and i too, only use nfs v3

im about to the point where I'm just going to say screw it, run my own script to mount it as part of local

----------

## mieses

I'm seeing this with current stable packages.  baselayout-2.0.2 and openrc-0.8.2-r1

It would be fine to use both nfsmount and netmount.  In this solution, the netmount script should be changed to remove attempts to mount NFS shares.

If users are supposed to rely on nfsmount for NFS shares, then `netmount restart` shouldn't touch the NFS shares (which it does).  It seems we should either remove all overlaps between nfsmount and netmount or make the overlaps logical and intentional.

----------

## depontius

So if I'm working because of nfsmount, and I'm not network mounting anything other than nfs, I should probably remove netmount, right?

Come to think of it, as work I use OpenAFS, and there's a separate initscript to start that.  What is netmount good for, samba?  ...anything else?

----------

## mieses

It seems as though netmount could be simply renamed smbmount and the remaining features split into separate mount scripts.

----------

