Kernel panic and X hangs

Kernel panics in an away machine and X hangs always are inconvenient problems, here you can have some help with them!

Kernel panic
If you're running a server that you may not have easy access to, a kernel panic typically means an inconvenient trip to reboot a system or a phone call to inconvenience someone else. You can configure you system to reboot after a panic:

This tell the kernel to reboot after 20 seconds after a panic happened. Don't forget to take a look in your logs to find out what is causing the panic!

X hangs
It is annoying when the X hangs and the keyboard stop to work, isn't it? I am sure that almost everybody had this trouble at last once! Put a finger at the restart button or shut down the X (using a ssh connection from another computer) can solve it, but can be danger or to much work ;-)

You can use the magic SysRq support do solve it. First make sure that CONFIG_MAGIC_SYSRQ is enable at you kernel:

If the output is not like this you should compile it in the kernel:

Ok, now enable it at /etc/sysctl.conf:

Now, if you need, you can use it whit the key combo: [ALT]+[SysRq]+[command key], Note - Some keyboards may not have a key labeled 'SysRq'. The 'SysRq' key is also known as the 'Print Screen' key. There are many command keys (look at /usr/src/linux/Documentation/sysrq.txt for a detailed list), but here we have a resumed list:


 * r - Turns off keyboard raw mode and sets it to XLATE. This can be useful if the X-Server crashed, you can change to a console and kill the X-Server or check the error log.
 * s - attempt to sync all mounted filesystems
 * e - sends a SIGTERM to all running processes, except for init
 * i - Send a SIGKILL to all processes, except for init
 * u - attempt to remount all mounted filesystems as read-only
 * b - reboot immediately without syncing or unmounting disks

If nothing works the following sequence may be better than just hitting the power button:


 * 1) Alt+SysRq+s - sync the disk
 * 2) Alt+SysRq+e - try to nicely kill processes (wait a little bit here)
 * 3) Alt+SysRq+i - no more mister nice guy
 * 4) Alt+SysRq+u - unmount disks (wait a bit here, too)
 * 5) Alt+SysRq+b - reboot

I can remember that with "So Everything Is Unusual - Boot!"