Question

I am using RHEL5.5. I wanted to shutdown nfs services in order to install and run a package. The installation itself tried shutting down the service and it failed.

It keeps saying "Shutting down nfs services [Failed]".

What is the problem here and how to shut it down?

Was it helpful?

Solution

As you said it is failing because of the nfs init script checking the number of lines in the exportfs and your /etc/export file empty, do the following

  1. navigate to /etc/rc.d/init.d/
  2. back up the nfs script (you can copy it to a different dir and rename it to nfs.bk)
  3. find the following section in the script:

    Do it the last so that clients can still access the server when the server is running.

    cnt=/usr/sbin/exportfs -v | /usr/bin/wc -l

    if [ $cnt = 0 ]; then

    action $"Shutting down NFS services: " /usr/sbin/exportfs -au

    else

    action $"Shutting down NFS services: " /bin/false

    fi

The bold section indicate that the if statement check whether exportfs -v has more than 0 lines. If you run this yourself you will find out that it actually has 0 lines which cause the script to fail. So change [ $cnt -gt 0 ] to [ $cnt = 0 ] and everything will work.

Take extra precautions when changing system scripts. Make sure you back the nfs script first and test it by running the following:

service nfs stop 

DO NOT REBOOT so it case something doesn't work you can always restore the original nfs scritp.

OTHER TIPS

You can try manually shutting down the service using the command

service nfs stop

and then try installing the package again.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top