Skip to content

Default user on Linux machine uses LANG=C.UTF-8 despite /etc/locale.conf having en_US.UTF-8 #2285

@jklaiho

Description

@jklaiho

I'm running OrbStack 2.0.5 on a 2019 Intel MacBook Pro running macOS Sequoia 15.7.3. When creating a new Linux machine (Ubuntu 24.04 in this case), without any cloud-init configs that might muddy the waters, the root user respects /etc/locale.conf, which has LANG=en_US.UTF-8 set. But the default user created by OrbStack somehow bypasses it, and has C.UTF-8 instead.

This was an absolute bear to troubleshoot, since nowhere in the user's home directory or anywhere under /etc was C.UTF-8 being set as the value of any LANG or LC_* variable, or seemingly even defaulted to. Finally, with some LLM assistance, I discovered this command:

cat /proc/self/environ | tr '\0' '\n' | grep LANG

When I run it as root, I got LANG=en_US.UTF-8, as I'd expect based on /etc/locale.conf. But for the non-root user, it's LANG=C.UTF-8. This is true for both the GUI terminal and Terminal.app ssh orb logins.

Additionally, LC_CTYPE=C.UTF-8 gets set with SSH logins, but not via the OrbStack GUI terminal. If I sudo su after orb ssh, LC_CTYPE remains set to C.UTF-8 even for root, though LANG is still en_US.UTF-8

My macOS terminal environment has LANG=en_US.UTF-8 and LC_CTYPE=fi_FI.UTF-8 set locally, so at least they don't seem to get inherited.

I'm not sure if this is a bug/omission or an intentional design decision. It seems preferable to me that the setting in /etc/locale.conf (or /etc/default/locale, which is just a symlink to /etc/locale.conf on Ubuntu) would be used instead. If this is not feasible, then perhaps the ability to specify the LANG (and LC_CTYPE with orb ssh) would be a good addition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions