Not Unified: Removing Unity from Ubuntu 12.04 LTS

Before I begin: if you would just like to remove “as much of Unity as possible” without reading my personal upgrade woes — please skip to the end :)

So, i’ve almost succeeded in upgrading most of my personal boxes from Ubuntu 11.10 and 10.04.4 to the new Ubuntu release.

Oh, by almost and upgrading — I mean “back up to external drive, re-format, re-install, set up new configuration via a script, then copying everything back from the external drive” — but that’s just me, having used Linux in one way or another since 1993 and having seen ‘upgrades‘ fail in a wide variety of funny (or not so funny) ways.

I should point out, I tried upgrading this time around, one server and one desktop (from 9 machines and several VMs on those machines) — just to see what would happen & well, let’s just say Andrew covered things a lot better than I did.

Now, unlike Andrew — who seems to enjoy building things from bottom-up, I prefer to install whatever the distribution gives me then tweak it to do what I need to do in order to get things to work, which meant I was presented with a brand new Unity desktop.

Well, I wasn’t at first — that’s actually covered in another article — as the two machines I did first both have hybrid graphics systems by nVidia referred to as “Optimus”, which has one nVidia GPU and one discrete Intel one — so what I actually got, was, um, not much actually — but i’ll save you the read here and move on with the purpose of this post …

Skipping forward 9 or so hours:

I didn’t like what I saw.

To be fair, i’m not a one-desktop-to-rule-them-all purist either — as a firm believer of “just use the best thing for the job” — i’ve used, developed, packaged, advocated and supported desktops all over in my F/OSS life, CDE, KDE (1, 3), GNOME (0.x -> 3.0), Openbox, GNUStep, I used to tweak FVWM & TWM in the real early days — and before TWM, it was OS/2 and doing cool stuff with it.

But I digress…

I tried using it, for three whole days I tried to use it as my default desktop, which — comprises of approximately a VM, 12 or so Terminal windows, a web browser and a music player — plus or minus a jabber client.

I added “lenses“, had crashes.

I removed items, then added new ones to the dock, had crashes.

I fired up the first set of Terminals I usually used, then used the Window switcher to move to another virtual desktop, had crashes.

I tried Firefox and couldn’t see a global menu as suggested, instead, I saw the outside of the menu (aka. a 1px border) with speckled contents — then found errors in dmesg about DRM & hangcheck errors from the Intel based GPU in the machine.

Slept on it:

Tried using LibreOffice to write up a document and examine a spreadsheet and found everything too cramped — then used the interschnitzel to discover LibreOffice doesn’t actually support the global menu out of the box … did the requisite:

# apt-get install lo-menubar

and tried again, only to discover the global menu had wandered off like it had in Firefox and the messages in dmesg had returned.

Tried Ubuntu-2D, which didn’t start — it instead popped up a box that said my X configuration was broken.

"Broken X Configuration"

"This is what it sounds like, when Paul cries." -- but in all seriousness, what does an "everyday Ubuntu user" do when presented with this?

Needless to say, I clicked the Reconfigure Graphics option, which presented me with a black screen (ie. X crashed back to TTY1) — a reboot later, I tried the Run in low-graphics mode for just one session which, also presented me with a black, blank screen, so, being somewhat used to X crashes because of broken setups in days gone by, I went looking for my X configuration — then any reference to xorg.conf — then any help on the subject — then proceeded to swear, quite a bit.

… moving along …

I thought, “i’m over this, I wonder if GNOME Shell works on this setup?

# add-apt-repository ppa:gnome3-team/gnome3 && apt-get -f update
# apt-get -f install gnome-shell gnome-tweak-tool gnome-session-fallback 

The former installs gnome-shell & gnome-tweak-tool for customising your setup, the latter installs Ubuntu’s “classic GNOME desktop” — just in case.

Minutes later, I was in GNOME 3.4, in my browser, answering my mail.

Moments later, hangcheck bit me again, forcing a reboot, but as I said earlier, in my case, that’s a different issue.

So, having rebooted, selected GNOME as my default setup from the greeter and was ready to use my machine — I thought:

if i’m never going to use Unity, because it doesn’t actually appear to work, why don’t I get rid of it?

Turns out, that’s a little harder than it looks — there’s numerous examples of ways to do it on the interschnitzel, but all of them ended up either:

  1. Breaking the Desktop (either by claiming X was broken and things were running in low-resolution mode, or by experiencing crashes in software that was linked to the Unity libraries themselves).

  2. Removing Applications you might actually need (including, for example, Nautilus and GNOME Shell itself, as well as Brasero, Rhythmbox, Totem & other GNOME-y related goodness) because they’ve been linked with Unity libraries at either the packaging level, buildtime, or runtime.

(yes, 2 == 1, when you think about it).

In addition, a number of the sites I found recommend getting rid of the indicator-applets packages — which, breaks the fallback session quite severely too, so we don’t want to do that either.

The Juice Is Loose

So, without further delay (aside from saying “running these commands, as they are written here, in the order I have them listed, all work for me and have been well tested on my 12.04 LTS installs, but if they hose your desktop, delete your information, or eat your dog — I take no responsibility for any of it” — operator beware and all that.):

Log Out of Unity, ALT-Fx to your favourite TTY, login, sudo to root and run:

# apt-get --yes purge unity unity-2d unity-2d-places unity-2d-panel unity-2d-spread 
# apt-get --yes purge unity-asset-pool unity-services unity-lens-* unity-scope-*
# apt-get --yes purge liboverlay-scrollbar*
# apt-get --yes purge appmenu-gtk appmenu-gtk3 appmenu-qt
# apt-get --yes purge firefox-globalmenu thunderbird-globalmenu
# apt-get --yes purge unity-2d-common unity-common
# apt-get --yes purge libunity-misc4 libunity-core-5*

To be fair, the commands above don’t remove all of Unity and friends, there’s parts you need for various things:

If you remove:

  • unity-greeter — X will fail to start, claiming you are running in Low Resolution mode and telling you to fix your configuration, troubleshoot or login to a console instead — I thought this might be because of the Optimus setup on my primary machine, but it can be re-produced in VirtualBox and on another physical desktop where 3D actually works — investigation into this is on-going.

  • indicator-* — The Classic GNOME Desktop will break — the indicator applets on the top right-hand-side will be removed, but clicking on the locations they should have been will cause your session to crash.

(This list will be updated with any others I find, or people e-mail/tweet me about, but as of 21-05-2012 is correct.)

When you return, no Unity options should be present in your Session options — and once you’ve chosen your new environment of choice, you will be Unity-less and all of the GNOME based applications on your desktop should continue to operate correctly too.