Linux hang crash

From PeerFreedom Wiki
Jump to navigation Jump to search

Linux - recover, debug after a crash, hangs.

Tools

Sysrq

Press alt+sysrq and then while still hodling alt press alt+? (alt+shift+?) to get "SysRq-?" which prints list of Sysrq to console (you must be in a standard text terminal like VT-1, that is press ctrl+alt+f1 as described in VT-1)

Sysrq+S - synces all disks (and a debug is printed to VT by default, and maybe to logs like dmesg too)

SUB

Typical sequence is to execute Sysrq+SUB, that is: hold ALT all the time and

  • press Alt+Sysrq, Alt+S, (wait)
  • press Alt+Sysrq, Alt+U, (wait)
  • press Alt+Sysrq, Alt+B

(so called SUB for short) results in : Sync, Unmount, reBoot, therefore SUB typically forces a hanged computer to more-or-less safely reboot. You can wait few seconds after each key, to give it chance to execute well.

Config

Sometimes some Sysrq combinations are disabled in options of linux/kernel.

Other

Sysrq+R and then switch to VT-1 often helps in case of hanged X server (R is to make sure X lets go of the keyboard - Raw mode).

Sysrq+M, Sysrq+F: prints debug about Memory, and then removes Full memory (by killing some programs) sometimes helps (after waiting a moment) in case of computer almost-hanged due to no free memory/swap.

Remember Sysrq+? makes the kernel print list of all sysrq keys it supports.