4 Replies Latest reply: Feb 8, 2013 1:59 PM by Avi Miller-Oracle RSS

    Oracle Linux Remove Old Kernels

    895327
      I was just wondering if Oracle Linux by default removes old outdated kernels when I run 'yum update' command? I see new kernels getting installed consistently however I never see any kernels being removed like I expect to see in RHEL as a new kernel is downloaded. Is there a way to see which kernels are installed on my Oracle Linux 6.3 server and how I can remove them so they don't clutter my Grub screen and system?
        • 1. Re: Oracle Linux Remove Old Kernels
          Catch-22
          You can check the grub boot menu, which normally has an entry for all installed kernels:

          <pre>
          # cat /boot/grub/grub.conf
          </pre>

          Or query the installed kernel packages:

          <pre>
          # rpm -qa | grep kernel
          </pre>

          To remove a kernel, use the YUM utility:

          <pre>
          # yum remove kernel-package
          </pre>

          For instance:

          <pre>
          # rpm -qa | grep kernel
          kernel-uek-2.6.32-200.13.1.el5uek
          kernel-uek-2.6.32-300.10.1.el5uek
          kernel-2.6.18-274.el5
          kernel-uek-devel-2.6.32-200.13.1.el5uek
          kernel-headers-2.6.18-308.el5
          kernel-2.6.18-308.el5
          kernel-uek-firmware-2.6.32-300.10.1.el5uek
          kernel-uek-devel-2.6.32-300.10.1.el5uek

          # uname -r
          2.6.32-300.10.1.el5uek

          # yum remove kernel-uek-2.6.32-200.13.1.el5uek
          </pre>

          The example above is for OL 5, but works in OL 6 as well.
          • 2. Re: Oracle Linux Remove Old Kernels
            895327
            Is there a reason Oracle Linux us auto cleaning up the old kernels by default? I know RHEL / CentOS do it out of the box. Find it strange that OEL doesn't.
            • 3. Re: Oracle Linux Remove Old Kernels
              Catch-22
              I have no idea why it was decided, but I personally prefer to remove unwanted kernels manually. Actually there should be a limit, but the default is 3. If you make the /boot partition large enough, e.g 512 MB, there shouldn't be space issues. But if you prefer you can install the yum-utils to purge old kernel versions and set the package installation limit.

              <pre>
              # yum install yum-utils
              package-cleanup oldkernels count=2
              </pre>

              ... and make the change permanent by editing /etc/yum.conf

              <pre>
              # grep installonly_limit /etc/yum.conf
              installonly_limit = 2
              </pre>

              The default is 3. Since the RHEL and UEK kernel have different package names kernel/kernel-uek they probably count separately.
              • 4. Re: Oracle Linux Remove Old Kernels
                Avi Miller-Oracle
                cmennens wrote:
                Is there a reason Oracle Linux us auto cleaning up the old kernels by default? I know RHEL / CentOS do it out of the box. Find it strange that OEL doesn't.
                Yes, it does. Yum is configured with installonly_limit=3 by default, so it should only be keeping 3 kernels. Note however that it keeps 3 of each kernel, not 3 total. You would have 3 Red Hat compatible kernels, and 3 UEK kernels.