Gentoo- Updating the kernel

December 2016



Why updating the kernel?


The updated kernel will:
  • Receive updates on drivers
  • Protect against security vulnerabilities
  • Maintain a stable system update

It is always recommended to regularly update the kernel as a maintenance task.

The emerge utility


Updating the kernel of Gentoo is done like any other package using the emerge utility.
  • To update the sources:
  • #emerge -u gentoo-sources

The packages will be installed under /usr/src.

Updating the symbolic link: /usr/src/linux


Gentoo needs that the /usr/src/linux symbolic link points to the kernel source being used used. The portage automatically updates the symbolic link, but you must manually configure the symlink flag in the /etc/make.conf configuration file..
  • USE="symlink x86 3dnow 3dnowex X aac aalib adns alsa apache2"

Alternatively, it is possible to use the app-admin/eselect package to change the symbolic link.
To do this you must install the package then use it to change the link as follows
Alternatively, you could use app-admin/eselect to modify the symlink.
# emerge eselect 
(Afficher la liste de noyaux disponibles) 
# eselect kernel list 
Available kernel symlink targets: 
  [1]   linux-2.6.27-gentoo-r8 * 
  [2]   linux-2.6.27-gentoo-r10 
# eselect kernel set 2

To verify the application:
# cd /usr/src 
# ln -sfn linux-2.6.9-gentoo-r2 linux

Configuration, compilation and installation of the new kernel

Automatic installation via the Genkernel tool


First install the Genkernel tool:
  • #emerge genkernel

Launch the installation:
  • #genkernel all

Update grub:
  • # genkernel --menuconfig --bootloader=grub all

Manual Installation


Begin by launching the kernel configuration utility
# cd /usr/src/linux 
# make menuconfig
  • Choose the required options for hardware and system environment.
  • There is a comprehensive guide to help you out with the kernel configuration.
  • This is a freely downloadable: Linux kernel in a nutshell

Then you have to compile the kernel and copy the boot partition. If /boot is a separate partition, then you must mount it:
# make && make modules_install 
# mount /boot 
# cp arch/i386/boot/bzImage /boot/bzImage-2.6.9-gentoo-r2
  • Finally, you need to update the boot loader, adding the reference to the new kernel.

Reinstallation of external modules


You may require to re-install the external modules after updating the kernel.

Reboot with the new kernel


Close all the processes and restart.

Remove the old kernel


It possible to use to remove the old kernel versions:
  • # emerge -P gentoo-sources 


You also need to delete the files related to old kernels in the usr/src using the rm command.

Related :

This document entitled « Gentoo- Updating the kernel » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.