How to remove old versions of kernel-core and kernel from Red Hat Linux

1.6k views Asked by At

But when I log into the server and run dnf list installed | grep kernel-core, I get this response.


kernel-core.x86_64                            4.18.0-425.10.1.el8_7                  @rhel-8-baseos-rhui-rpms

kernel-core.x86_64                            4.18.0-425.13.1.el8_7                  @rhel-8-baseos-rhui-rpms

kernel-core.x86_64                            4.18.0-425.19.2.el8_7                  @rhel-8-baseos-rhui-rpms

Running sudo dnf remove –duplicates doesn't do anything. Running sudo dnf upgrade says everything is up to date.

How do I remove to old kernel-core and kernel packages?

OS Version

NAME="Red Hat Enterprise Linux"
VERSION="8.7 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.7 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.7
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.7"

Edit: the command uname -r returns: 4.18.0-425.13.1.el8_7.x86_64 So it appears the newest version is not being used.

1

There are 1 answers

3
rahul dubey On

To remove old versions of kernel-core and kernel from Red Hat Linux, you can follow these steps:

  1. Check the currently installed kernel version using the following command:
uname -r
  1. List all installed kernel packages using the following command. (This will display a list of all installed kernel packages, including the old versions.)
rpm -qa | grep kernel
  1. Remove the old kernel packages using the following command:
sudo yum remove <kernel-package-name>

Replace with the actual name of the kernel package you want to remove. For example:

sudo yum remove kernel-3.10.0-1160.el7.x86_64

Note that you should not remove the currently running kernel package.

  1. If you have removed the kernel package for the currently running kernel, you should install a new kernel package before rebooting the system. You can do this using the following command:
sudo yum install kernel

This will install the latest available kernel package.

  1. Once you have removed the old kernel packages and installed a new kernel package (if necessary), you can reboot the system to apply the changes.
sudo reboot

By following these steps, you can remove old versions of kernel-core and kernel from Red Hat Linux, which can help to free up disk space and improve system performance.