Results 1 to 10 of 31

Thread: HOWTO: Remove Older Kernels via GUI

Threaded View

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

    HOWTO: Remove Older Kernels via GUI

    HOWTO: Remove Older Kernels via GUI (or CLI)

    When new kernels are introduced and installed the older kernels remain in the system. They are located in the /boot folder and are displayed in the Grub menu. Over time, unless the older kernels are removed, the Grub menu will continue to expand, as will the space occupied in the /boot folder.

    Should the user wish to remove one or more older kernels there are several ways to do so. Physically removing a kernel from the OS will also remove it from the Grub 2 menu once the Grub menu is updated with the "update-grub" command. Another method is to manually edit the Grub 2 scripts to display only an assigned number of kernels (even if more kernels are retained in /boot).

    Note: Users should consider keeping a known, working older kernel. This provides insurance in case the user experiences problems with a newly-introduced kernel. The older kernel will be displayed on the Grub 2 menu as long as it remains in the /boot folder.

    The "CLI" portion of the title is due to the contributions of Ubuntu Forum contributor slakkie, who wrote the script in Post #2. Thank you slakkie.

    An Easy GUI Method - Ubuntu-Tweak

    Ubuntu Tweak is an excellent GUI third-party application which can easily remove older kernels. 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. Ubuntu Tweak removes older kernels and updating Grub afterwards will remove them from the menu.

    To install Ubuntu-Tweak:
    Ubuntu-Tweak is not currently in the normal respositories. Go to the Ubuntu-Tweak site, http://ubuntu-tweak.com/ and, click on the "Download" button.
    • If prompted, allow Gdebi to install the package automatically;
    • Download the package and double click the .deb file to install Ubuntu-Tweak; or
    • Install using the terminal. Change to the folder containing the .deb file and run
      Code:
      sudo dpkg -i ubuntu-tweak*.deb

    To run Ubuntu-Tweak:
    Main Menu: System Tools > Ubuntu Tweak
    or
    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:
    This should be run by Ubuntu Tweak after it removes the kernel, but to be sure:
    Code:
    sudo update-grub

    Removing Kernels via Synaptic

    First, determine which kernel you are using:
    Code:
    uname -r
    Open Synaptic via System > Administration > Synaptic; or
    Code:
    gksu synaptic
    Search for the kernels by typing linux-image in the upper right search box.

    • The kernels are those that being with "linux-image".
      • Example: linux-image-2.6.32-24, linux-image-2.6.32-24-generic.
      • The older kernels will have lower ending numbers. linux-image-2.6.32-23 is older than linux-image-2.6.32-24
    • Those with green selection boxes are currently installed.


    Remove unused kernels as you would any other package by right clicking the package and selecting the desired option.

    You can also remove the associated linux-headers and linux-restricted-modules-... for the earlier versions. Example: linux-headers-2.6.32-23

    Hint: An easy way to find all the installed kernels, headers and modules for a given kernel is to type the main kernel version (2.6.XX) into the top search bar. Click on the top left column status entry in the package window to bring the installed packages (green boxed) to the top of the list.

    When you delete a an older kernel via synaptic the kernel is removed from the computer and more disk space is freed up. The grub configuration file (grub.cfg) 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.

    Hiding Kernels via Grub Customizer
    If you want to keep the kernels on your system, but don't want them displayed, you can use a Grub 2 GUI app called "Grub Customizer". It's a great app that allows the user to hide, rename and reorder the items which appear in the Grub menu. Here is a link which explains how to use it:
    HOWTO: Grub Customizer


    Hiding Kernels via the Grub 2 Scripts
    The number of displayed kernels can be set by modifying the /etc/grub.d/10_linux file. It is documented in Section 2 of my Grub 2 Title Tweaks This tweak hides the kernels but does not remove them from the OS. Note: Recommended only for geeks.

    Other Notes

    Linux kernels, headers and modules can also be removed via the command line (terminal), but if you want to attempt this you probably don't need this guide.

    To hide specific kernels from the menu there is now a GUI app called Grub Customizer that can easily accomplish the task. See the following link:
    Grub Customizer

    For Grub Legacy (Grub 1), the GUI application Startup-Manager can limit the number of displayed kernels. It will not remove them from the OS. For more information on StartUp-Manager, review this thread: HOWTO: StartUp Manager & Kernel Display Options StartUp-Manager currently does not support limiting kernel displays for Grub 2.
    Last edited by drs305; April 4th, 2011 at 02:00 AM.
    GRUB2

    Retired.

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
  •