Updating kernel in Gentoo Linux

kernel Gentoo
Updating kernel in Gentoo Linux

The kernel is the heart of an operating system. It provides secure and controlled hardware access to running processes. It can therefore be understood how important it is, in terms of IT security, to update the kernel.

Here are the commands to update the kernel in Gentoo OS.

Once you have synced your Portage tree and updated your system as described in my other article here, continue with the following commands:

1) cd /usr/src/linux
2) cp .config ~/kernel-config-'uname –r'

These two commands save your old kernel settings.


1) eselect kernel list
2) eselect kernel set (number of newest kernel)

Or

ln –sf /usr/src/linux-newest_kernel_version_number-gentoo/ /usr/src/linux

These commands are alternative. They set the new kernel version.


1) cp /usr/src/linux-old_kernel_version_number-gentoo/.config.old /usr/src/linux-old_kernel_version_number-gentoo/.config.old2
2) cp /usr/src/linux-old_kernel_version_number-gentoo/.config /usr/src/linux-old_kernel_version_number-gentoo/.config2
3) cp /usr/src/linux-old_kernel_version_number-gentoo/.config.old /usr/src/linux/
4) cp /usr/src/linux-old_kernel_version_number-gentoo/.config.old /usr/src/linux-newest_kernel_version_number-gentoo
5) cp /usr/src/linux-old_kernel_version_number-gentoo/.config /usr/src/linux
6) cp /usr/src/linux-old_kernel_version_number-gentoo/.config /usr/src/linux-newest_kernel_version_number-gentoo

This set of commands is to save the old kernel settings and copy them to the new kernel’s .config file. If instead you don’t want to update the kernel with the old settings and you want to set all the kernel options again from scratch see (between the second step below) the second option.


mount /boot

To mount /boot if it isn’t already mounted.


genkernel --oldconfig all

Or

genkernel --menuconfig all

They compile the new kernel. As mentioned above, the second command allows you to manually set all possible options of the new kernel before compiling it. If you don’t know your computer’s hardware very well, a wrong setting will not only not exploit the full potential and features of Gentoo but it can also lead to problems and to system malfunction with various error messages.


grub-mkconfig –o /boot/grub/grub.cfg

This updates the grub.cfg configuration file.


emerge @module-rebuild

It reinstalls external kernel modules (for example video card drivers).


emerge @live-rebuild

It is similar to the command above but only affects unofficial packages.


The last step is to restart the system. Once done, running the uname command we should see the new kernel version.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Dark Mode
0
Would love your thoughts, please comment.x
()
x
| Reply