<< Prev. Page: Linux Security & Administration
The Linux kernel version consists of four segments: the major, minor, revision, and security/bugfix numbers. The major number rarely changes with a significant change in the kernel, and the minor number indicates the major revision of the kernel — the security/bug number used for security and bug fixes.
The new developments appear as release candidates and have ‘rc' in the name. The latest Linux Kernel version is 5.6.13, 5 is the major number, 6 is minor, and 13 is revision number. The release candidate version for a new kernel is 5.7-rc5.
Most distributions add another number, which refers to a specific set of patches applied to a kernel as well as distribution initial. The Red Hat Enterprise Linux 8 have a kernel version as 4.18.0-193.
Use the command to find the kernel version:
$ cat /etc/redhat-release
On Distributions supporting RPM packages run a command
The new versions released continuously to provide support to new features or new hardware or to patch security loopholes.
The Kernel headers installed in /usr/lib/modules/versions/build directory.
The Kernel header packages denoted with ‘devel' contains only the kernel headers used for compiling kernel modules or software and do not need full source code. The headers get installed in the /etc/kernels directory with the build link in the kernel's /lib/modules library.
Kernel installs in the /boot directory, and it holds the files for the old and new installation, each ending with the Kernel version number. The Kernel boots use the selected /boot/vmlinuz-version, a kernel image file, along with several support files, System.map, config, and intitrd. The System.map contains kernel symbols needed by modules to start kernel functions.
RAM Disks For Diskless Systems
For systems using block devices like SCSI, RAID, or IDE unsupported by the Kernel, the modules get stored in RAM disk and loads at startup. The mkinitrd command incorporates all the modules that the system uses, including those listed in /etc/modules.conf file.
# mkinitrd /boot/initrd-2.6.version.img 220.127.116.11
Precautionary Steps for Modifying Kernel
Before modifying the current kernel, always advised creating a backup copy of /boot/vmlinuz-version, System.map and config files. Otherwise, the already set up module gets lost with the original kernel. A new installation entry gets created in GRUB /boot/grub/menu.list, which on boot, lists the options to select on startup. Experts advised keeping entry of the original kernel if something goes wrong with the new customized kernel.
kernel /boot/vmnlinuz-version ro root=/dev/hda3 initrd /boot/initrd-version.img
GRUB (GRand Unified Bootloader)
Function: Execution of the Kernel, and then its jobs is over. After BIOS boots, it loads itself and loads kernel into memory.
Default Configuration File: /boot/grub.d/grub.cfg. It is the source of user configuration specifications and contains the list of installed kernels in an array ordered by sequence of installation.
Configuration File Directives located in /etc/grub.d
- GRUB_TIMEOUT: Default value is 5. Time length for which selection menu displayed
- GRUB_DISTRIBUTOR : Defines sed expression that extracts the distribution release number from the /etc/system-release file for each Kernel release
- GRUB_DEFAULT: It is the most recent kernel. Its value index starts from 0 onwards, and a user can set its value to the name of the desired kernel
- GRUB_DISABLE_SUBMENU: It creates a hierarchical menu structure of kernels for the GRUB menu screen.
- GRUB_TERMINAL_OUTPUT: By default, sends output to the default terminal. It may be desirable to redirect to serial or Integrated Lights Out (ILO) terminal connections in a lab environment.
- GRUB_CMDLINE_LINUX: The command-line arguments that passed to the kernel at boot time.
- GRUB_DISABLE_RECOVERY: A recovery entry created for every installed Kernel when its value is ‘false.' Regardless of this setting, the last kernel entry is always a “rescue” option.
Generate the /boot/grub2/grub.cfg file using configuration files
grub2-mkconfig > /boot/grub2/grub.cfg
>> Next Page: Kernel Parameters and Configuration