From Gentoo Wiki
Jump to: navigation, search
Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎italiano • ‎日本語 • ‎한국어 • ‎Nederlands • ‎русский • ‎中文(中国大陆)‎

This article describes the steps to upgrade to a new kernel.


A kernel upgrade may be necessary when new kernel sources are installed after a system update or when you yourself install new kernel sources.


The configuration parallels that of the manual configuration, since only the config file is reused. All steps are mentioned here again for the sake of completeness, for a more verbose explanation see the other article.

Set symlink

The symlink /usr/src/linux should always point to the kernel sources that is currently being used. This can be done in one of three ways:

1. Installing the kernel sources with active symlink USE flag
This will make the /usr/src/linux point to your newly installed kernel sources. If necessary, it can still be modified later with the following two methods:
2. Setting the symlink with eselect
root # eselect kernel list
Available kernel symlink targets:
  [1] linux-3.14.14-gentoo *
  [2] linux-3.16.3-gentoo
This outputs the available kernel sources. The asterisk indicates the chosen sources. To change the kernel sources, e.g. to the second entry, do:
root #eselect kernel set 2
3. Setting the symlink manually
root #ln -sf /usr/src/linux-3.16.3 /usr/src/linux
root #ls -l /usr/src/linux
lrwxrwxrwx 1 root root 19 Oct 4 10:21 /usr/src/linux -> linux-3.16.3-gentoo

Sanitize sources

If you are experiencing build problems while rebuilding the current kernel, it might help to sanitize the kernel sources. Make sure you backup the .config file first, as the operation will remove it. Make sure not to use a .bak or ~ suffix as backup as make distclean will clean those up as well.

root #cp .config /usr/src/kernel_config_bk
root #make distclean
root #mv /usr/src/kernel_config_bk .config

Copy previous kernel configuration

The configuration from currently running kernel needs to be copied to the new one. It can be found in several places:

  • In the procfs filesystem, if the kernel option Enable access to .config through /proc/config.gz was activated in your present kernel:
root #zcat /proc/config.gz > /usr/src/linux/.config
  • In the /boot directory, if you installed the config file there:
root #cp /boot/config-3.14.14-gentoo /usr/src/linux/.config
  • In the kernel directory of the currently-running kernel:
root #cp /usr/src/linux-3.14.14-gentoo/.config /usr/src/linux/

make silentoldconfig

Now update the previous config file for your new kernel:

root #cd /usr/src/linux
root #make silentoldconfig

The following configuration parallels that of the text based configuration with make config. For every difference between the kernel versions, it asks if you want to activate the driver or feature. An example:

root #make oldconfig
Anticipatory I/O scheduler (IOSCHED_AS) [Y/n/m/?] (NEW)

The string (NEW) at the end of the line marks this option as new. Left to the string in square brackets are the possible answers: Yes, no, module or ? to show the help. The recommend answer is capitalized (here Y). The help explains the option or driver.

Unfortunately make oldconfig doesn't show - next to the help - a lot more information for each option, like the context, so that it is sometimes difficult to give the right answer. In this case the best way to go is to remember the option name and revise it afterwards through one of the graphical kernel configuration tools.

Reinstall external kernel modules

Any external kernel modules, such as binary kernel modules, need to be rebuilt for each new kernel. If the kernel hasn't been built yet, it has to first be prepared for the building of the external kernel modules:

root #make modules_prepare

You can rebuild the packages using the @module-rebuild set:

root #emerge --ask @module-rebuild


For this step, follow the steps in the manual configuration article.

Removing old kernels

See the kernel removal article.

External resources