Linux

如何使用核心命令行參數設置 sysctl?

  • June 18, 2020

是否可以使用核心命令行(在 中可見的那些)設置 Linux 核心sysctl設置(通常在 中設置)?/etc/sysctl.d``/proc/cmdline

(使用grub配置文件/etc/default/grub變數GRUB_CMDLINE_LINUX="..."。)

Sysctl 參數可以通過從核心版本5.8開始的核心命令行設置,這要感謝SUSE 的 Vlastimil Babka。

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

引用自:https://unix.stackexchange.com/questions/558802