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 & Shells

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

Home » Commands & Shells, Filesystems

Forcing Linux to Reboot

Submitted by on January 29, 2010 – 3:21 pm 11 Comments

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.

Print Friendly, PDF & Email

11 Comments »

  • Morten-Christian Bernson says:

    Thanks, this was very helpful when I had to reboot a remote machine with nfs-hang…

  • Mathew says:

    Virus Software detects no viruses, Windows Defense Virus Evidence is clear, Followed online tutorials to delete this virus manually but still redirects, every 5 minutes Windows processes stop and forces a reboot.

    Windows sucks and I never have this problem on linux, Would be using Linux right now but Online Studies Require Windows Os and Windows only programs.

    Any suggestions on how to locate and destroy this virus?

  • Pacman says:

    Hi
    I’m sai narasimha reddy, from hyderabad.

    I’ve mercury motherboard 915 motherboard, intel 2.4Ghz p4 processor. I’m unable to install linux in my system. Though ubuntu 7.04 is being installed i’m getting only 600 by 480 resolution.

    Please give me a solution to my problem.

    Thanx in advance!

  • Michael says:

    whats the best starting out linux program

  • Erfan says:

    recently, i have been playing around with themes and wanted to get a windows 7-ish theme.

    I enabled many effects in compiz-config, changed my start button from the generic linux mint 10 default to ‘Gnomenu’, changed from the old window switcher to ‘DockbarX’. and installed a program called emerald Theme manager, (however, i cant figure out what it does or how to use it and change the theme of my desktop?). I continued with tweaking gnome 2.x, and followed instructions (http://www.webupd8.org/2010/05/enable-rgba-transparency-in-ubuntu-910.html) on how to enable RGBA module needed for some certain themes. after i installed ‘GNOME color-chooser’ and went to the last tab where i changed a the first ‘engine’ and enabled RGBA support. nothing happened or changed, I was disappointed, i then restarted the computer, this is where things all went wrong!

    the compiz effects work, open windows have a theme and are translucent, however, the desktop just has a plane grey (or gray, both spellings are correct) background. and whenever i open ‘Appearance’, and try to change the background, the entire GUI freezes, all except for the mouse pointer, i can move it around, but i cant click on anything, the keyboard does nothing, i have to force-restart to get it working again. the same thing happens when i try to change the setting in ‘Gnome color-chooser’

    I believe the problem is that ‘Appearance’ and ‘Gnome color chooser’ are conflicting programs and don’t work well with each other. i don’t think it has to do with my GB of DDR2 RAM, or anything, otherwise the entire system wound freeze, right? so, how do i fix it? i want to have a windows 7 theme with my top bar transparent

    (ya know, this ->){program name========= _ [] X }
    I like Linux, and i am not paying for a software, let alone an entire OS. i just want a different theme is all,

    my the areo theme i mean the transparent titlebar.
    i meant: by the areo theme where i mention that above, i mainly want the transparent titlebar.

  • Jason M says:

    I recently cleaned my registry using ccleaner. Since then, after maybe 2 or 4 minutes my laptop starts to freez and I am forced to shut it down by pressing and holding the power button. I tried to restore it to a previous point but have the same problem. It freezes for brief moments and then works for a bit but then will freeze again. Does anyone know what is wrong or what I need to do to fix this problem. Also the fan is working fine so it’s not overheating.

  • Kaden says:

    It is like 10 years behind Windows in usability, security, and stability. Why would any sane person use Linux?

  • turg143 says:

    My OS is Windows Nt professional 2000. So here is my problem. When I reboot the computer, it boots up to a blue screen that gives you two options which are: F2 to enter setup or ESC to enter boot setup. Ok I press F2 and it goes through its setup or run which is on a black screen.When it finishes, it has this in the text at the bottom; ATAPI CD-Rom HL-DT-ST-GCE-832OB-(SM) error 02BO: Diskette drive A error. F2 to enter setup. So press F2 and it takes me to the BIOS Utility screen. My boot sequence is as follows: 1) ATAPI CDRom 2) Diskette drive 3) Harddrive 4) Network Boot 5) [MBA UNDI (Bus 0 Slot 11)]. I have tried different variations of Boot sequences and nothing seems to work. So I reboot and it takes me back to the blue screen with options as I have stated in the text earlier. So I press ESC and it takes me directly to the BIOS Utlity screen. For some reason it is not wanting to boot from the harddive. Got any suggestions? If so PLEASE do tell!
    AND no there isnt a floppy in the diskette drive.

  • Erin says:

    I’m trying to Restart the computer and boot from the DVD or alternate system. #

    Open a terminal window.
    # 4

    Type “fdisk -l” (without the quotation marks) to see the hard drive and partition device names. This displays the hard drives and partitions on your system. Make a note of the hard drive or partition you want to scan for the “e2fsck” command. Please note the parameter after the command is a lower-case “L.”
    # 5

    Type the following command: sudo e2fsck -cfpv /dev/sdb2. Replace “sdb2” with your actual device name, this can be an entire drive, such as “sda” or a partition, such as “sda1.”

    The parameters have the following meanings: “c” searches for bad blocks and adds them to the list, “f” forces a check on the file system, “p” repairs anything that can be safely repaired and “v” is verbose mode so you can see the command progress.

    The “e2fsck” command can take a long time to run, even several hours on a particularly large drive.
    # 6

    Exit the terminal after the “e2fsck” command is finished.
    # 7

    Remove the DVD/CD if any and reboot the system. Your file system is up to date with any bad sectors and will avoid them; any repairable issues have been fixed.

    Read more: How to Fix Bad Sectors in Linux | eHow.com http://www.ehow.com/how_7226154_fix-bad-sectors-linux.html#ixzz2LzjFwLA5
    I don’t know what x window’s is? I’m on linux.

  • Keaton says:

    i would like to turn a couple of my old computers into some extra support for my new one. is this possible and what would i have to do if it is? should i use linux or something? i really have no idea what to do or where to start.

  • Donld Lund says:

    Thanks for this. It’s a lot cleaner than having to run to the server and hold the power button till the thing shuts down. You’re a genius man.

Leave a Reply

%d bloggers like this: