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.

Overtime with Ubuntu updates the GRUB menu lists a lot of previous Linux kernels and eats a lot of hard-disk space. How can the unused kernels be removed easily?

share|improve this question

migrated from stackoverflow.com Jul 30 '11 at 7:40

This question came from our site for professional and enthusiast programmers.

    
Try askubuntu.com –  Paul R Jul 30 '11 at 6:55
add comment

3 Answers

Open the Synaptic package manager from the System->Administration menu.

Click the “Search” button on the tool bar and search for linux-image-2.

The results should show every available and installed kernel. A green box on the left indicates that the package is installed. The only linux-image you want installed is the latest one. Find the package corresponding to the kernel to you running currently (this is the kernel you found in the terminal window). Make sure you keep that one. Now you can uninstall the old kernels from the list by clicking their boxes and selecting "Mark for Removal".

Got this from here

share|improve this answer
add comment

You can use Ubuntu Tweak for that or remove entries in /boot. For example, if I have vmlinuz-2.6.32-23-generic and vmlinuz-2.6.32-22-generic by removing the last one I'll get rid of one entry. Also, there can be a vmlinux instead of vmlinuz. There are also other files with version information too. You can remove them too. Always keep the latest one.

share|improve this answer
add comment

Open a terminal and run the below command. On reboot, only the latest kernel will be shown in the GRUB menu.

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

Root password is required to run the above command.

Thanks to ubuntugenius.

share|improve this answer
add comment

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.