logo

Home page
Articles for Windows, Linux, OS X
Mac tips and articles
Mac tips
Windows 8 tips and articles
Windows 7 tips and articles
Vista Tips
XP Tips
Linux tips and articles
Read the blog
Online store
Windows, Linux, OS X programs
Links
About

Linux tips and tweaks

Prune the Grub list when it grows too long

If you have installed Linux on a Windows PC so that you have a dual boot system, you will have used a boot loader to display a menu when the computer is switched on. This menu lists the operating systems and allows you to select the one you want.

Grub is commonly used and it works fine. The problem is that after installing some updates to Linux you will find that extra entries have been added to the Grub menu. Whenever the Linux kernel is updated, the old one is kept as a backup and it stays on the menu. So the Grub menu list grows and you can end up with half a dozen or more.

This makes the Grub menu unwieldy and confusing. It also wastes space on your Linux partition because there are lots of Linux kernels that you never use and they need about 100Mb of disk space each. Here's how to remove those redundent entries and prune the Grub menu list.

Linux Grub menu

The solution might be easier than you might think. In Ubuntu and distros based on Ubuntu, start the Synaptic Package Manager from the menu and type linux-image into the search box. Look for entries like Linux-image-2.6.31.15-generic-pae. These will be marked as installed and will correspond to the options in the Grub menu screen. Right click the ones you don't want, such as older kernels with lower version numbers, and select Mark for removal or Mark for complete removal. You can then click the Apply button and they will be removed.

Linux Grub menu

Removing them deletes the files on the disk, recovers the disk space they were occupying, and removes them from the Grub menu.

Other Linux distros

Other Linux distros are similar and they all have tools to install the latest system updates and to remove install packages that you no longer need. With Mandriva 2010 for example, you run Install & Remove Software on the menu. Select All in the drop-down lists at the top and then expand the System category. In the Kernel and hardware subsection are entries like kernel-desktop-2.6... You can remove old versions you don't need. There's an alternative in Mandriva and you can go to the menu and select Tools, System Tools, Configure your computer Select Boot on the left then Set up boot system on the right. Click Next and you'll see the list of boot options. You can delete items that you don't need.

Warning!

Messing around with boot options in Grub and removing kernels could be disasterous if something went wrong. It's unlikely, but a remote possibility. Run Linux as a virtual machine in something like VirtualBox or even install a dual booting Windows/Linux virtual machine (as in the Grub screen shot above) and play around with Grub and kernels on that before you try it on a real PC with valuable data on. Remember to always have a backup.



Go to Linux tips index...

copyright