What do do when Linux gui freezes

24

10

I'm running Gnome with compiz in Ubuntu 10.04. Sometimes the gui will freeze. I can move the mouse, but I can't interact with programs. The only thing I can do is go to a terminal window with Alt+Ctrl+F(n). From there I login and do a sudo reboot. What else can I do at the terminal instead of rebooting to deal with this problem when it comes up?

tony_sid

Posted 2010-08-03T10:52:28.080

Reputation: 11 651

Answers

14

One solution that I use form time to time when things get crazy is to switch to another console, using Ctrl-AltFx (F1-F6). Ctrl-Alt-F7 should take you back to the graphic screen. This should take you to a text login prompt.

If this does not work and you installed OpenSSH (sudo apt-get install openssh), you can ssh to your box remotely and get the same prompt.

You can then login as yourself, su to root, and see which application are currently running. This needs a little experience with some of the commands such as ps, kill, grep and less.

ps - ef | more

The above command will show you all processes currently running, and you have a "More..." prompt to take tie to read the output.

kill -9 ####

The above command will kill the process numbered ####.

ps -ef | grep ora | more

The above command will show you all processes with the letters "ora", such as Oracle programs. Will also let you see "More..." prompts.

You need to be careful when doing this. you may kill the entire system. My way of doing this is to look at the processes at the bottom of the list, which will have the latest processes started. Those are more likely the ones that froze the system, and killing those can more likely unfreeze the X environment without actually restating the whole system. In the process list, you will see two numbers. The first (leftmost) is the process number itself, and the one next to it is the process that launched it.

In the commands of the processes, you may be able to recognize the name of the latest programs you started, and kill those first.

At best, you can find and kill the offending program. At worst, you will freeze the system until you power cycle it. Proceed carefully............................

But you have a chance to copy critical files, perform other operations, etc.

jfmessier

Posted 2010-08-03T10:52:28.080

Reputation: 2 530

8

Like private_meta said, you'll probably want to restart X. This stops all GUI processes running, including all processes started from a gui terminal window.

The Ctrl+Alt+Backspace doesn't work on Ubuntu, they disabled this shortcut. You can enable it (don't remember exactly how, but it should be easy to google) or just use the proper combination, which is SysRq + K. SysRq may be a secondary function of another key on some layouts, so for example on a qwertz keyboard you are actually pressing AltGr + Print + K.

For other uses of the SysRq key combinations, read this Wikipedia article. It gives you more controll over the system than you'll probably need.

rumtscho

Posted 2010-08-03T10:52:28.080

Reputation: 3 586

1

howto enable ctrl-alt-backspace http://www.ubuntugeek.com/enable-ctrl-alt-backspace-in-ubuntukubuntu-10-04lucid-lynx.html

– matthias krull – 2010-08-03T14:34:38.430

I have just tried Alt+SysRq+K on a not-frozen system and it gave me a white blank screen where I cannot do anything (aka a complete freeze?). How can that be helpful, or what did I do wrong? – phunehehe – 2010-09-13T07:11:15.760

4

In recent (upstart - enabled) Ubuntu versions you can type:

sudo restart gdm

Sometimes the you cannot switch to the text console, but then it still may be possible to login using ssh from another PC. Restarting gdm is then also possible and may fix you hanging display driver.

IanH

Posted 2010-08-03T10:52:28.080

Reputation: 1 144

1What does this do to the programs that were running in the gui? – tony_sid – 2010-08-05T11:57:32.973

2They are all terminated because they loose there connection to X. – IanH – 2010-08-05T12:24:50.413

2

If the ALT F(n) and mouse are all working you might also try forefully killing individual programs to see if one of them will release things. This is less tecnical but is a quick gui oriented way to see if something recently started is the problem.

ALT-F2 : To bring up the run program dialog which in my experience has usually worked even when everything else is locked up.

xkill : To force a gui app closed.

Click on the offending app and see what happens.

Dennis

Posted 2010-08-03T10:52:28.080

Reputation: 5 768

1

Mostly it should be possible to restart the Window Manager via Ctrl+Alt+Backspace. Although this kills your foreground apps, it still isn't a full reboot, it might be a compromise for you.

private_meta

Posted 2010-08-03T10:52:28.080

Reputation: 2 204

1this is disabled by default since 9.04 so it will not work. instead of reboot you could type /etc/init.d/gdm restart. – matthias krull – 2010-08-03T14:33:32.393

0

After a machine GUI freeze... I think a reboot is the best thing you can do, unless you have something important and long running in background.... Anyways, restarting gdm will kill your apps.

laurent

Posted 2010-08-03T10:52:28.080

Reputation: 4 166

0

Open a virtual terminal with the CTRL-ALT-F[number] shortcut, log in, sudo killall [dm] (where [dm] is one of gdm, gdm3, kde, wdm, lightdm, lxdm, etc), and start a new x session with startx

If you don't kill the dm, it won't make too big a difference. A frozen/hung dm doesn't use a large amount of processing power.

cepkos

Posted 2010-08-03T10:52:28.080

Reputation: 21