X server crash recovery
patrol at sinus.cz
Mon Oct 8 01:26:21 PDT 2007
> Since most people use some DM, they usually aren't as affected by a
> "random" crash as a new server will be started, but a switch to a
> virtual console will be impossible. I am more concerned about some way
> to "kill" the server from the keyboard when something like a driver, is
> spinning in some infinite loop.
I'm using ACPI for such a purpose. I've written a single script, which is
called by pressing the POWER button. The script counts how many times the
button is pressed and then (when there are no more presses for two seconds)
it performs an action. Currently, the following actions are performed:
1 press: STD (suspend to disk/hibernation)
2 presses: kill the X server (it tries to use more and more powerful signals
ending with SIGKILL until it is killed)
3 presses: init 6 (reboot)
4 presses: init 0 (power off)
5 and more presses: Ignored (so you can easily cancel unwanted action by
issuing at least 5 presses)
Every button press is signaled by the PC speaker beep with increasing pitch,
so you have an acoustic feedback that the system is receiving your presses.
So I can kill X without any help from it, even it's completely frozen. When
the system is crashed so deeply that it can't deliver ACPI events (no beeps
when pressing the power button), you need to use Reset button - it would not
be possible to use the network anyway.
Of course you need the ACPI subsystem compiled in and active.
More information about the xorg