Skip to content

fix(locale): write /etc/locale.conf directly to bypass localectl D-Bus requirement - #125

Open
twangboy wants to merge 3 commits into
saltstack:mainfrom
twangboy:fix_locale
Open

fix(locale): write /etc/locale.conf directly to bypass localectl D-Bus requirement#125
twangboy wants to merge 3 commits into
saltstack:mainfrom
twangboy:fix_locale

Conversation

@twangboy

Copy link
Copy Markdown
Contributor

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)

…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)
@twangboy twangboy self-assigned this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant