Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've recently had to deal with a pesky, intermittent NFS client/server hung mount point issue. When the problem occurs on the client I cannot unmount, along with some other odd behavior. The only immediate resolution I have to date is to reboot the client box.

But shutdown -r now does not work at all. I've since discovered reboot -f, which does reboot the system. Why? I've read the man pages but nothing seems to answer my question.

Why Does shutdown -r now behave differently than reboot -f?

(I'm continuing to resolve the NFS issue, but that is not my question here.)

share|improve this question

4 Answers 4

up vote 13 down vote accepted

From the shutdown man page:

Once TIME has elapsed, shutdown sends a request to the init(8) daemon to bring the system down into the appropriate runlevel.

init starts and stops jobs as the system changes runlevels. When entering runlevel 6 due to a reboot, the system runs all the scripts in /etc/rc6.d. Since your system is not responding to shutdown, it's likely a script in /etc/rc6.d (possibly K05nfs-common given your NFS issues) is stuck, not allowing the shutdown sequence to finish. In fact, the last thing init runs when changing to runlevel 6 is reboot -d -f -i.

reboot -f skips all the scripts and reboots the system directly.

share|improve this answer
    
Thank you very much for linking your answer to my context. –  Stu Thompson Mar 28 '11 at 15:05

shutdown instructs init to begin the shutdown procedure, which involves letting logged in users know that the system is shutting down, killing all the processes gracefully, unmounting and syncing drives, and so on. You're getting hung up here because processes stuck waiting for IO tend to be very hard to kill, and your stuck NFS mount can't be unmounted.

reboot -f, on the other hand, immediately reboots the server without doing any of that. (reboot is the program init calls to shut down the server. Without the -f flag, it will check to see if init thinks it is currently rebooting, and if not, it will call shutdown instead to start the process).

share|improve this answer
    
Thank you very much for linking your answer to my context. –  Stu Thompson Mar 28 '11 at 15:06

Because 'reboot -f' does not go into runlevel 0 - it tells the OS to reinitialise the CPU directly. Man page on my nearest Linux box says:

 -f     Force halt or reboot, don't call shutdown(8)

The shutdown man page explains more.

share|improve this answer

If you use the intr option on your NFS mounts, then shutdown -r now should be able to kill processes waiting on NFS IO to complete. This may result in file corruption, but likely no more than shutdown -f creates.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.