Assorted Ubuntu Problems (and how to solve them)

I've been running Ubuntu as my main operating system since around 2004, and I must say I love it. However, every OS has its problems, and Ubuntu is no exception. Here's a few I ran into, and how I solved them (or not).

The Mystery of the Lost Diskspace

My old laptop has a rather small harddisk, and after running Lucid for a while I noticed that I was mysteriously losing rather a lot of diskspace over time. This happened especially after installing updates, so naturally I suspected the package cache. However running sudo apt-get clean ; sudo apt-get autoclean did not give me back all of my diskspace. So I dug a little deeper, and it turned out the drain on diskspace was caused by old kernels being retained. Each of those kernels took up around 120 Mb, so that was that mystery solved... A quick glance at the GRUB boot-menu should tell you which kernel versions are installed on your system, and searching on the version-numbers in Synaptic should allow you to remove the binaries (linux-image-*) and header-files if you have those installed (linux-headers-*).

Of course, this being Linux, there is a way to do it automagically. To remove all kernels but the one that's currently running, execute the following in a terminal:

dpkg -l 'linux-*' | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

You may want to test that first, use the following to see what will be removed:

echo "To be removed:" ; dpkg -l 'linux-*' | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] ; echo "You are currently running kernel version:" `uname -r` "(this will be kept)"

UPDATE (2013-06): You can now install a remove-old-kernels script, which will remove outdated kernels for you automatically.

For a more complete description of how to remove old kernels, how the one-liner works, and why the retention of old kernels is not a bug, see the following links:

Lucid Lynx (10.04 LTS)

Adobe Flash

The Adobe Flash-plugin has a history of problems of 64-bit systems. When I upgraded to Lucid, the controls of many Flash-based websites suddenly stopped working. Very annoying. The solution was to install a recent 64-bit version of the Flash-pluginfrom the sevenmachines Flash PPA:

sudo add-apt-repository ppa:sevenmachines/flash && sudo apt-get update && sudo apt-get install flashplugin64-installer

WARNING: This version has a serious security flaw, which may cause your system to be compromised. Unfortunately Adobe hasn't released new 64-bit Linux versions of the Flash-plugin, so for the time being we seem to be stuck with either the 32-bit plugin (which seems to be the one causing the problems on 64-bit systems), or a working 64-bit one with a security hole. For now I've followed Adobe's advice and "patched" the security issue in the 64-bit plugin by deleting the offending authplay library: sudo rm /opt/Adobe/Reader9/Reader/intellinux/lib/libauthplay.so*

Alternatively, try using the FLASH-AID Firefox extension to install the appropriate newest version of Flash. See also: http://ubuntuforums.org/showthread.php?t=1466854