- 最新
- 投票最多
- 评论最多
Use the sysfsutils
package. This package allows modifying settings under /sys/kernel
by creating configuration files under /etc/sysfs.d
Settings in these configuration files will apply on each reboot.
Use a configuration management tool like Ansible to modify the /sys/kernel
setting and store the configuration. On reboot, Ansible can be used to re-apply the configuration.
Modify the GRUB configuration file (/etc/default/grub
) to pass the required kernel parameter on boot. For example, to change the
transparent_hugepage
setting, add transparent_hugepage=never
to the GRUB_CMDLINE_LINUX
variable. Then run grub2-mkconfig -o /boot/grub2/grub.cfg
to generate the config file..
A workaround would be to create a new system service of type Type=oneshot with RemainAfterExit=true.
I'm now continuing with the solution as simple single-file system service as that works fine. Using the following systemctl service parameters to get it set early enough before apps are started:
[Unit]
Requires=local-fs.target
Before=network.target
[Service]
Type=oneshot
RemainAfterExit=true
If anyone knows better ways to persistently easily configure Linux /sys settings please comment.
相关内容
- AWS 官方已更新 4 年前
- AWS 官方已更新 1 年前
On Ubuntu using the sysfsutils package was indeed already our solution on that OS, but on Amazon Linux 2023 the sysfsutils package looks different and it didn't include the /etc/sysfs.d/ file structure and no system service, just a library. Or has that changed the recent few weeks?
The GRUB configuration works for the standard transparent_hugepage setting, but not for the special shmem_enabled we need.