Install a newer kernel in Debian 7.5 (Wheezy) or CentOS 6.5

When using the latest version of Debian Wheezy or CentOS 6.5, even with all updates installed, by default, you can’t get a very recent kernel via the standard repositories in your package manager. While the idea of both distributions is to remain stable and rather conservative, there are several benefits with installing a newer kernel and in some cases it’s the only option to run one of these distributions. The risk and impact on stability is small and the process is rather simple.

Some of the benefits are:

  • Support for previously unsupported hardware: every kernel release has a list of added drivers. Especially when you have recent hardware, a newer kernel could be required to fully support your video card for example.
  • Performance improvements and bug fixes: newer kernels often contain a lot of bug fixes, have new functions and performance tweaks. Here again, the most is to gain on newer hardware.
  • New kernel options and security fixes

The most recent (stable) kernel that is available at the moment of writing is version 3.15.2, released 26/06/2014. You can find a complete overview of changes in every kernel version at http://kernelnewbies.org/LinuxVersions 

The latest version of the kernel available via the standard repositories for Debian Wheezy is:

and for CentOS 6.5:

There are basically two options to install a newer kernel in Debian 7.5 or CentOS 6.5. The first is the easiest and this is what I will explain in this post. The second is not so easy and it is simply to compile a newer kernel yourself. While compiling a kernel nowadays isn’t rocket science anymore, the first way is still preferable and will save you a lot of time because others have been through the second method and present you the result of their work :)

Installing a newer kernel in Debian Wheezy

The easiest way to install a newer kernel in Debian, is to install it from the backports. Backports are packages taken from the next Debian release (called “testing”), adjusted and recompiled for usage on the stable release.

In order to install a kernel from the backports, we need to add the backports-repository for our Debian version to the apt-sources and update the list of available packages:

Now, you can browse the available kernels in the backports-rpository by adding -t wheezy-backports to your apt commands.:

Before installing a newer kernel, it’s important that we upgrade installed packages to their newer versions in the backports-repo in order to be sure that dependencies will remain unbroken.

After the upgrade, choose a kernel from the list and install it with apt. Most of the installations would want the kernel without suffix. The rt-suffix stands for realtime and is mostly interesting for embedded projects or machines that will drive industrial hardware. dbg stands for debugging.

After the installation, reboot your system and select the newly installed kernel from the selection displayed in GRUB. Debian selects the new kernel by default.

debian boot new kernel GRUB

To verify that the new kernel is used after booting:

When everything works as expected, you can safely uninstall the older kernel in order to clean up your system and to free up some space in /boot

To check which kernels are currently installed:

Uninstall the old one:

That should be all it takes in order to install a recent kernel on a Debian system. Not so difficult as you thought probably :)

Installing a newer kernel in CentOS

For CentOS, it works in a very similar way as with Debian. Only, you don’t use a repository called backports and it’s not “officially” managed by the CentOS-team. If you’re using CentOS as your desktop-system, you probably already heard of the EPEL (Extra Packages for Enterprise Linux)-repository which contains extra and newer ready-made packages that are by default not in RHEL, CentOS or derivatives. Next to EPEL, there is the ELRepo-repository which also contains extra packages, ready-made for RHEL, CentOS and derivatives but it focuses mainly on hardware: drivers, firmware, network, file systems,… Of course if the focus is on hardware, newer kernel versions can’t be absent here.

For more information about ELRepo: visit http://elrepo.org/tiki/About

ELRepo doesn’t provide all recent kernel versions as with the backports of Debian but it still let’s you a choice between the long term support-kernel (kernel-lt) and the mainline stable kernel (kernel-ml).

To add the ELRepo-repository to your system, perform the following steps:

Start by adding the GPG-key of ELRepo:

Then, install the repository:

Now, we can browse the repository to check which is the last version and install it if we want to. To easily get more information about versions in the repository, it is handy to install yum-utils. This allows us to use the repoquery-tool.

First install yum-utils:

Now, to check which kernels are available in the repository, use repoquery -qi to get more information:

The most recent “normal” kernel from the CentOS-repository:

The long term support kernel from ELRepo:

The mainline base kernel from ELRepo:

To install a new kernel, it is sufficient to install it with yum:

After the installation, reboot your system and select the newly installed kernel from the selection in GRUB. Red Hat or CentOS do not select the new kernel by default.

centos boot new kernel GRUB

To verify that the new kernel is used after booting:

When everything works as expected, change your GRUB-settings to boot with the new kernel by default. First verify the order listed in /etc/grub.conf and change the default to that number. GRUB-numbering is 0-based so the first one in the list is number 0:

To list the order of entries in grub:

The above example indicates that there are three kernels installed and that kernel 2.6.32-431.20.3 is the default kernel. To change the default to the newly installed version 3.15.2-1, we need to adjust the default to 0.

After the change:

When rebooting your system now, it should start automatically with the new kernel.

Known bug: Be aware that there is a known bug for kernels >= 3.12.2-1 in combination with RHEL6 and CentOS6 which makes acpid unusable.  So when installing the latest kernel-mt, you will also need to update acpid to version >2 from the ELRepo-extras repository.

More information about this problem: https://bugzilla.kernel.org/show_bug.cgi?id=66681

After installing a newer kernel, acpid will fail to start after rebooting with the new kernel:

To resolve this problem, install acpid from theELRepo-extras repo, this repository contains version >2 of acpid:

Check, after upgrading if acpid works again:

When everything works as expected, you can safely uninstall the older kernel in order to clean up your system and to free up some space in /boot

To check which kernels are currently installed:

Uninstall the old one:

That’s it… as with Debian, you can see that installing a recent kernel isn’t hard at all.

2 thoughts on “Install a newer kernel in Debian 7.5 (Wheezy) or CentOS 6.5

  1. Pingback: Install phpVirtualbox diatas KVM guest Proxmox 3.4 | ROAR

  2. Pingback: Install phpVirtualbox diatas KVM guest Proxmox 3.4 – GLiBogor

Leave a Reply

Your email address will not be published. Required fields are marked *