Oracle 8i | Oracle 9i | Oracle 10g | Oracle 11g | Oracle 12c | Miscellaneous | PL/SQL | SQL | Oracle RAC | Oracle Apps | Linux

Linux Kernel Run-Time Parameters

This article describes how to check and set Linux Kernel Run-Time Parameters, with specific reference to the information needed for the RHCE EX300 certification exam.

Remember, the exams are hands-on, so it doesn't matter which method you use to achieve the result, so long as the end product is correct.

/proc/sys

Unlike other directories below the "/proc" directory, the "/proc/sys" directory provides both information and the ability for administrators to directly affect kernel features. Each parameter is represented as a file, with the parameters divided into a function-related directory structure.

/proc/sys/dev/    : Devices
/proc/sys/fs/     : File System
/proc/sys/kernel/ : Kernel
/proc/sys/net/    : Network
/proc/sys/vm/     : Virtual Memory

If a file listed below these directories, or their sub-directories, is marked as writable, it means the parameter this file represents can be modified.

# ls -l /proc/sys/kernel/shmmax
-rw-r--r--. 1 root root 0 Dec 29 19:56 /proc/sys/kernel/shmmax
#

The current value assigned to parameter can be viewed by using the cat command.

# cat /proc/sys/kernel/shmmax
68719476736
#

A new value can be assigned using the echo command.

# echo 68719476736 > /proc/sys/kernel/shmmax

Changes made in this way do not persist beyond a server reboot.

You can browse the directory structure to find a parameter or search for it.

# find /proc/sys -name shm*
/proc/sys/kernel/shmmax
/proc/sys/kernel/shmall
/proc/sys/kernel/shmmni
#

sysctl

The sysctl command provides an alternative method of interacting with the "/proc/sys" directory.

The "-a" option displays the parameters and their current values. Using the grep command allows you to limit the display.

# sysctl -a | grep shm
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmmni = 4096
vm.hugetlb_shm_group = 0
#

Notice how the path is relative to the "/proc/sys" directory and the "/" characters are replaced by ".".

The "-w" options is used to assign a new value to the specified parameter.

# sysctl -w kernel.shmmax="68719476736"
kernel.shmmax = 68719476736
#

Changes made in this way do not persist beyond a server reboot.

The "-p" option sets the values of any parameters defined in the "/etc/sysctl.conf" file.

/etc/sysctl.conf

When the system boots the init program runs the "/etc/rc.d/rc.sysinit" script, which runs sysctl command using the "/etc/sysctl.conf" file. This means the "/etc/sysctl.conf" file provides a method for making parameter changes persist through reboots. Unless you are making transient changes, you will likely make all of your parameter changes directly in the "/etc/sysctl.conf" file.

The file already contains some entries, but you can append additional entries in the form used by the sysctl command. When you've amended the file, you can either reboot the machine or use the sysctl command with the "-p" option. It makes sense to reload the file, since it acts as a test of your changes.

# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key
error: "net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables" is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
#

As you can see, the default entries include some errors. These can be suppressed using the "-e" option.

# sysctl -e -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
#

For more information see:

Hope this helps. Regards Tim...

Back to the Top.