How do you handle unity freezes?

This is a question in general. Sometimes when using Natty, the interface freezes like the keyboard works but the mouse does respond. In which case pressing Ctrl+Alt+F1 puts me at the terminal. However I do not know how to load the GUI and Unity and continue using Ubuntu. At present I just shutdown properly and restart.

I have no expertise in this regard, which is probably why some of the terms I use could be wrong. Please correct me if necessary.

How do I restart the Xserver or GUI(Gnome and Unity) when I press Ctrl+Alt+F1?


Solution 1:

There are a few ways to do this. My personal favourite is to login to the F1 text console as yourself. Then type

sudo service gdm restart

This should kill you previous X server and restart it. Sometimes it fails to kill properly, but it will start another X server on tty8 (CTRL + ALT + F8)

Solution 2:

You can restart X in 2 different ways staying at graphical tty (i.e. tty7).

  • First you can try

    Ctrl + Alt + Backspace

(this shortcut isn't enabled by default. To enable, go to Menu > System > Preferences > Keyboard > Layout > Options > Key sequence to kill X server).


  • If it doens't work you can use the kernel to do this. The "shortcut" is:

    Sys Rq + Alt + K

    (or for laptops:

    Fn + Sys Rq + Ctrl + Alt + K)

For reference, see Wikipedia: Magic SysRq key.