Azare Puasa

Note To Self

Connect

  • Facebook
  • Twitter
  • Linkedin
  • Home
  • Blog
  • My Fave Videos
  • Success Strategies
  • Achievements
  • Baking For Men
  • Matters of the Heart
  • Linux
  • WordPress
  • Programming
  • Book Review
  • Others

[How to] – Removing old kernels in Ubuntu

Posted on June 2, 2011 by Azare Puasa

I notice when i do system update which includes new kernel version, the new version gets installed but the old versions are not remove automatically. My grub list is getting longer by the update!! I have 2.6.32-38 to 2.6.32-45 now. The common practice I’m taught is to just leave 2 versions. The latest and greatest and another one which is the version prior to it. This avoids clutter as well as keep one backup in case the new one fails. So it is necessary to do a cleanup.

For the past few rounds of cleanups, I used the method found in Tux Tweaks. I found it useful and I customize it for myself. Here’s my step by step instruction. I list them down here for my own reference. Copy command and edit as necessary.

1. Check kernel version I am currently running. I want to keep this version as well as the older version as backup.

$ uname -r

2. List all available kernels in my system.

$ ls /boot | grep vmlinuz | cut -d’-‘ -f2,3

2.6.32-38
2.6.32-39
2.6.32-40
2.6.32-41
2.6.32-42
2.6.32-45

3. List the package that are installed relative to the kernel I want to remove. In the command below, I’m listing v2.6.32-38 related packages.

$ dpkg -l | grep ^ii | grep 2.6.32-38 | awk -F’ ‘ ‘{ print $2 }’

linux-headers-2.6.32-38
linux-headers-2.6.32-38-generic
linux-image-2.6.32-38-generic

4. Finally, remove the packages listed by the command above with dpkg, apt-get or aptitude. I’m removing 2.6.32-38 here.

$ sudo aptitude remove linux-headers-2.6.32-38 linux-headers-2.6.32-38-generic linux-image-2.6.32-38-generic

I repeat from step 3 for the next oldest version. Visit Tux Tweaks for more information. There are other methods of removal. What is commonly suggested is to do it through the Synaptic Package Manager. I’m comfortable with these.

About Azare

He is a full-time software developer and an Internet Infopreneur. He has a decade of experience developing Installshield Installscript. After getting his RHCE, he has short stint as a Redhat System Engineer. His work now involves coding Java language. In his free time, how dabbles with Wordpress website development and SEO. He loves archery and golf.

Contact Azare

Step 1 of 2

50%

Azare’s bookshelf: read

Click Millionaires: Work Less, Live More with an Internet Business You Love
Outsource Smart: Be Your Own Boss... Without Letting Your Business Be the Boss of You
How I Made My First Million on the Internet and How You Can Too!: The Complete Insider's Guide to Making Millions with Your Internet Business
Winning The Game of Life!
The $100 Startup: Reinvent the Way You Make a Living, Do What You Love, and Create a New Future
The Laptop Millionaire
Speed Reading in a Week: Teach Yourself
The 4-Hour Workweek
Think and Grow Rich
The Monk and the Riddle: The Education of a Silicon Valley Entrepreneur
Success as an Introvert for Dummies
The Clean Coder: A Code of Conduct for Professional Programmers
Be Rich and Happy
Celebrating Failure: The Power of Taking Risks, Making Mistakes, and Thinking Big
The Art of Readable Code
A Gift to My Children: A Father's Lessons for Life and Investing
Zero to One: Notes on Startups, or How to Build the Future

Copyright ©2025 · Azare Puasa - All Rights Are Reserved · Terms & Conditions· Privacy Policy

Copyright © 2025 · Azare Puasa on Genesis Framework · WordPress · Log in