#8617 systemd: enforce en_US.UTF-8 locale in systemd units
Closed: fixed 3 years ago by abbra. Opened 3 years ago by abbra.

Python code does detection of the system encoding based on the locale settings. On RHEL 8.4 development images we somehow get LANG=en_US which defaults to iso8859-1 inside the systemd-started service, even though the whole environment defaults to LANG=en_US.UTF-8.

When instrumented with ExecStartPre=/usr/bin/locale, the following output can be seen:

locale[45481]: LANG=en_US
locale[45481]: LC_CTYPE="en_US"
locale[45481]: LC_NUMERIC="en_US"
locale[45481]: LC_TIME="en_US"
locale[45481]: LC_COLLATE="en_US"
locale[45481]: LC_MONETARY="en_US"
locale[45481]: LC_MESSAGES="en_US"
locale[45481]: LC_PAPER="en_US"
locale[45481]: LC_NAME="en_US"
locale[45481]: LC_ADDRESS="en_US"
locale[45481]: LC_TELEPHONE="en_US"
locale[45481]: LC_MEASUREMENT="en_US"
locale[45481]: LC_IDENTIFICATION="en_US"
locale[45481]: LC_ALL=
ipactl[45483]: Unexpected error
ipactl[45483]: SystemEncodingError: System encoding must be UTF-8, 'iso8859-1' is not supported. Set LC_ALL="C.UTF-8", or LC_ALL="" and LC_CTYPE="C.UTF-8".
systemd[1]: ipa.service: Main process exited, code=exited, status=1/FAILURE

Set the environment to explicit LANG=en_US.UTF-8 to please the Python code. FreeIPA server side only cares about actual encoding, not the language itself.


master:

  • 38a86e3 systemd: enforce en_US.UTF-8 locale in systemd units

May it be the bug within exactly that environment?

@slev something did change the way systemd service LANG environmental variable is initialized. @cheimes is investigating which package did that change but for FreeIPA we don't really need to depend on defaults for LANG/LC_ALL in systemd service. We already enforce C.UTF-8 in httpd systemd unit override so this fix is just extension of that.

And en_US is iso8859-1 in the locale itself while we need UTF-8 based locale, thus forcing the one that has UTF-8.

ipa-4-8:

  • dce8ec5 systemd: enforce en_US.UTF-8 locale in systemd units

Metadata Update from @abbra:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

3 years ago

ipa-4-9:

  • 184997e systemd: enforce en_US.UTF-8 locale in systemd units

Login to comment on this ticket.

Metadata