ItecSoftware Logo

How To Clean Up Ubuntu Grub2 Boot Loader Menu

Written by Peter Gilg on - like this:
grub2 boot loader

How to clean up and edit the Ubuntu Grub2 boot loader menu differs quite a bit from previous versions. As Ubuntu nominated the new version 2 of the Grub boot manager as of 9.10, so they did away wit the old and problematic menu.lst file.

Grub2 boot loader is a leap forward in many ways, and most of the annoyances from menu.lst are gone. Yet, if you don’t clean up old versions of kernel entries, the boot list can quickly get messy and end up in a long list of nonsense. Let’s assume we want to remove the 2.6.32-21-generic boot menu entries. Previously, this meant editing /boot/grub/menu.lst. But with Grub2, we use the package manager to remove the kernel package from our computer, Grub automatically removes those options. Btw. if only one operating system is installed on your computer, you may not see the boot menu at all and have to hold down the SHIFT button on your keyboard while booting up to get the menu to show.

Using Synaptic Package Manager

To remove old kernel versions, open up Synaptic Package Manager, found in the System > Administration menu. When Synaptic opens up, type the kernel version that you want to remove into the Quick search text field. The first few numbers should suffice. Then for each of the entries associated with the outdated kernel (e.g. linux-headers-2.6.32-21 and linux-image-2.6.32-21-generic), right-click and choose “Mark for Complete Removal”, then hit “Apply”. These entries will be gone upon the next boot.

Manually Clean Grub2 Boot Loader Menu

If you like more control, or add/remove entries that are not kernel related, you can change the file grub.d located in /etc. This file contains files that hold menu entries that used to be located in /boot/grub/menu.lst. If you want to add new boot menu entries, you simply create a new file in this folder, ensure it is executable (chmod +x).

Another way to remove boot menu entries without deleting the files is to remove execute flag (chmod -x). With any change to these files, we need Grub to update it’s database:

sudo update-grub

For more information on Grub2, it’s inner workings and differences to it’s older sibling, check out Ubuntu Grub2 Wiki

Listed in Linux, Ubuntu

Tags: grub, grub 2, Synaptic, ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *