How to persistently change /sys/kernel Linux settings now with the tuned package removed in Amazon Linux 2023?

0

With the tuned package now missing on current Amazon Linux, https://github.com/amazonlinux/amazon-linux-2023/issues/327:

Which cost-efficient simple alternative exists to persistently store Linux configurations for /sys/kernel over a reboot?

For our business needs we require to change /sys/kernel/mm/transparent_hugepage/shmem_enabled from the Amazon Linux 2023 default of "never" to "advise".

Previously on Amazon Linux 2 we could easily do that with the tuned package.

I see the sysfsutils package exists, but that's a different one than the identically named on Ubuntu where that package uses configuration files below /etc/sysfs.d for permanently modifying settings below /sys/kernel and the AL2023 version doesn't offer that functionality.

If you decide to change the shmem_enabled setting to advise as default, that would of course also help us and we wouldn't need to change the configuration anymore.

질문됨 2달 전205회 조회
3개 답변
0

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..

profile picture
전문가
답변함 한 달 전
  • 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.

0

A workaround would be to create a new system service of type Type=oneshot with RemainAfterExit=true.

답변함 2달 전
0

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.

답변함 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠