Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Often compiz will crash and leave the keyboard useless. Normally I drop to the console and restart GDM.

Is there a solution where I can start Compiz back up without losing everything in the current session?

compiz --replace &

That's how I usually restart Compiz when it crashes and I can still use the keyboard.

(If you have a tip on how to prevent Compiz from crashing I've posted here Fresh install of 11.04x64 - display(compiz) constantly failing

??? - Am I right that Compiz is failing or is it X?

share|improve this question
up vote 10 down vote accepted

If it's "just" a compiz crash, you should be able to restore it from one of the TTYs, even if the keyboard isn't working in X.

  1. hit ctrl+alt+F1 to get to the console

  2. Login with your usual username and password

  3. Type the following:

    DISPLAY=:0.0 compiz --replace &

  4. If compiz is still really hanging, you may need to kill it with more authority and try again:

    killall -9 compiz

    DISPLAY=:0.0 compiz --replace &

  5. Then hit Alt+Left Arrow until you get to the screen where X is running.

share|improve this answer
This got me part of the way there. Some of my workspaces/viewports were missing (only 4 of 9 showed up), and the panel and launcher were missing. I had to give it the ol' "sudo service lightdm restart" unfortunately. – colan Feb 9 '12 at 17:10
it may be helpful for me. thx – Searene Feb 17 '12 at 8:14
Of all the similar answers for this (and related) question(s) I've seen around, this one seems to me to be the most accurate, thanks! The only problem remaining is how to remember it when you need it ;) – nutty about natty Jan 16 '13 at 16:16

If the mouse is still working after such a crash you could add a starter for /usr/bin/compiz --replace so you can start with a mouse click.

share|improve this answer
yeah, That's a solution that will work. I like to keep a clean desktop, I don't use icons or a panel. This will work though. – winchendonsprings May 16 '11 at 19:12
If you have a Terminal open you can use the mouse to copy&paste the needed characters (including a trailing linefeed) into the terminal - that usually works even if the terminal doesn't have the focus. – Florian Diesch May 16 '11 at 19:24
So I will have to keep something open with the characters needed? I mean I could do character by character of - c o m p i z (space) r e p l a c e (space) & – winchendonsprings May 16 '11 at 19:34
If you don't have something with the needed chars you first need to run a command that outputs them, maybe using the chars from your prompt. – Florian Diesch May 16 '11 at 19:53

My solution is similar to Eric's solution.

Except I do just type "unity" as it seems to work a lot better for me:

ctrl+alt+f1 - Takes you to command prompt

> unity

alt+left to get back the gui.

For me it looks a mess for about 20 seconds. But then, I actually get back all my windows and can continue working like nothing happened.

"DISPLAY=:0.0 compiz --replace &" Did not work for me and I lost a lot of the functionality.

"sudo service lightdm restart" restarts the whole thing and you loose all your windows. Maybe its faster than rebooting.

I believe that compiz is really the issue here and has something to do with too many tabs open. If I flick back to the terminal, I can actually see this bug: "intel_do_flush_locked failed no space left on device" A few people are complaining about it around the internet.

share|improve this answer

There is this script

Each 10s it will check if there is a window manager running, if not, it will start it; you can also replace them at will (currently it supports compiz and metacity).
It is interactive so requires to be run on ex. a xterm like xterm -bg darkorange -e ";bash"&disown.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.