Some sysctl.conf parameters are not used after reboot, manually adjusting the settings works as expected
Environment
- Red Hat Enterprise Linux (RHEL), any version
- the same sysctl settings can be sucessfully changed manually after boot, either changing the respective entries under /proc/ one by one, or by running "sysctl -p" (to read the settings in sysctl.conf and apply them)
- the settings are specific to a certain kernel module, not built in (so there's a separate module which needs to be loaded for these settings to be available), an example of such module would be "sctp", or "cifs"
Issue
After adding some new settings to sysctl.conf, it is observed that the actual status of the switches/tunables (under /proc) is unchanged after reboot (the changes in sysctl.conf seem to be ignored, and the defaults are still in place)
Resolution
Make sure the module is loaded before the sysctl init script runs
A possible alternative would be to try using the "install" option in the relevant modprobe.conf file for this kernel module, to make sure the settings are reloaded whenever the kernel module is loaded, but this is not the typical sysctl.conf behavior, so is beyond the scope of this article.
Root Cause
- the sysctl init script is run at a certain point in time during the boot process, and it is run only once
- the relevant kernel module is loaded or re-loaded after the sysctl init script runs; in the first case, the settings will not be available, in the second case, reloading the module will clear the settings back to defaults.
Diagnostic Steps
-
once boot process is finished, verify the current running state (check /proc/sys/... settings, not the /etc/sysctl.conf), if they are not the expected ones, continue to next step
-
run "sysctl -p", and verify the settings again (see above); if the settings are still not correct, make sure the kernel module is loaded; if the kernel module is loaded, verify the vlaidity/presence of these settings in /proc/, and try setting them manually one by one to the exact value that is desired; if the settings are updated without problem, continue to next step
-
run a command similar to this (for rhel6), replacing "$module_name" with the actual name of the modules in question
# echo "modprobe $module_name" >> /etc/rc.modules && chmod 775 /etc/rc.modules
- make sure the module is not re-loaded by some script (like rc.local)
- reboot the machine and verify the status of the settings immediately after reboot
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments