After I installed Ubuntu it began to update and when I start my computer I have Windows and about 5 or 6 Ubuntu options. How can I remove all of them without the last one ?
migrated from stackoverflow.com Jun 27 '11 at 5:39
This question came from our site for professional and enthusiast programmers.
Although you can hide the excess options by editing your grub menu config file, the Right Solution(TM) would be to uninstall the older kernels, since you don't need/use them anyway. Personally, I keep the two newest kernel releases - I run the newest one and have the second-newest as a fallback, just in case the newest doesn't work on my hardware or has other problems. (Note that, in 14 years of running Debian/Ubuntu on many dozens of machines, both desktops and servers, this has never happened to me. But I'm paranoid like that.)
To find your old kernels, open a terminal and enter the command
(Note that I didn't include linux-image-2.6.35-22-generic in the
With the excess kernels removed, you can then run
is this what your after?
HOWTO: StartUp Manager & Kernel Display Options
Using Natty Narwhal & GRUB 1.99? Grub 1.99 radically changes how additional/older kernels are displayed. There is now a new "Submenu" feature where all but the most recent kernel (and recovery mode, if enabled) reside. This will prevent the main Grub menu from expanding as new kernels are introduced. The portions of this guide which detail how to physically remove kernels still applies, but for information about the new Submenu feature, please visit this thread: Grub 1.99 Submenus
StartUp-Manager & GRUB 2: StartUp-Manager ver 1.9.12-1 will work with GRUB 2, however some of the options available with Grub legacy have not yet been incorporated to work with Grub 2. The Boot Options tab remains essentially unchanged. The Appearance and Advanced tabs contain fewer entries at present, and the Security tab does not exist with Grub 2 fully-installed. There are reports that a StartUp-Manager 2 is under development which will work with Grub 2. When it is released this page will be updated. GRUB 2 items available for change with StartUp Manager will be annotated with a * green asterisk.
Currently the following StartUp-Manager options work:
Timeout * Default OS/kernel * Misc. (Writes to the "GRUB_CMDLINE_LINUX=" line of /etc/default/grub but will not remove the same entries such as "splash" and "quiet" already entered on "GRUB_CMDLINE_LINUX_DEFAULT=") Show text during boot * Display resolution - Placed on "GRUB_CMDLINE_LINUX_DEFAULT=" line of /etc/default/grub. During boot GRUB 2 will note that the "vga=" option is deprecated.
StartUp-Manager and Editing Grub Legacy's menu.lst or GRUB 2's /etc/default/grub - Intro:
With each kernel update, the grub menu is usually updated to reflect the new change.* This creates questions by new users on exactly what happened and how to change the display. By default, the old kernel versions are kept on the menu and the new kernel is added at the top. Over time, this list of kernels can grow quite long. Here are 5 methods to change the menu. The first two are the only methods I recommend unless there are extenuating circumstances. Most users will only need the information in section 1 to make the desired changes to the grub menu display.
Before modifying your menu, it is good practice to make a backup copy. If you intend to make multiple changes within a short time, I'd recommend assigning each backup a unique number (menu.lst.bak1, bak2, etc). To make a backup: For Grub:
For Grub 2:
*1. StartUp-Manager * The introduction of StartUp-Manager created an easy and safe method to update the grub menu list via a GUI interface. You can make a variety of changes to the appearance and function of the grub menu without ever directly editing the file. StartUp-Manager is accessed via System > Administration > StartUp-Manager. If it is not in your menu, install it via synaptic ( System > Administration > Synaptic Package Manager. StartUp-Manager is in the 'universe' repository. If you don't see 'startupmanager' listed in synaptic or the command line method doesn't find it, go to Synaptic's Settings > Repositories > Ubuntu Software and make sure the (universe) repository is checked. Hit the 'Reload' button to refresh the package list and then select startupmanager or install it simply with:
To start it, System > Administration > StartUp-Manager or in terminal type: gksu startupmanager
Boot Options * Timeout. Select how long you see the menu before the default is automatically selected and started. * Default operating system. Set the default operating system, including different kernels and any other OS if installed. Although you can select another OS or version of linux, you will be unable to set up specific boot options (such as kernel version) for them. Changing internal boot options within another operating system requires manual editing of menu.lst. Show bootloader menu. If not selected, no menu will be seen. The default or saved OS will be selected. * Show text during boot. This option presents some textual information to allow you to see what is happening during boot. If you want a clean-looking boot with no text scrolling, untick "Show text during boot" and tick "Show boot splash". Even cleaner, you can untick "Show bootloader menu" but this option is better left visible.
Security Note: Not yet available in Grub 2. Set passwords to prevent grub changes without authorization. Passwords can be set to require a password to change the bootloader, rescue mode and old boot options.
*Advanced * Note: Grub 2 options include only the ability to make a floppy or to change the bootloader resolution. Limit the number of kernels to keep. ** This is the option to set the number of kernels you see on the boot menu. Choosing "2" is a good compromise, as it allows you to use and see the current kernel plus have the previous kernel version immediately available via the grub menu should you have problems with the new kernel.
Here are some important points about this option: The grub menu is updated as soon as you close StartUp-Manager. No kernels are removed from the computer - only the displayed menu items change. No extra space is freed by hiding the kernel entries. You can change the number more than once, and even go from a smaller to larger number. StartUp-Manager checks the number of installed kernels and will display that number up to the maximum number installed on the computer. If you select a number greater than that installed, it will display all those kernels currently installed and the menu will continue to grow until the number of kernels selected is met. If you removed kernel options by manually deleting items in menu.lst you may not be able to restore them by increasing the number here. Create boot option for memtest86+. When's the last time you used this? But the option is here if you want it. Create boot option for recovery mode. An important option to allow you to select Recovery mode if you have problems with the kernel and need to perform maintenance on your kernel. Automatically update default boot option.. ** If selected, grub's setting is: "# updatedefaultentry=true"; if unticked, value is changed to "# updatedefaultentry=false" If unchecked, new kernels will not be used until you make changes to grub, approve the change during installation, or manually edit grub. To start using a new kernel, make the change in the "Default operating system" in the Boot Options tab. Create Rescue Floppy. Okay, so many of us don't have floppy drives any longer. If your computer does - lucky you. If your's doesn't, you can still make a rescue floppy image, install it in the grub folder, and use it for an emergency boot backup. The instructions on how to do this are found here: GrubHowto/BootFloppy
** The bottom line for StartUp-Manager - it's convenient, prevents editing errors, and is fully reversible. **
Manually Editing /boot/grub/menu.lst (Grub Legacy only) -- If You Must ... Note: Grub 2 does not use /boot/grub/menu.lst for it's options. The Grub 2 files include /boot/grub/grub.cfg, /etc/default/grub, and the configuration scripts in the /etc/grub.d/ folder. Changes should not be made to /boot/grub/grub.cfg.
Again, make sure you have made a backup. This is especially important if you manually edit menu.lst as there is no internal protection using this method other than to restore a backup copy previously saved on your computer. Before manually editing menu.lst, if you are having grub problems and are not seeing something you expect, such as a new kernel not being displayed, you might try running this command to see if your problem can be resolved:
Comment Symbol (#) Note: When editing the grub menu.lst: There are many comment (#) symbols in menu.lst. They can be a bit confusing in that the double comment symbols (##) are not really comments at all but mark a special section of the file. Do not uncomment (remove the # symbols) items in this section, just change the values if necessary.
To edit /boot/grub/menu.lst, make a backup and then run the following. Change the editor if you prefer another text editor:
There is a line in menu.lst which designates how many kernels (and recovery options) to view by default. This is the same value as in the StartUp-Manager "number of kernels to keep". The default menu.lst is:
Do not remove the comment symbol - just change the value; 2 is what many users choose.
This setting will take effect on the next boot (and reflected in StartUp-Manager upon save). The kernel entries are completely removed from the menu but would be restored should you increase the 'howmany' number. It will display up to the number of kernels installed on your computer. If fewer kernels exist, new kernels will expand the menu options until the number is reached. Changes to this option will take effect on reboot or, interestingly, immediately if you open and close StartUp-Manager.
Caution: The menu options displayed in boot are automatically created. They should not normally be edited manually. The options presented below require manual editing of menu.lst .From my testing, it appears that StartUp-Manager cannot restore menu items manually deleted in menu.lst. Kernels are not physically removed from the computer.
If you feel like you must edit this file manually (such as a new kernel simply doesn't show up after installation/reinstallation), the next section details how to change the menu list view by manually editing and/or deleting items near the bottom of the menu.lst file.
Note to GRUB 2 Users: You can edit /etc/grub.d/10_linux to automatically display only the two most current system kernels. The extra kernels will remain on the computer but not be displayed. Instructions are in Section 1. B. of Grub 2 Title Tweaks.
` title Ubuntu 8.04, kernel 2.6.24-18-generic root (hd1,0) kernel /boot/vmlinuz-2.6.24-18-generic root=UUID=cdfc1bc0-d14b-4b48-ad24-7bb40ec2ccde ro splash initrd /boot/initrd.img-2.6.24-18-generic quiet
Other Editable Items. While you are manually editing the kernels, note this file contains entries you may edit concerning how long the menu is displayed in seconds ( timeout 3 ). You can also set which system to boot. The default is 0 . 0 is the first uncommented title. Count the number of uncommented "titles", including recovery modes and memtest86+, and subtract 1. In addition to a number, this value may also be "saved", meaning that grub will start the next time using the same system booted during the current session. This is eqivalent to the "last used" option available in StartUp-Manager.
Removing Older Kernels: You can permanently delete older kernels via synaptic. First, determine which kernel you are using. You do not want to remove this kernel. To find which kernel you are using:
Open Synaptic via System > Administration > Synaptic. Search for linux-image. You will see all the available kernels - those with green selection boxes are currently installed. They will look something like linux-image-2.6.27-XX or linux-image-2.6.27-XX-generic. The older kernels will have lower ending numbers. You can also remove the associated linux-headers... and linux-restricted-modules-... for the earlier versions. An easy way to find all these files is to type the main kernel version (2.6.XX) into the top search bar. Many users keep at least one older kernel in case problems occur with the most recent kernel.
When you delete a an older (or newer) kernel via synaptic the kernel is removed from the computer and more disk space is freed up. The menu.lst is updated and the deleted kernel will no longer be displayed on the menu. Make sure you are satisfied with the performance of newly-released kernels before deleting older ones. Note: The associated linux-header will not automatically be removed when the linux-image is removed. The linux-header for the specific kernel must be removed separately.
A Very Easy Alternate GUI Method - Ubuntu-Tweak Another GUI third-party app which can easily remove older kernels is Ubuntu Tweak. It is independent of Grub and will work with Grub legacy and Grub 2. It performs a variety of common Ubuntu tasks, one of which is to remove older kernels. This app removes older kernels, unlike StartUp-Manager, which merely removes them from the menu.
To install Ubuntu-Tweak, which is not in the normal respositories, go to the Ubuntu-Tweak site, http://ubuntu-tweak.com/, click on the "Download" button.
To run Ubuntu-Tweak:
Update Grub to refresh the menu:
Summary: You can change the number of kernels displayed via the StartUp-Manager or by editing grub's menu.lst StartUp-Manager makes the process simple, fast and more or less error-proof (did I actually say that?). Deleted kernel options can be restored via either method as long as the actual kernels remain installed on the computer. Even though I have used ubuntu only a few years, I am as big a fan of the command line as most long-time users - in this case there are just too many advantages to using StartUp-Manager.
Grub2: Enter the command