fix(locale): write /etc/locale.conf directly to bypass localectl D-Bus requirement - #125
Open
twangboy wants to merge 3 commits into
Open
fix(locale): write /etc/locale.conf directly to bypass localectl D-Bus requirement#125twangboy wants to merge 3 commits into
twangboy wants to merge 3 commits into
Conversation
…s requirement localectl set-locale (used by Salt's locale.system state) requires a running D-Bus/systemd-localed at runtime. In systemd 252+, the fallback that previously wrote /etc/locale.conf directly was removed. Since docker build runs without systemd, localectl silently fails on modern systemd and the locale is never persisted. Amazon Linux 2023 and Photon OS 5 both ship systemd 252+ and were affected by this after a container rebuild triggered by commit 34f15e4 pulled in updated system packages via yum/tdnf update -y. Two issues are fixed in custom/testing/golden-state-tree/config/locale.sls: 1. RedHat block (/etc/locale.conf for Amazon Linux 2023 and similar): The guard was `unless: test -f /etc/locale.conf`, which skips the state if the file exists even when empty or containing the wrong locale (e.g. LANG=C.UTF-8 from the base image). Changed to a content check: unless: grep -q "^LANG=en_US.UTF-8" /etc/locale.conf Also corrected the content value to include a trailing newline. 2. Photon OS block: There was no /etc/locale.conf management at all — only locale.system, which fails at build time for the same D-Bus reason. Added a file.managed state for /etc/locale.conf with the same content-check guard, required on the glibc-lang package install. The locale.system (localectl) call at the bottom of the file still runs but its failure is inconsequential — /etc/locale.conf is now written correctly during the build, and systemd-localed reads it directly at test time even without D-Bus. Fixes test_set_locale failures on: - Amazon Linux 2023 Arm64 (integration zeromq shard 2) - Photon OS 5 Arm64 FIPS (functional zeromq shard 2) - Photon OS 5 (functional zeromq shard 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
localectl set-locale(used by Salt's locale.system state) requires a running D-Bus/systemd-localed at runtime. In systemd 252+, the fallback that previously wrote /etc/locale.conf directly was removed. Since docker build runs without systemd, localectl silently fails on modern systemd and the locale is never persisted.Amazon Linux 2023 and Photon OS 5 both ship systemd 252+ and were affected by this after a container rebuild triggered by commit 34f15e4 pulled in updated system packages via
yum/tdnf update -y.Two issues are fixed in custom/testing/golden-state-tree/config/locale.sls:
RedHat block (
/etc/locale.conffor Amazon Linux 2023 and similar): The guard wasunless: test -f /etc/locale.conf, which skips the state if the file exists even when empty or containing the wrong locale (e.g. LANG=C.UTF-8 from the base image). Changed to a content check:unless: grep -q "^LANG=en_US.UTF-8" /etc/locale.confAlso corrected the content value to include a trailing newline.Photon OS block: There was no
/etc/locale.confmanagement at all — onlylocale.system, which fails at build time for the same D-Bus reason. Added afile.managedstate for/etc/locale.confwith the same content-check guard, required on the glibc-lang package install.The locale.system (localectl) call at the bottom of the file still runs but its failure is inconsequential —
/etc/locale.confis now written correctly during the build, and systemd-localed reads it directly at test time even without D-Bus.Fixes test_set_locale failures on: