Linux RedHat - Service and kernel configuration

December 2016




Intro

  • The aim of this tip is to:
    • Upload, view and delete kernel modules
    • Display system configuration information in the file system (/proc)
    • Configure runtime parameters with the system file (/proc)

Kernel Modules


Modular components of the Kernel

Many components of the kernel can be configured to be dynamically loaded, this option provides increased functionality of the kernel without increasing the size of the boot image. Thus all the components not needed to boot are modularized including device drivers and any additional file system.

The /lib/module directory


The kernel modules reside in /lib/module/{ Kernel version}. The directory name correspond to the kernel version (as reported by uname -r or uname -a). From version 2.4 an additional structure was added including new directories (kernel/{arch, drivers, fs, net}).

Control Modules


The modules are loaded when the kernel prompt them. The command lsmod lists the modules currently present in the Kernel. To request the kernel to load other modules you can use insmod or rmmod to unload an inactive module.

Intelligent control of modules


Just as for the dependency packages, modules depend on each other. It is possible to generate this dependence through the depmod command.
This command is executed automatically, with REDHAT. At system startup, rcsysinit launch command depmod -A, which compares the timpestamps of the files and updates modules.dep, if needed. modprobe can then be used to load kernel modules.

Configuring Kernel Modules


When the kernel needs a module, it will load it using modprobe and the kmod program will run it.
Some modules require, for their execution, the transition configuration settings. These parameters are present in the /etc/modules.conf file, which contains the default settings of loaded modules and their aliases. modprobe consults the configuration file when loading a new module to assign its default settings.

The file system /proc


The file system (/proc) is not associated with hard drive, but is enabled or disabled in the kernel. It represents a map of the kernel processes running. Its initialization is done via an entry in /etc/fstab file.
It is possible to navigate under /proc, as in a normal directory but note that all files have a size ofzero, however, it is possible to view the content using commands such as cat (Avoid viewing the file /proc/kcore because it represents an image of kernel memory for outstanding performance).
The / proc directory contains:
  • /proc/scsi: information about SCSI devices
  • /proc/ide : information on IDE devices
  • /proc/net: information on network activity and configuration
  • /proc/sys : parameters of the kernel configuration
  • /proc/<PID> :Information on the PID process

Configure /proc/sys avec sysct


Changes made to /proc/sys are temporary, in fact, during system startup, rc.sysinit will call sysctl -e -p /etc/syctl.conf. It also defines the values for /proc/sys/kernel/modprobe or /proc/kernel/hotplug.. This automatically restores the values of /proc/sys.

Notes


Thanks to wjaouadi for this tip

Related :

This document entitled « Linux RedHat - Service and kernel configuration » 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.