27

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?

8 Answers 8

15

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.

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.

2
  • 1
    howto enable ctrl-alt-backspace ubuntugeek.com/… Aug 3, 2010 at 14:34
  • 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
    Sep 13, 2010 at 7:11
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.

2
  • 1
    What does this do to the programs that were running in the gui?
    – tony_sid
    Aug 5, 2010 at 11:57
  • 2
    They are all terminated because they loose there connection to X.
    – IanH
    Aug 5, 2010 at 12:24
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.

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.

1
  • 1
    this is disabled by default since 9.04 so it will not work. instead of reboot you could type /etc/init.d/gdm restart. Aug 3, 2010 at 14:33
1

this worked for Ubuntu 20.04
Ctrl+Alt+F3 to get to the console
login and run :
sudo systemctl restart gdm

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.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .