Kernel hording

Ubuntu logo ubuntu.comAfter my previous successful and speedy upgrade I thought I would continue to the 12.04 precise. However, I found myself running out of space of the /boot drive. That left me wondering why I made it this small but I think it is really a default setup. This is the message I saw when performing the do-release-upgrade:

Not enough free disk space

The upgrade has aborted. The upgrade needs a total of 24.7 M free
space on disk '/boot'. Please free at least an additional 13.9 M of
disk space on '/boot'. Empty your trash and remove temporary packages
of former installations using 'sudo apt-get clean'.

The recommended sudo apt-get clean didn’t really free anything, the next thing recommended was editing the size of the boot partition but I didn’t have the nerve to do that on a running system so I searched on…
Turns out I have been hording my old kernels. Then I found the following tool…. but…
Install yum-yutils:apt-get instal yum-utils
Run:package-cleanup --oldkernels --count=3 --keepdevel
And get:

Traceback (most recent call last):
  File "/usr/bin/package-cleanup", line 384, in 
    util = PackageCleanup()
  File "/usr/bin/package-cleanup", line 59, in __init__
    self.main()
  File "/usr/bin/package-cleanup", line 337, in main
    self._remove_old_kernels(opts.kernelcount, opts.keepdevel)
  File "/usr/bin/package-cleanup", line 273, in _remove_old_kernels
    (kver,krel) = runningkernel.split('-')
ValueError: too many values to unpack

Anyway, it is pretty easy to clean up the old kernel by hand.

rm /boot/*2.6.38-11-server
rm /boot/*2.6.38-12-server
rm /boot/*2.6.38-13-server
rm /boot/*2.6.38-14-server

Leave a Reply