Clean Up the New Ubuntu Grub2 Boot Menu
Posted
by Trevor Bekolay
on How to geek
See other posts from How to geek
or by Trevor Bekolay
Published on Fri, 21 May 2010 15:00:00 +0000
Indexed on
2010/05/21
15:11 UTC
Read the original article
Hit count: 711
Ubuntu adopted the new version of the Grub boot manager in version 9.10, getting rid of the old problematic menu.lst. Today we look at how to change the boot menu options in Grub2.
Grub2 is a step forward in a lot of ways, and most of the annoying menu.lst issues from the past are gone. Still, if you’re not vigilant with removing old versions of the kernel, the boot list can still end up being longer than it needs to be.
Note: You may have to hold the SHIFT button on your keyboard while booting up to get this menu to show. If only one operating system is installed on your computer, it may load it automatically without displaying this menu.
Remove Old Kernel Entries
The most common clean up task for the boot menu is to remove old kernel versions lying around on your machine.
In our case we want to remove the 2.6.32-21-generic boot menu entries. In the past, this meant opening up /boot/grub/menu.lst…but with Grub2, if we remove the kernel package from our computer, Grub automatically removes those options.
To remove old kernel versions, open up Synaptic Package Manager, found in the System > Administration menu.
When it opens up, type the kernel version that you want to remove in the Quick search text field. The first few numbers should suffice.
For each of the entries associated with the old 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.
Click the Apply button in the toolbar and then Apply in the summary window that pops up. Close Synaptic Package Manager.
The next time you boot up your computer, the Grub menu will not contain the entries associated with the removed kernel version.
Remove Any Option by Editing /etc/grub.d
If you need more fine-grained control, or want to remove entries that are not kernel versions, you must change the files located in /etc/grub.d.
/etc/grub.d contains files that hold the menu entries that used to be contained in /boot/grub/menu.lst. If you want to add new boot menu entries, you would create a new file in this folder, making sure to mark it as executable.
If you want to remove boot menu entries, as we do, you would edit files in this folder.
If we wanted to remove all of the memtest86+ entries, we could just make the 20_memtest86+ file non-executable, with the terminal command
sudo chmod –x 20_memtest86+
Followed by the terminal command
sudo update-grub
Note that memtest86+ was not found by update-grub because it will only consider executable files.
However, instead, we’re going to remove the Serial console 115200 entry for memtest86+…
Open a terminal window Applications > Accessories > Terminal. In the terminal window, type in the command:
sudo gedit /etc/grub.d/20_memtest86+
The menu entries are found at the bottom of this file.
Comment out the menu entry for serial console 115200 by adding a “#” to the start of each line.
Save and close this file. In the terminal window you opened, enter in the command
sudo update-grub
Note: If you don’t run update-grub, the boot menu options will not change!
Now, the next time you boot up, that strange entry will be gone, and you’re left with a simple and clean boot menu.
Conclusion
While changing Grub2’s boot menu may seem overly complicated to legacy Grub masters, for normal users, Grub2 means that you won’t have to change the boot menu that often. Fortunately, if you do have to do it, the process is still pretty easy.
For more detailed information about how to change entries in Grub2, this Ubuntu forum thread is a great resource. If you’re using an older version of Ubuntu, check out our article on how to clean up Ubuntu grub boot menu after upgrades.
Similar Articles | Productive Geek Tips |
Latest Software Reviews | Tinyhacker Random Tips |
© How to geek or respective owner