How To: Downgrade libcairo2 in Debian (and fix Evince)

Evince crashing with a libcairo segfault like this?

It’s a libcairo2 1.12.2-2 issue – which you can thankfully fix by downgrading libcairo2 to a 1.10.2 incarnation – here’s how…

Check package availability

First check you have an alternate version to downgrade to. To do this in Synaptic select the libcairo2 package then click on the Versions tab at the bottom, or you can do the same check via a swift apt-cache policy libcairo2 as shown below:

In this case the older (but functional) package 1.10-2-2ubuntu2 is available. Let’s assume there’s an older package you can use – if not, go get one from elsewhere.

Uninstall and force a different version

Uninstall libcairo2 using any manner you like – this will also force removal of things like Evince as dependencies, unless you see anything spectacular that you know you need just let it.

Then in Synaptic, search for libcairo2, select it (i.e. click on it), then from the Synaptic menu choose Package > Force Version and choose the older, working package, and install it.

Next, you’ll want to lock to that version so it doesn’t get upgraded (at least until there’s a newer working version), so again from the menu just select Package > Lock Version.

Reinstall libcairo-using things

Finally, reinstall what was ailing ya and everything should work fine. In my case at least, this means I can reinstall the Evince PDF viewer and it’ll now print to PDF without segfaulting – Huzzah! =D

I’ve no doubt you can do this entire process from the command line, but it’s easy and works through Synaptic so I’ll leave that as an exercise for the reader.

As an added bonus, if you’re experiencing slow display and/or corrupted text in Iceweasel or Chromium then the downgrade should fix that up too. You can read more about which here.

Derived class issues with arrays and casting in C++

I’m working my way through C++ FAQs book by Cline and Lomow, and it’s excellent. There’s lots of issues going on with inheritance, arrays and casting that could be a real pain to deal with towards the end of system development, but that you can nip in the bud and make life easier for yourself. For example, just knowing that an array of objects of a Derived class is NOT a kind-of array of objects of the Base class can prevent you a lot of headaches…

Good to know – now I just have to keep it in mind when I’m coding!

iTunes + Zone Alarm do not mix

Crapple - Upside-Down Apple LogoJust noting this for future reference, but I finally got iTunes working properly on a Windows PC that would at random:
– transfer some songs to iPod Touch devices successfully,
– transfer some other songs, then crash, then the device reports no music on it, or
– corrupt the device so badly it needed fresh firmware restored.

And the the culprit turned out to be…. Zone Alarm. No kidding. Turn off Zone Alarm and everything worked instantly.

iTunes is still a god-awful PoS though, but at least it’ll now transfer music and apps. If you’re getting “app could not be installed because it is not signed” issues with iTunes, and you’re installing legit apps, chances are that turning off Zone Alarm will fix it right up. Amazing.

How-To: Install the Liquorix kernel in LMDE

Just because all GNU/Linux distros come with a kernel, it doesn’t mean that it’s the best kernel to use. This was made quite clear to me recently when I discovered that whenever I safely removed a USB drive from my machine it caused a kernel panic in the present LMDE kernel ( which promptly hung the machine. I figured out I could work around the issue by unmounting USB drives through gparted, but that’s pretty weak sauce, so I decided to cut to the root of the problem and change kernels.

In the past I’ve spent a long time picking specific kernel options, building the kernel, and then it hasn’t worked at all – so this time I wanted something I was pretty sure would work, and I didn’t want to spend forever on it, so what are the options?

Zen and the art of kernel maintenance

The official Linux kernel lives at, and is the reference design if you will for all existing kernels. The new stuff generally gets added to the mainline kernel, and then other kernels add or remove bits and pieces to become their own kernels such as the Ubuntu kernels or the Debian kernels or what have you.

The process of adding or removing bits and pieces is pretty much open ended, and if you don’t know exactly what you’re doing you can spend a long time reading and experimenting, so I’ve opted to pick something pre-customised from the Zen kernels:

From the zen kernel about page:

The Zen Kernel is a the result of a collaborative effort of kernel hackers to provide the best Linux kernel possible for every day systems. We include code that is not included in the mainline kernel in an attempt to create an all-around better kernel for desktops (although it can be compiled otherwise). This is done by including new features, supporting latest hardware, and including various code and optimizations to better suit desktops. Zen is a 100% community oriented project so, as a result, everybody can contribute to the project.

Who mods the modders?

Liquor up front, poker in the rearA chap going by the handle of Damentz, who seems to have the black art of kernel crafting down to a tittle, takes that zen-kernel source and (I think) tweaks it some more to produce the Liquorix kernel.

What does he do exactly? I’ve absolutely no idea – maybe it’s in the forums somewhere, but I think the main thing he does is make it compatible with Debian, and provide a repository so we can grab and use his pre-built pre-modded zen kernel on Debian or any Debian-compatible distro such as LMDE. He’s also nice enough to build both 32-bit and 64-bit kernels so the repo should provide whichever version is appropriate for your system at install time.

Installing the liquorix kernel

Note: It’s a really good idea to make sure you have the dkms package is installed at this point so that any proprietary third-party kernel modules like graphics card drivers (nvidia/ati official drivers), virtualbox modules etc. get rebuilt as part of the kernel install.

1.) Add the liquorix repository to your apt sources file at /etc/apt/sources.list:

2.) Update your system package list:

3.) Get and install the liquorix repository key to authenticate the packages:

4.) Install the liquorix kernel and header sources (you’ll want the sources so that DKMS can automatically rebuild kernel modules for you as required when you update the kernel) – it’s probably best to do this through synaptic/package manager so you can see what’s there:

Liquorix packages

Apart from the keys for package authentication, you really just need the linux-image-liquorix-amd64 and linux-headers-liquorix-amd64 meta-packages (or suitable 32-bit versions) which will then drag in the most recent version of the kernel, whatever that happens to be at the time.

While the packages are installing it’s best to keep an eye on the output to ensure that your dkms modules successfully rebuild – but as long as you’ve opted to install the kernel headers package along with the kernel there shouldn’t be a problem – it’s just nice to be confident that when you reboot you’re not going to be booting into a black screen with a flashing white cursor…

Liquorix DKMS module rebuild successful
Liquorix DKMS module rebuild successful

What now?

Reboot and choose your new kernel from the grub boot menu! (it’ll be the new default). Once you’re up and running you can always run uname -r or uname -a to confirm your kernel version, then take that bad-boy for a spin…

Liquorix uname -r

I only installed mine this morning, but the first thing I did was mount and then unmount a USB drives – and what happened? It kernel panicked. Turns out that the bug seems to be quite widespread among distros (Debian Bug 631187), but you can work around it by manually unmounting using umount (or by using gparted, as I found).

Still, it’s a new, multimedia/gaming optimised kernel (3 series, no less!) – which has its faults, but it seems a lot of kernels at the moment do, and it looks like I’d have to go back to 2.6.38.something to find a kernel which hasn’t had this bug introduced.

I’ve read good things about zen kernels in the past, so I’m glad to finally run one. Once I’ve had a chance to play around with it and that unmount wrinkle’s ironed out I’m sure it’ll be a nice, responsive kernel. And if it isn’t, then I’ll write another post that calls it names =P


Update 21/09/2011: I’ve read on the Liquorix forums that DKMS is not a great package, and although it might do useful things, it does them in bad, non-standard ways, so they highly recommend you uninstall DKMS entirely, and install things like graphics drivers and wifi drivers from the manufacturer’s sites directly (using sgfxi) because if DKMS screws it up, it can get pretty scrappy to fix.

How to: Install XFCE (Xubuntu) on Ubuntu Linux

I’ve tried for months to get along with the standard desktop choices for Ubuntu 11.04, but none of the “big 3” are doing anything close to what I want:

  1. Unity crashes. A lot. And I don’t like having to click on an application icon multiple times to get a display of all open windows and then have to click on the window I want. For example, if you have multiple browser windows open, it just seems to pick the first one or a random one (as opposed to the last window of that application which was open) when you click on on the Unity icon for the app. And that sucks. I do like the menu integration into a single panel to save vertical space – but asides from that it’s just subpar.
  2. Gnome 2 doesn’t frickn work properly anymore and also crashes a lot (far worse than ‘back in the day’, and Deskbar doesn’t work anymore either), and finally
  3. KDE3 renders fonts really badly (yes, I did turn on and experiment with the sub-pixel hinting options) and although it can look quite nice, it just feels like a bodge. I spent hours trying to configure it properly and it was never as good as stock Gnome even after all the extra effort.

So, what options are left? Well, there’s LXDE (the Lightweight X Desktop Environment), and there’s XFCE (which Linus Torvalds recently switched to because he’s hating the desktop brokenness as well). I installed LXDE on my work laptop earlier, and there’s nothing particularly wrong with it which couldn’t be fixed up , but I installed XFCE earlier on the assumption that Mr. Torvalds knows what he’s talking about – and you know what? He does…

Some notes for if you decide to try out LXDE

In LXDE wireless networking doesn’t work right off the bat, so you might want to grab a copy of wicd before you plunge headfirst. Also, compositing isn’t natively supported with just LXDE, so you’ll also want a copy of xcompmgr, which you should kick off like this:

You can man xcompmgr once it’s installed to get all the switches, but for this example it just fades windows in and out nicely – and actually looks rather nice (not to mention blazingly fast).

I like LXDE, and if XFCE didn’t exist I’d use it without hesitation and be perfectly happy with it. Only XFCE does exist – and I choo-choo-choose that – at least for now. I also like the huge range of packages available for any *buntu, so that keeps me from jumping ship entirely. At the end of the day, it’s all up to personal choice about what features you absolutely must have, what features you would like, and your own personal preferences.

Step 1 of 1 – Install xubuntu-desktop

If you like dockbars you can use docky with XFCE without any arguments, but I kinda prefer a bottom ‘window-icon’ panel (ala Gnome 2) so I’ve just set things up that way on mine. And the entire thing goes on fine with the following simple command:

It’ll drag in a whole heap of other dependencies, but it’ll all install nicely, at which point you just need to log out and log back in selecting Xubuntu Session as the desktop environment to use. Wireless networking worked straight away with no hassle for me, but in all fairness to LXDE, I only installed the LXDE package (and its immediate dependencies), and not the lubuntu-desktop package which (may) have straightened all that out.

The end result

After looking through the themes, adding a few bits and pieces to the top panel, and creating a separate bottom panel for the window-icons, this is what I’ve ended up with:

r3dux XFCE Desktop
First draft XFCE desktop - click for larger image.

Honestly though, I just couldn’t go on using a desktop environment that would crash if not once per day, then many times per day. I mean, really – WTF is with that? Why would you even ship a desktop windowing environment in that state? Since I actually like to get some work done and not have to be killing and relaunching processes all the time, XFCE is officially doing it for me at the moment. So no more unity –replace, s’long killall nautilus and sayonara panel has stopped responding – it’s time to be able to actually concentrate on getting some work done.