1

Is it possible to set Linux kernel sysctl settings (those usually set in /etc/sysctl.d) using kernel command line (those visible in /proc/cmdline)?

(Using grub config file /etc/default/grub variable GRUB_CMDLINE_LINUX="...".)

  • Your question makes no sense to me. What exactly are you trying to achieve? – fpmurphy Dec 25 '19 at 3:39
  • Quiet boot. Setting kernel.printk=3 3 3 3 using kernel command line parameter to avoid having to set it in initramfs to avoid kernel information leaks. phabricator.whonix.org/T950 – adrelanos Dec 25 '19 at 9:40
  • As far as I know, it is not possible to do this from the kernel command line. – fpmurphy Dec 26 '19 at 1:01
2

Sysctl parameters can be set via the kernel command-line starting with kernel version 5.8, thanks to Vlastimil Babka from SUSE.

sysctl.*=       [KNL]
                Set a sysctl parameter, right before loading the init
                process, as if the value was written to the respective
                /proc/sys/... file. Both '.' and '/' are recognized as
                separators. Unrecognized parameters and invalid values
                are reported in the kernel log. Sysctls registered
                later by a loaded module cannot be set this way.
                Example: sysctl.vm.swappiness=40
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.