How to have the latest kernel in openSUSE

From Wiki
Jump to navigation Jump to search

It is possible to have the latest kernel in openSUSE. However, there are a few thing you must consider. These will be discussed below.

We will be using the command line tool zypper to update to the latest kernel, because it is easier than YaST :D

stock kernels

OpenSUSE is installed (from DVD or wherever from) with a kernel called the 'stock' kernel. Sometimes this kernel is also referred to the GA kernel. This kernel remains the same for the whole time that that specific openSUSE version is supported, and is only updated with security issues and occasional bug fixes. This is called backporting. These updated stock-kernels appear in the update channel just as normal updates, so you should install them, just as other updates.

This is a list of the latest openSUSE versions and their stock kernels:

openSUSE version:    stock-kernel
12.2                 3.4.6-2.10
12.1                 3.1.9 upgraded to 3.1.10 for security/bugfixes
11.4                 2.6.37

kernel versions

openSUSE has the option to run other 'flavours' of the kernel. These include:

  • kernel-default -> The standard kernel for both uniprocessor and multiprocessor systems.
  • kernel-desktop -> This kernel is optimized for the desktop. It is configured for lower latency and has many of the features that aren't usually used on desktop machines disabled.
  • kernel-pae -> this is a 32-bit only special kernel with support for 64GB memory. 64 bit kernels support this by default
  • kernel-vanilla -> The standard kernel - without any SUSE patches
  • kernel-xen -> The Linux kernel for Xen paravirtualization. This kernel can be used both as the domain0 ("xen0") and as an unprivileged ("xenU") kernel.

Usually, for a desktop/laptop system, you run the default or the desktop flavour.

keeping older kernel versions as fallback

It is good practice, when you enable the kernel-head repo and thus recieve the latest and greatest kernel, to keep some previous kernel(s) at hand to use as a fallback scenario. These kernels will appear in your grub menu so you will be able to choose them when booting up your machine.

Fortunately, zypper supports this with a few configuration options. It is possible for instance to instruct zypper to keep the stock kernel, the latest kernel, and the latest but one and to remove all others. That is cool, right?

The magic is in the file /etc/zypp/zypp.conf. There are two options there:

multiversion = provides:multiversion(kernel)
multiversion.kernels = latest,oldest

The first line enables the mutiple installation of kernels simultaniously. This is not possible by default, so this option is necessary.

The second has several options:

## Comma separated list of kernel packages to keep installed in parallel, if the
## above multiversion variable is set. Packages can be specified as
## - Exact version to keep
## latest        - Keep kernel with the highest version number
## latest-N      - Keep kernel with the Nth highest version number
## running       - Keep the running kernel
## oldest        - Keep kernel with the lowest version number (the GA kernel)
## oldest+N      - Keep kernel with the Nth lowest version number
## Default: Do not delete any kernels if multiversion = provides:multiversion(kernel) is set
#multiversion.kernels = latest,oldest

So, if you want to keep the stock kernel and the latest kernel, use:

multiversion.kernels = latest,oldest

If you want to keep the stock kernel, the latest and the kernel before that, use:

multiversion.kernels = latest,oldest,latest-1

enabling the kernel head repository

To receive the latest kernel, you must create an additional repo to download from.

zypper ar -f kernel-repo

This command add a new repository (ar), enables refresh (-f), provides the URL, and a name (kernel-repo).

This repository always contains the lastest development kernel, i.e. 3.4.0-rc6-1-desktop. Do not expect to find older versions there, it is always the latest and only the latest build!

This repo is the same for all openSUSE version,

updating from the new repo

To actually download and install the new kernel, you must do a special update. This is called a distribution-upgrade. Don't worry, this won't update your entire installation! We will instruct zypper to only use updated packages from the kernel-repo we just created. A normal 'zypper up' won't replace packages from a different repo then the one it was originally installed from.

Issue the command:

zypper dup -r kernel-repo

This tells zypper to do a dist-upgrade from the kernel-repo, so only your new kernel files will be installed alongside the old ones, if you have properly configured the zypp.conf file.

check check double check

After you have completed these instructions, you can check which kernels you have installed:

rpm -qa | grep kernel

The output of that command on my system at time of this writing:

#rpm -qa | grep kernel | sort

As you can see, I have 2 kernels installed at the moment: 3.4.rc3 and 3.4.rc6. (The rest of the packages are necessary for other purposes, like Virtualbox.)