What do do when Linux gui freezes

65,321

Solution 1

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.

Solution 2

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.

Solution 3

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.

Solution 4

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.

Solution 5

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

Share:
65,321
tony_sid
Author by

tony_sid

Born and raised in California. Computers are my main hobby.

Updated on September 17, 2022

Comments

  • tony_sid
    tony_sid over 1 year

    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?

  • matthias krull
    matthias krull almost 14 years
    this 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
    matthias krull almost 14 years
    howto enable ctrl-alt-backspace ubuntugeek.com/…
  • Arathi Arumugam
    Arathi Arumugam almost 14 years
    They are all terminated because they loose there connection to X.
  • iamcrypticcoder
    iamcrypticcoder over 13 years
    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?