Server and Network Monitoring with iPhone
February 25, 2010 – 6:53 pm | No Comment

What is a Unix sysadmin doing with an iPhone, you ask? It was a birthday present, if that’s all right with you. I know, I should have gotten something odd with a beta version of …

Read the full story »
Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands and Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands and Shells, Filesystems

Forcing Linux to Reboot

Submitted by Igor on January 29, 2010 – 3:21 pmNo Comment
Forcing Linux to Reboot

Until I branched out a few years ago from supporting Unix server to working with Linux clusters, I never really encountered this issue: you type “reboot”, “init 0″, or “shutdown” as root and… nothing happens. Or the system starts going down but then hangs on unmounting a filesystem or unloading a module. I think this happened once to a colleague of mine who was rebooting a Solaris server, but this is a common problem with Linux.

So what do you do when you need to reboot a stubborn Linux box? A likely reason for a Linux system to hang on shutdown is NFS and specifically – a stale NFS mountpoint. Before rebooting or shutting down the server, try unmounting filesystems manually. Open several SSH/telnet connections to the server (just in case one of the sessions hangs) and try running “umount -f” or “umount -l”. After that try shutting down NFS client manually by running “/etc/init.d/nfs down”. If this still hangs, at least now you know what’s messing with your reboot.

There are two more likely reasons for a system failing to respond to the “init” command (both “reboot” and “shutdown” are linked to the “init” command): a bad disk or a kernel module (such as a device driver, for example) failing to unload. If you really need to force your system to reboot, issue the following commands:

sync ; sync
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger

If you need to shut down the system, replace the last line with “echo o > /proc/sysrq-trigger”. Also, if your system disk is going bad, you may want to skip the “sync ; sync” part.

If you reboot the system using the “sysrq” trigger above, you will end up with some filesystem corruption. You should expect that during boot-up the system will run fsck for a while. So don’t panic if your server does not come up right away.

Popularity: 4% [?]

Related posts

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.