fix: create /etc/sysctl.d/ for Flatcar before sysctl tasks run#1991
Conversation
Flatcar Stable 4593.2.0+ ships without /etc/sysctl.d/ pre-created (part of the broader filesystem reshuffle in that release). The node role's 'Set and persist kernel params' task writes to /etc/sysctl.d/99-sysctl.conf via ansible.posix.sysctl, which uses mkstemp in the parent directory and fails with FileNotFoundError when the directory is missing. Add a file task in the setup role's flatcar.yml to ensure the directory exists before any sysctl tasks run.
|
@njuettner: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
The cc @AverageMarcus for review. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AverageMarcus The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…reate-sysctl-dir fix: create /etc/sysctl.d/ for Flatcar before sysctl tasks run
Change description
Flatcar uses a stateless
/etc/model. Its baselayout package only pre-creates a small set of/etc/directories (tmpfiles.d/baselayout-etc.conf:/etc/profile.d,/etc/vim,/etc/sudoers.d, …) —/etc/sysctl.d/is not among them and is never pre-created.The
noderole's "Set and persist kernel params" task writes to/etc/sysctl.d/99-sysctl.conf(pernodedefaults for Flatcar) viaansible.posix.sysctl, which callsmkstempin the parent directory and fails withFileNotFoundErrorwhen the directory is missing.Fix: add a
filetask in thesetuprole'sflatcar.ymlthat ensures/etc/sysctl.d/exists before any sysctl task runs. This mirrors the existing pattern innode/tasks/flatcar.ymlfor/etc/modprobe.d/, which is created the same way with the inline note "because of the read-only filesystem on Flatcar in /etc". Aligns with Flatcar's documented convention for persistent sysctl overrides: https://www.flatcar.org/docs/latest/setup/customization/other-settings/Additional context
Failing task excerpt: