Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Every time kubuntu updates its headers/boot image I get another version on disk in /boot. These also show up in menu choices when I boot. I currently have 7 or 8 versions and would like to get down to three or four.

In the past I just deleted the files of related versions from /boot but is this the preferred method? Is there a better/safer way to get rid of old kernels?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Don't delete files like this, that's what the package manager is for. You're lucky that nothing depended on the files you removed. But you could have saved more disk space by removing the rest of the packages (aside from the kernel itself, there are modules and a few more things).

You can find out what package a file belongs to with one of the commands below (dlocate is faster but must be installed first):

dpkg -S /boot/vmlinuz-*
dlocate -S /boot/vmlinuz-*

Once you've tested that a newly installed kernel works, you can safely remove the old ones. The package containing a kernel is called linux-image-version-flavor. The command uname -r shows which version and flavor you're running (don't remove that one!).

You might also have linux-headers-version-flavor; that's useful only if you're going to compile additional modules not in the main kernel distribution.

share|improve this answer
    
I took the liberty of correcting the name of the source packages :-). –  sleske Jul 28 '10 at 22:08
    
@sleske: well spotted, but wrong correction: I meant the headers package. –  Gilles Jul 29 '10 at 7:11
    
Ah, thanks for the 2nd correction. It's been a while since I last compiled 3rd-party modules... –  sleske Jul 29 '10 at 8:15
    
Thanks! Do you know the exact dpkg parameters to remove a specific package? –  Newton Falls Aug 5 '10 at 21:03
    
@Newton: dpkg --purge followed by the package name; or you can do it from synaptic/aptitude/... (I recommend that because it'll be easier not to delete your running kernel by mistake). Maybe dpkg will complain about the files you've already removed; if so you can recreate them with touch or silence dpkg with one of the --force- options (I don't know which one). –  Gilles Aug 5 '10 at 21:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.