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="..."
.)
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communitySysctl 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
kernel.printk=3 3 3 3
using kernel command line parameter to avoid having to set it ininitramfs
to avoid kernel information leaks. phabricator.whonix.org/T950