NFS Troubleshooting: RPC Error Program not registered possible solution

Sunday, July 20, 2008

Today when I was trying to mount an NFS shared folder from a solaris box on a linux host, I got the below error message (assume that the linux and solaris hosts are linux-host and solaris-host rspectively)


mount to NFS server 'hostname' failed: RPC Error: Program not registered


The directory /opt/web-apps from the solaris-host is to be mounted on /mount-app in linux-host.

bash-3.00# mount solaris-host:/opt/web-apps /mount-app
mount: mount to NFS server 'solaris-host' failed: RPC Error: Program not registered.

The Solaris host seems to be missing some entries in /etc/dfs/dfstab as shown below (In Solaris, the /etc/dfs/dfstab has NFS mount related details)


bash-3.00# cat /etc/dfs/dfstab

# Place share(1M) commands here for automatic execution
# on entering init state 3.
#
# Issue the command 'svcadm enable network/nfs/server' to
# run the NFS daemon processes and the share commands, after adding
# the very first entry to this file.
#
# share [-F fstype] [ -o options] [-d ""] [resource]
# .e.g,
# share -F nfs -o rw=engineering -d "home dirs" /export/home2

I inferred that if dfstab has no entries, you may get an RPC Error as mentioned above, that being said, now I NFS share the above resource by adding the below line in

/etc/dfs/dfstab on solaris-host

share -F nfs -o rw -d "Webapp dir" /opt/web-apps

Where

-F is the filesystem type,
-o is to specify access control, which is rw (read-write) for the above command,
-d specify description of the shared resource followed by the resource to be shared through NFS.

For more help on share command, visit the man page here.

One can also use the share command as shown below

bash-3.00# share -F nfs -o rw -d "Webapp dir" /opt/web-apps

But then the above command won't persist reboots, therefore its a better option to edit the /etc/dfs/dfstab and add the resource to be shared if it needs to persist

reboots.

Then, the nfs service needs to be restarted.

bash-3.00# /etc/init.d/nfs.server stop
bash-3.00# /etc/init.d/nfs.server start

Now the mount will succeed

bash-3.00# mount solaris-host:/opt/web-apps /mount-app
bash-3.00#

To put it in a nutshell, I observed the following behaviour wrt NFS, hope these will be useful for troubleshooting NFS.

1. If /etc/dfs/dfstab has no entries and you try to mount a directory from the remote system through NFS, an RPC Error: Program not registered error will be thrown.

2. If an entry is added in /etc/dfs/dfstab to share a resource and you try mounting another directory in the remote system which is not shared, you will get a "Permission denied error" as shown below.

For example if /opt/web-apps is shared through NFS in the solaris-host using

share -F nfs -o rw -d "Webapp dir" /opt/web-apps

trying to mount /var in the target system would result in the following.

bash-3.00# mount solaris-host:/var /mount-app
mount: solaris-host:/var failed, reason given by server: Permission denied

Therefore RPC Error will be thrown ONLY when /etc/dfs/dfstab has no entries.

4. If mount needs to persist reboots on client side (from linux-host), add the following entry in /etc/fstab on the linux host.

solaris-host:/opt/web-apps/ /mount-app nfs nouser,auto,rw 0 0

where

solaris-host:/opt/web-apps - The mounted directory
/mount-app - Mount point
nfs - Type of file system
nouser - Can be mounted only by root and not any user
auto - Mounted at boot time
rw - Mounted directory has read-write permissions
The number in the fifth column if for file system backups, 0 means ignore backups
The number in the sixth coulmn is for fsck option to check the file system, again 0 means such checks are ignored.

After adding the above entries, make sure you restart NFS using

bash-3.00# service nfs restart

Now the NFS mount between linux client and the solaris will persist reboots.

5. For the sake of completeness, from a solaris client you need to add the following in /etc/vfstab for persistent mounts.

The contents of the initial lines in /etc/vfstab on a Solaris 10 would be like the following

bash-3.00# cat /etc/vfstab

#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options

The comment says it all about vfstab entries, so for a mount to persist a solaris client, the entry would be

solaris-host:/opt/web-apps/ - /mount-app nfs - yes rw

No comments:


Copyright © 2016 Prasanna Seshadri, www.prasannatech.net, All Rights Reserved.
No part of the content or this site may be reproduced without prior written permission of the author.