Results 1 to 10 of 47

Thread: HOWTO: Grub Menu Kernel Display Options

Threaded View

  1. #1
    Join Date
    Jan 2007
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    HOWTO: StartUp Manager & Kernel Display Options

    EDIT: I highly recommend using Grub Customizer rather than StartUp Manager if you are using Grub 2. StartUp Manager was designed for Grub legacy and incorporated some support for Grub 2. Grub Customizer was designed after the introduction of Grub 2 and supports many more of its features and is still being actively developed.

    In a hurry and just want to know how to limit the number of displayed kernels or want to know why the new kernel isn't running? Go the the red stars! **

    Using 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 Issues with GRUB 2:
    StartUp-Manager has not been updated since July 2010. Therefore, it has not kept up with advances in Grub 2, especially Grub 2 version 1.99 and later.

    StartUp-Manager ver 1.9.12-1 works 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.

    Menu Resolution/Font Size. While StartUp-Manager can set the menu resolution, it does so by rewriting the /etc/grub.d/00_header script. Once changed, this file remains in it's altered form even if StartUp-Manager is uninstalled or another Grub 2 application such as Grub Customizer it used.
    • If StartUp-Manager was used to set the resolution and the user wishes to set the resolution via another method or application, the 00_header file should be restored to its original form. This can be accomplished by either purging/reinstalling Grub 2 or changing set gfxmode=<some user-defined value> back to the original set gfxmode=${GRUB_GFXMODE}


    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.
    * Run "sudo update-grub" to ensure you are working with the most up-to-date grub information.

    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:
    Code:
    sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.bak1
    For Grub 2:
    Code:
    sudo cp /etc/default/grub /etc/default/grub.bak1


    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:

    Code:
    sudo aptitude install startupmanager
    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.


    * Appearance
    Note: With Grub 2, only the Usplash theme option is available for change.
    This tab presents many options on how the grub menu is presented, including colors, grub background image,themes. These apply only to the grub bootloader screens. Eye candy.

    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:
    Code:
    sudo update-grub
    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:
    Code:
    gksu gedit /boot/grub/menu.lst


    2. Change the 'howmany=all' line.


    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:

    Code:
    # howmany=all
    Do not remove the comment symbol - just change the value; 2 is what many users choose.

    Code:
    # howmany=2
    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.

    3. Comment the Menu Items You Don't Want to See.
    Near the bottom of the file are the kernel, recovery and memtest options you see on boot. You can hide any of these items by placing a comment symbol ( # ) at the start of the line. Any commented line will not be displayed. Comment out each line in the section. To redisplay the line, remove the comment symbol.
    In the following example, the first kernel and recovery option will be visible; the second will not.

    Code:
    
    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
    
    title        Ubuntu 8.04, kernel 2.6.24-18-generic (recovery mode)
    root        (hd1,0)
    kernel        /boot/vmlinuz-2.6.24-18-generic root=UUID=cdfc1bc0-d14b-4b48-ad24-7bb40ec2ccde ro single
    initrd        /boot/initrd.img-2.6.24-18-generic
    
    
    # title        Ubuntu 8.04, kernel 2.6.24-17-generic
    # root        (hd1,0)
    # kernel        /boot/vmlinuz-2.6.24-17-generic root=UUID=cdfc1bc0-d14b-4b48-ad24-7bb40ec2ccde ro splash
    # initrd        /boot/initrd.img-2.6.24-17-generic
    # quiet
    
    # title        Ubuntu 8.04, kernel 2.6.24-17-generic (recovery mode)
    # root        (hd1,0)
    # kernel        /boot/vmlinuz-2.6.24-17-generic root=UUID=cdfc1bc0-d14b-4b48-ad24-7bb40ec2ccde ro single
    # initrd        /boot/initrd.img-2.6.24-17-generic
    4. Remove (or add) the items.
    You can simply delete the kernels you don't want to see on boot. If you remove them, you can restore them by retyping them or restoring your backup file. You may be able to restore deleted kernel options by changing the value in StartUp-Manager but I would not count on it.

    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.

    Code:
    timeout 10
    Code:
    default 0

    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:
    Code:
    uname -r
    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:
    Code:
    ubuntu-tweak
    • Select "Package Cleaner" on the left and ""Clean Kernel" from the right panel.
    • Press the "Unlock" button at the lower right, enter your password.
    • Select from the displayed list the kernel images and headers you wish to remove. The kernel in use is not listed.
    • Press the "Cleanup" button at the lower right to remove the selected kernel images and headers.

    Update Grub to refresh the menu:
    Code:
    sudo update-grub

    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.

    Other Possibly Useful Grub-Related Links:
    Recovering Ubuntu after installing Windows
    How to restore Grub from a live Ubuntu cd
    Cannot boot windows without external hard drive plugged in
    Illustrated Dual Boot Site
    Super Grub Disk

    StartUp-Manager Wiki Based on this post.
    Last edited by drs305; February 12th, 2012 at 10:19 PM. Reason: Grub 2 Resolution Issues

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •