Housecleaning in Ubuntu

I’ve found over the months since 9.10 came out that the kernel has been updated several times.  This results in old kernels taking up disk space, as well as more entries in the GRUB menu.  I’ve finally found out how to clean up the older kernels, and make a shorter GRUB menu.

You have to find the current kernel number, and save it and the previous one, for safety’s sake.

First, open a terminal.  Enter uname -r to get the kernel release.

First, open a terminal.  Enter uname -r to get the kernel release.
List all kernel images with sudo ls /boot/vmlinuz* | cut -d’-’ -f2,3
Start synaptic and find the previous kernel images, and mark them for uninstall
To finish the job:
dpkg -l | grep ^ii | grep [release number] | awk -F’ ‘ ‘{ print $2; }’
The final step is:
sudo aptitude remove linux-image-[release number], repeat for each release

You must take care to not remove the current release or you will leave linux unbootable.

I ran sudo update-grub afterward to rebuild the GRUB menu, although I’m not sure if it was really necessary.

Just remember, your mileage may vary, and I do not stand behind any of the above.  It worked for me, it may work for you.

Advertisement

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.