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:
jensd@deb:~$ cat /etc/*release PRETTY_NAME="Debian GNU/Linux 7 (wheezy)" ... jensd@deb:~$ uname -r 3.2.0-4-amd64
and for CentOS 6.5:
[jensd@cen ~]$ cat /etc/*release CentOS release 6.5 (Final) ... [jensd@cen ~]$ uname -r 2.6.32-431.el6.x86_64
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:
jensd@deb:~$ echo "deb http://ftp.debian.org/debian/ wheezy-backports main non-free contrib" | sudo tee -a /etc/apt/sources.list > /dev/null jensd@deb:~$ sudo apt-get update ... Reading package lists... Done
Now, you can browse the available kernels in the backports-rpository by adding -t wheezy-backports to your apt commands.:
jensd@deb:~$ aptitude search linux-image v linux-image - p linux-image-2.6-amd64 - Linux for 64-bit PCs (dummy package) p linux-image-3.12-0.bpo.1-amd64 - Linux 3.12 for 64-bit PCs p linux-image-3.12-0.bpo.1-amd64-dbg - Debugging symbols for Linux 3.12-0.bpo.1-amd64 p linux-image-3.12-0.bpo.1-rt-amd64 - Linux 3.12 for 64-bit PCs, PREEMPT_RT p linux-image-3.12-0.bpo.1-rt-amd64-dbg - Debugging symbols for Linux 3.12-0.bpo.1-rt-amd64 p linux-image-3.13-0.bpo.1-amd64 - Linux 3.13 for 64-bit PCs p linux-image-3.13-0.bpo.1-amd64-dbg - Debugging symbols for Linux 3.13-0.bpo.1-amd64 p linux-image-3.14-0.bpo.1-amd64 - Linux 3.14 for 64-bit PCs p linux-image-3.14-0.bpo.1-amd64-dbg - Debugging symbols for Linux 3.14-0.bpo.1-amd64 p linux-image-3.14-0.bpo.1-rt-amd64 - Linux 3.14 for 64-bit PCs, PREEMPT_RT p linux-image-3.14-0.bpo.1-rt-amd64-dbg - Debugging symbols for Linux 3.14-0.bpo.1-rt-amd64 i A linux-image-3.2.0-4-amd64 - Linux 3.2 for 64-bit PCs p linux-image-3.2.0-4-amd64-dbg - Debugging symbols for Linux 3.2.0-4-amd64 p linux-image-3.2.0-4-rt-amd64 - Linux 3.2 for 64-bit PCs, PREEMPT_RT p linux-image-3.2.0-4-rt-amd64-dbg
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.
jensd@deb:~$ sudo apt-get -t wheezy-backports upgrade
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.
jensd@deb:~$ sudo apt-get -t wheezy-backports install linux-image-3.14-0.bpo.1-amd64 Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: firmware-linux-free Suggested packages: linux-doc-3.14 debian-kernel-handbook The following NEW packages will be installed: firmware-linux-free linux-image-3.14-0.bpo.1-amd64 0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded. Need to get 30.9 MB of archives. After this operation, 146 MB of additional disk space will be used. Do you want to continue [Y/n]? y ... Processing triggers for initramfs-tools ... update-initramfs: Generating /boot/initrd.img-3.14-0.bpo.1-amd64
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.
To verify that the new kernel is used after booting:
jensd@deb:~$ uname -r 3.14-0.bpo.1-amd64
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:
jensd@deb:~$ dpkg --get-selections|grep linux-image linux-image-3.14-0.bpo.1-amd64 install linux-image-3.2.0-4-amd64 install linux-image-amd64 install
Uninstall the old one:
jensd@deb:~$ sudo apt-get remove linux-image-3.2.0-4-amd64 Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: linux-image-3.2.0-4-amd64 linux-image-amd64 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded. After this operation, 108 MB disk space will be freed. Do you want to continue [Y/n]? y
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:
[jensd@cen ~]$ sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
Then, install the repository:
[jensd@cen ~]$ sudo rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
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:
[jensd@cen ~]$ sudo yum 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:
[jensd@cen ~]$ repoquery --enablerepo=elrepo-kernel -qi kernel Name : kernel Version : 2.6.32 Release : 431.20.3.el6 Architecture: x86_64 Size : 126766729 Packager : CentOS BuildSystem <http://bugs.centos.org> ...
The long term support kernel from ELRepo:
[jensd@cen ~]$ repoquery --enablerepo=elrepo-kernel -qi kernel-lt Name : kernel-lt Version : 3.10.45 Release : 1.el6.elrepo Architecture: x86_64 Size : 160214778 Packager : Alan Bartlett <ajb@elrepo.org> ...
The mainline base kernel from ELRepo:
[jensd@cen ~]$ repoquery --enablerepo=elrepo-kernel -qi kernel-ml Name : kernel-ml Version : 3.15.2 Release : 1.el6.elrepo Architecture: x86_64 Size : 172207929 Packager : Alan Bartlett <ajb@elrepo.org> ...
To install a new kernel, it is sufficient to install it with yum:
[jensd@cen ~]$ sudo yum --enablerepo=elrepo-kernel install kernel-ml
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.
To verify that the new kernel is used after booting:
[jensd@cen ~]$ uname -r 3.15.2-1.el6.elrepo.x86_64
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:
[jensd@cen ~]$ sudo cat /etc/grub.conf |egrep "default|title" default=1 title CentOS (3.15.2-1.el6.elrepo.x86_64) title CentOS (2.6.32-431.20.3.el6.x86_64) title CentOS (2.6.32-431.el6.x86_64)
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:
[jensd@cen ~]$ sudo cat /etc/grub.conf |egrep "default|title" default=0 title CentOS (3.15.2-1.el6.elrepo.x86_64) title CentOS (2.6.32-431.20.3.el6.x86_64) title CentOS (2.6.32-431.el6.x86_64)
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:
[jensd@cen ~]$ uname -r 3.15.2-1.el6.elrepo.x86_64 [jensd@cen ~]$ sudo /etc/init.d/acpid status acpid is stopped
To resolve this problem, install acpid from theELRepo-extras repo, this repository contains version >2 of acpid:
[jensd@cen ~]$ repoquery --enablerepo=elrepo-extras -qi acpid Name : acpid Version : 2.0.19 Release : 2.0.1.2.el6.elrepo Architecture: x86_64 ... [jensd@cen ~]$ sudo yum --enablerepo=elrepo-extras install acpid [jensd@cen ~]$ rpm -qi acpid Name : acpid Relocations: (not relocatable) Version : 2.0.19 Vendor: The ELRepo Project (http://elrepo.org) Release : 2.0.1.2.el6.elrepo Build Date: Mon 27 Jan 2014 09:57:27 PM CET
Check, after upgrading if acpid works again:
[jensd@cen ~]$ sudo /etc/init.d/acpid start && sudo /etc/init.d/acpid status Starting acpi daemon: [ OK ] acpid (pid 1440) is running...
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:
[jensd@cen ~]$ rpm -qa|grep kernel|grep x86_64 kernel-2.6.32-431.el6.x86_64 kernel-ml-3.15.3-1.el6.elrepo.x86_64
Uninstall the old one:
[jensd@cen ~]$ sudo yum remove kernel-2.6.32-431.el6.x86_64
That’s it… as with Debian, you can see that installing a recent kernel isn’t hard at all.
Pingback: Install phpVirtualbox diatas KVM guest Proxmox 3.4 | ROAR
Pingback: Install phpVirtualbox diatas KVM guest Proxmox 3.4 – GLiBogor