The kernel is one of the few package classes in portage that requires some manual intervention to complete the upgrade. Portage will download and install the kernel source for you, but then it is up to you to step in and compile the new kernel before any changes will take effect.
Although this guide is targeted at users upgrading from one kernel release to another, it will also be useful for users migrating from one kernel package to another.
Generally, upgrading from one minor kernel release to the next won't bring any major differences. There are several reasons to upgrade the kernel. One is to take advantage of a specific new feature or driver; another is to be protected against a security vulnerability, or just to maintain an up-to-date and healthy system.
Even if you choose not to update to every new kernel revision, it is recommended that you at least upgrade from time to time. It is strongly recommended that you immediately upgrade to a new kernel if that new release solves a security problem.
You upgrade the kernel sources like you would upgrade any other package -
using the
# emerge -Dup world Calculating dependencies ...done! [ebuild NS ] sys-kernel/gentoo-sources-2.6.9-r2 [2.6.8-r5]
You can then go ahead and install the update, e.g.:
# emerge -u gentoo-sources
The kernel sources will then be installed into a subdirectory of
Gentoo requires that the
Portage can update the symlink automatically when you emerge new kernel
sources. All you have to do is add the
(Add the symlink keyword) USE="symlink x86 3dnow 3dnowex X aac aalib adns alsa apache2"
Alternatively, you could use
(Install eselect if you don't have it) # emerge eselect(See the list of available kernels) # eselect kernel list Available kernel symlink targets: [1] linux-2.6.9-gentoo-r1 [2] linux-2.6.9-gentoo-r2(Select the correct kernel) # eselect kernel set 1
If you really want to do it yourself, the following example shows you how to
make the link point to
# cd /usr/src # ln -sfn linux-2.6.9-gentoo-r2 linux
For either of these options, you should refer to the instructions given in the
If you are a genkernel user, you just need to repeat the stages you went through when installing your kernel for the first time.
Simply run genkernel in the normal way:
# genkernel all
You can also use extra parameters for other genkernel functionality. For
example, if you wish to configure some extra kernel options using
# genkernel --menuconfig --bootloader=grub all
For more info, follow the
To begin, open the
# cd /usr/src/linux # make menuconfig
Select the options required for your hardware and operating environment. For
additional information on kernel configuration, refer to the chapter entitled
Next, compile your kernel and copy it over to your boot partition. Again,
follow the
# make && make modules_install # mount /boot # cp arch/i386/boot/bzImage /boot/bzImage-2.6.9-gentoo-r2
Finally, you should update your boot loader configuration, adding an entry for
the new kernel (don't delete the old one just yet!) and unmount the
If you use any kernel modules that are not included in the kernel source tree
but are provided elsewhere in Portage (e.g. ALSA drivers and NVIDIA or ATI
graphics drivers), then you must reinstall these after upgrading the kernel.
This is as simple as re-merging the packages involved. For more information,
refer to the chapter on
We provide you with an easy tool (
For more information, run
Next, close all applications and reboot your system. If you followed the above instructions correctly, the boot loader menu should include an entry for the new kernel. Select the new kernel and let the system boot.
Hopefully, your system successfully boots with the new kernel, and you can log in to resume whatever you were doing. If this is the case, then the upgrade is complete.
If you made a mistake and the system fails to boot with the new kernel, reboot
the system and select the entry from the boot loader that corresponds to the
last known working kernel. You can then restart from the
You may have noticed, that when installing the sources for your newer kernel, the sources for your existing kernel were not removed. This is by design -- it allows you to easily switch between running different kernels.
Switching between multiple kernels is as simple as leaving the kernel sources
under
Continuing on from the last section, you may be happy with your new kernel and
not have any need to keep older kernel versions around. To easily remove all
sources for a particular kernel except for the newest one, you can take
advantage of the
# emerge -P gentoo-sources
In most cases, temporary files used during compilation will still remain under
the appropriate source directory under
You can also safely delete any modules that were used by this kernel. This can
be done by removing the appropriate directories under
Finally, you can mount your
It is sometimes possible to save time by re-using the configuration file from your old kernel when configuring the new one. Note that this is generally unsafe -- too many changes between every kernel release for this to be a reliable upgrade path.
The only situation where this is appropriate is when upgrading from one Gentoo
kernel revision to another. For example, the changes made between
To reuse your old
# cd /usr/src/linux-2.6.9-gentoo-r2 # cp ../linux-2.6.9-gentoo-r1/.config . # make oldconfig
# cd /etc/kernels # cp kernel-config-x86-2.6.9-gentoo-r1 kernel-config-x86-2.6.9-gentoo-r2 # genkernel all
At this point, you may be asked to produce answers for configuration options
which have changed between the two versions. Once you have done that, you can
compile and install your kernel as normal, without having to go through the
With the rapid development of the Linux kernel, it is inevitable that some
changes made from one kernel release to another may cause some problems. If you
have any issues with the latest versions of