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 (188.8.131.52) 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 kernel.org, 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?
A 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:
deb http://liquorix.net/debian sid main
2.) Update your system package list:
sudo apt-get update
3.) Get and install the liquorix repository key to authenticate the packages:
sudo apt-get install '^liquorix-([^-]+-)?keyring.?'
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:
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…
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…
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.