NFS works but cannot start at boot automatically

I am using SUSE 11.2. And I am really baffled with a strange NFS problem. I hope some experts can help me here.

I have set up the fstab on the client and exports on the server correctly, because if I manually run

/etc/init.d/nfs start

Starting NFS client services: sm-notify done
I can see and use the NFS partition perfectly, there is no problem at all.

But nfs cannot successfully start at boot. In yast, I have enabled nfs in “System Services (Runlevel)” at runlevel 3 and 5. So it should run automatically, but I always get the following error message:

/var/log/message:
Apr 10 20:07:56 hubble kernel: 33.654768] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
Apr 10 20:07:56 hubble rpc.statd[2262]: Version 1.1.3 Starting
Apr 10 20:07:56 hubble rpc.statd[2262]: Flags:
Apr 10 20:07:56 hubble rpc.statd[2262]: statd running as root. chown /var/lib/nfs/sm to choose different user
Apr 10 20:07:56 hubble kernel: 33.802662] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
Apr 10 20:07:56 hubble kernel: 33.806946] NFSD: starting 90-second grace period
Apr 10 20:07:56 hubble sm-notify[2271]: Already notifying clients; Exiting!

More info:

uname -a

Linux hubble 2.6.31.12-0.2-desktop #1 SMP PREEMPT 2010-03-16 21:25:39 +0100 x86_64 x86_64 x86_64 GNU/Linux

Both firewall and AppArmor are disabled.

Can someone help here? Thanks a lot in advance!

I don’t know what your problem is, because I have those message also but NFS is available for use. So those messages are normal.

But I cannot see the NFS partition without manually starting NFS. It is a strange problem.

I think these are error messages, are they normal?

Apr 10 20:07:56 hubble kernel: 33.806946] NFSD: starting 90-second grace period
Apr 10 20:07:56 hubble sm-notify[2271]: Already notifying clients; Exiting!

Thanks.

Yes I get those also but NFS works normally.

PS: There are two services: nfsserver, which is for NFS exports (server) and where those messages you reported come from, and nfs, which is for NFS imports (client). Make sure you have enabled the right one(s).

/etc/init.d/nfsserver status
/etc/init.d/nfs status

will tell you which ones are enabled.

/etc/init.d/nfsserver status

Checking for kernel based NFS server: mountd running
statd running
nfsd running

/etc/init.d/nfs status

Checking for mounted nfs shares (from /etc/fstab): unused

rpcinfo -p

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
100021 1 udp 42486 nlockmgr
100021 3 udp 42486 nlockmgr
100021 4 udp 42486 nlockmgr
100021 1 tcp 47237 nlockmgr
100021 3 tcp 47237 nlockmgr
100021 4 tcp 47237 nlockmgr
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100005 1 udp 34530 mountd
100005 1 tcp 47924 mountd
100005 2 udp 34530 mountd
100005 2 tcp 47924 mountd
100005 3 udp 34530 mountd
100005 3 tcp 47924 mountd
100024 1 udp 53925 status
100024 1 tcp 55462 status

so nfs has been started at boot, but it is not actually running unless I manual start the service.

It’s still not clear to me whether you are running your machine as a server or a client, or both. If as a client, you have not specified any imports in /etc/fstab.

I am running my machine as both a server and a client. I do have proper imports from /etc/fstab, otherwise the manual nfs start would not work. Thanks.

Post your /etc/fstab.

cat /etc/fstab

/dev/disk/by-id/ata-WDC_WD3200AAKS-75L9A0_WD-WCAV2H010498-part2 swap swap defaults 0 0
/dev/disk/by-id/ata-WDC_WD3200AAKS-75L9A0_WD-WCAV2H010498-part1 / ext3 acl,user_xattr 1 1
/dev/disk/by-id/ata-WDC_WD3200AAKS-75L9A0_WD-WCAV2H010498-part3 /boot ext3 acl,user_xattr 1 2
/dev/disk/by-id/ata-WDC_WD20EVDS-63T3B0_WD-WCAVY0950150-part1 /data ext3 acl,user_xattr 1 2
/dev/disk/by-id/ata-WDC_WD3200AAKS-75L9A0_WD-WCAV2H010498-part4 /home ext3 acl,user_xattr 1 2
proc /proc proc defaults 0 0
sysfs /sys sysfs noauto 0 0
debugfs /sys/kernel/debug debugfs noauto 0 0
usbfs /proc/bus/usb usbfs noauto 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
spitzer:/data2 /data2 nfs defaults 0 0
spitzer:/data3 /data3 nfs timeo=14,intr 0 0

I hope it helps. Thanks.

How is your network interface controlled? ifup or networkmanager? If NM, then the network isn’t up until you login.

The network interface is controlled by ifup. If it is due to network problem then I should see an error message in /var/log/message, right?

I seem to recall the NFS client is rather fiddly to get to work at boot, seems to need to be run at the right sequence point or need a delay after something, not sure what. I decided a while back the way to do it is using autofs which has the advantage of unmounting the NFS after inactivity. Also works with NM, provided the NFS is only used by users not system processes. So that’s the solution I’ve adopted.

It looks like I am not the only person having the problem. I found two similar threads.

openSUSE 11.1 not mounting NFS at boot - openSUSE Forums

NFS mount works manually, but not during boot up … why? - openSUSE Forums

I tried two more things:

  1. I used yast2 to make the fstab entry instead of doing it manually. Someone suggested that in newer version of SUSE fstab entry has to be added with yast’s “NSF client”.

  2. There is a suggestion in /etc/init.d/nfs that if run too soon after the network comes up, it may not work. I have added some delays in nfs script:

     if test "$nfs" = yes ; then
         sleep 9 && mount -at nfs,nfs4 > /dev/null 2>&1
         sleep 9
    

mount -at nfs,nfs4 > /dev/null 2>&1

    fi

I tried both and NFS will still not mount at boot. My IP is manually set, not DHCP.

So I really don’t understand why it still does not work. :frowning:

In the client’s fstab, replace the server’s hostname by it’s IP. I have an NFS/NIS combo running at home and at some networks I manage, don’t have the booting problem. Just to make sure, here’s the lines from /etc/exports and from /etc/fstab from server and client.
Server:


/disk/Data      *(rw,root_squash,sync,no_subtree_check)

Client


192.168.1.100:/disk/Data        /disk/Data      nfs     defaults 0 0

Here’s some more output:


glosscomputer@GjLzelF:~> rpm -qa | grep nfs
limal-nfs-server-perl-1.6.1-2.1.x86_64
yast2-nfs-server-2.18.1-2.2.noarch
limal-nfs-server-1.6.1-2.1.x86_64
yast2-nfs-client-2.18.0-2.2.noarch
yast2-nfs-common-2.18.1-2.2.noarch
nfs-kernel-server-1.1.3-21.3.1.x86_64
nfs-client-1.1.3-21.3.1.x86_64
nfsidmap-0.21-4.1.x86_64

Please also check the settings of your network card. It has to be set to be activated at boot (general tab of the network card’s options).

I have the same software installed.

# rpm -qa | grep nfs
limal-nfs-server-1.6.1-2.1.x86_64
nfs-client-1.1.3-21.3.1.x86_64
nfs-kernel-server-1.1.3-21.3.1.x86_64
yast2-nfs-server-2.18.1-2.2.noarch
yast2-nfs-client-2.18.0-2.2.noarch
yast2-nfs-common-2.18.1-2.2.noarch
limal-nfs-server-perl-1.6.1-2.1.x86_64
nfsidmap-0.21-4.1.x86_64

I double-checked the settings of my network card. It is set to be activated at “boot time”.

Now I use IP address directly instead of host name in fstab.

But still the same problem. >:(