Ubuntu / Linux news and application reviews.


While testing various stuff, I've managed to break Unity 3D quite a few times (by "breaking", I mean: the launcher, Dash and the top panel don't load and you log in to an empty desktop), like a recent bug that was fixed in Ubuntu Tweak 0.6 pre-release that caused Unity to crash. So I though I'd write a post with a few basic solutions for this, in case it happens to some of you too. 

This usually occurs if somehow the Unity plugin has been unchecked in CompizConfig Settings Manager: manually, by enabling an unsupported Compiz plugin that disables it, by some third-party application and so on.


Before proceeding, you must check and see if the issue is with Unity 3D itself or if it stopped working because of a bad graphics driver upgrade. To check this, login to to Unity 2D or any other session (GNOME Fallback, GNOME Shell, etc.) and run the following command in a terminal:
/usr/lib/nux/unity_support_test -p

You should get "yes" everywhere. If not, and Unity 3D used to work, it means there's something wrong with the graphic drivers and you should try to reinstall them. If you did get "yes" when running the above command, it means Unity is broken, so let's try to get it working again.


Please note that I've only tested the instructions below on Ubuntu 11.10 Oneiric Ocelot.


Unity 3D is broken - how to fix it


A. Launch a terminal using CTRL + ALT + T to be able to run CCSM and enable the Unity plugin


Login in as usual to Unity 3D ("Ubuntu" session), launch a terminal window by pressing CTRL + ALT + T and install CompizConfig Settings Manager (if you've managed to break Unity, CCSM is most probably installed, but anyway):
sudo apt-get install compizconfig-settings-manager


Then open CompizConfig Settings Manager by typing the following command in the terminal:
ccsm

And enable the Ubuntu Unity Plugin. If CCSM asks to resolve some conflicts, click the "Resolve Conflicts" button, then select the button on the right for each conflict ("Disable...").

If Unity doesn't start immediately after this, press CTRL + ALT + F1. This will take you to tty1 where you must enter your username and password. Here, type the following commands:
export DISPLAY=:0.0
unity --replace

Now press CTRL + ALT + F7 - this should take you back to the Unity desktop.

If Unity still doesn't start, press CTRL + ALT + F1 again and type:

- Oneiric+:
sudo service lightdm restart
- Natty:
sudo service gdm restart

This should restart LightDM / GDM so the login screen should show up - log in and Unity 3D (the launcher, dash, top panel) should now load.



B. Launch CCSM from tty1 to enable the Unity plugin

In some cases, you can't launch a terminal after trying to log in to Unity. In that case, here's what you can do.

Log in to the "Ubuntu" (Unity 3D) session anyway, it doesn't matter that Unity doesn't load, and press CTRL + ALT + F1. This will take you to tty1 where you must enter your username and password. Here, type the following commands:
export DISPLAY=:0.0
ccsm

Now press CTRL + ALT + F7. This should take you back to your Unity desktop and CompizConfig Settings Manager should start. Enable the Ubuntu Unity Plugin now. If CCSM asks to resolve some conflicts, click the "Resolve Conflicts" button, then select the button on the right for each conflict ("Disable...").

If Unity doesn't start immediately after doing this, close CCSM, press CTRL + ALT + F1 again and type:
unity --replace

Then press CTRL + ALT + F7.


If Unity still doesn't start, press CTRL + ALT + F1 again and type:

- Oneiric+:
sudo service lightdm restart
- Natty:
sudo service gdm restart

This should restart LightDM / GDM so the login screen should show up. Now log in to the "Ubuntu" (Unity 3D) session.


A bit off topic: this also works if GNOME Shell crashes and you want to restart it - press CTRL + ALT + F1, type "export DISPLAY=:0.0", then "gnome-shell --replace" and then press CTRL + ALT + F7.



C. Reset Unity and Compiz

It was also reported that you should be able to enable the Unity plugin by running CompizConfig Settings Manager in some other session (like Unity 2D or the classic/fallback GNOME session) and then log in to the Unity 3D session. However, this didn't work in my test under Ubuntu 11.10 Oneiric Ocelot (on my computer and 2 VMs). But you can try this too before trying to reset Unity.


If no solution above works, you can reset Compiz and Unity. I've left this as the last possible solution because you will lose any Compiz customizations you've set.

Log in to a different session (such as Unity 2D) or press CTRL + ALT + F1 and type:
gconftool-2 --recursive-unset /apps/compiz-1
gconftool-2 --recursive-unset /apps/compizconfig-1
unity --reset

Now log out and log in to Unity 3D ("Ubuntu" session) - the launcher and top panel should now load.