Users have traditionally used ctrl-alt-backspace to kill X when something goes wrong. This functionality is being removed (or moved to a different key combination) because it is too drastic, too easy to hit by accident, and too hard to understand. A better solution would be to let users hit ctrl-alt-F1 to get to a menu system, where killing X was one amongst a selection of options.
/etc/event.d/tty1 would be modified to run a "blue-screen-of-life" ("BSOL") application. BSOL would be an ncurses menu-based program. The main screen would look like this:
* Emergency console * You have pressed ctrl-alt-F1. This screen lets you close programs that have locked your system up. Press ctrl-alt-F2 to go to a terminal * Go back to where you were * Close <name of program with greatest memory usage> * Close <name of program with greatest processor usage> * Close <name of program with greatest number of recent page faults> * Close <name of program with greatest amount of I/O> * Close another program (specified below) * Fix screen size * Log out and back in again * Restart the computer * Shut the computer down
Note: "go back..." would run chvt 7, "log out..." would kill X. The program would get the initial screen size with xrandr when a user logs in, and would offers the option to fix the size when xrandr starts reporting a different size.
I'm not aware of any way to detect whether a tty is currently focussed by the user, so these options would be updated every 5 seconds unless the user had pressed a key in the last minute. Pausing if a user presses a key would ensure that options don't suddenly change while the user is picking one.
These options could only be selected by pressing up/down then enter. If the program let you press the 1 button to select option 1, it would be too easy to accidentally send yourself back to a hung X session. Similarly, the more drastic options (log out etc.) are sorted towards the bottom, so that users have to press several buttons before getting to them. The command-line is only available as an instruction for similar reasons - making it a menu option would make it too easy for people to get into trouble.
Closing any program (or killing X) would cause a window to appear that would look like this:
* Closing <name of program> * Please wait, up to 5 seconds remaining... Press enter to force this program to close (any work will be lost)
The '5' would count down to 0, at which point the program would be killed with SIGKILL (i.e. kill -9).
The program would be written in Python, with each of the menu options in a separate file (and a separate module), so that other people could easily come along and add new options. The program would run at nice level -20.
This would be a safer alternative to ctrl-alt-backspace, because the user has to go through a series of self-documenting actions before they can kill X. It would also be more useful, because the user can close just the misbehaving program in some cases.
Putting this program on tty1 means that expert users should discover it fairly quickly, and will then pass it on to their novice friends. Making it run at -20 should ensure that it runs fairly smoothly, even under conditions of extreme load.
Maybe the Close options could be hidden in a submenu so we don't need to have yet another process continually waking up (and at -20 nice) -- JohnMccabeDansted