Linux is well known for being a rock-stable OS. X, the client-server based frontend usually used to provide GUI functionallity, however, is known for occasionally going south. In the interest of better understanding of how to deal with this frustrating occurance, I present this brief tutorial.
Often times the unlucky X user will find himself faced with an X window that wont go away. It may refuse to refresh or even close. There are generally 2 ways of attempting to deal with this. If one is able to use a shell, one can run a command, such as:
$ps -ax | grep process name
$kill -9 offending pid
An easier way to deal with this is a very handy program called xkill. this can be run from the shell, run from a menu, or in a pinch summoned with Ctrl-Alt-Esc. Just put the pointer over the offending window and click.
Sometimes, problems with X can be much more serious. These are the times when the whole GUI locks up, or becomes so unresponsive that usual methods of logging off, or even rebooting, are unavailable. This doesn't always mean a forced unclean reboot. The protocol for dealing with this is often disabled in some linux distributions(and does require kernel support). To enable it, use your favorite editor(as root, of course) and open /etc/sysctl.conf and insert a line reading:
kernel.sysrq = 1
After doing that, you should be prepared for amost all X-based porkage :)
Now next time X goes to sit under a tree, try this sequence of keystrokes:
alt-sysrq-r (should unlock your keyboard. In some cases you may be able to stop here.)
at-sysrq-k (kills all current processes on your virtual terminal.)
alt-sysrq-s (syncs your hard drive.)
alt-sysrq-u (unmounts your filesystems.)
alt-sysrq-b (should give you a reboot!)
If all goes well, you should be able to reboot and recover with your filesystems clean.
None of this is new knowledge to many, but I felt it was good to put it here for all y'all linux newbies...
September 12th, 2002, 02:10 AM
Thanks for the nice little bit of info. I will definitely try this out at home on my box when (god forbid) it ever crashes :)
September 12th, 2002, 02:17 AM
Thanx for the tip.
September 12th, 2002, 02:19 AM
Good post. I'm sure most people have run up against a misbehaved X app from time to time.
I would just add that <Ctrl><Alt><Backspace> will kill the X server and drop you back to the command line (or restart the server and take you to the xdm login if you're in runlevel 5). Not very elegant, but it works.
I didn't know the one about /etc/sysctl.conf. Nice job.
September 12th, 2002, 02:21 AM
Indeed Problem... I'd say I use ctrl-alt-backspace a lot more often then the sysrq stuff.
September 12th, 2002, 02:29 AM
I find that apps run under KDE crash quite a bit, if not X entirely. I definitely appreciate this information!
September 12th, 2002, 02:30 AM
I have had this happen to me before (not often though), and now i atleast know how to fix it. Thank you for that little tidbit.
September 12th, 2002, 03:04 AM
My linux machine was suffering intermittent "freezes" sometimes up to two a day and sometimes after 9-10 days of operation.
I tried all of the solutions above but to no avail. Could not telnet (ssh) into the machine or use it directly - it was locked fast - a complete power shutdown was the only solution.
In the end it was hardware failure - the old Quantum 6.4gb HDD was dying - this has been replaced with a 20gb Seagate and the machine has been running for 40 days now without a glitch since, including much quieter operation.
Just something to keep in mind also, while the OS was rock solid, my hardware wasn't !!
Good post Dr Foobar
September 12th, 2002, 10:35 AM
Phat_Penguin, I was having that same trouble. A complete freeze. It turned out to be the old hard drive also, or so I thought. I am glad to know that I am not the only one. :)