Skip to content

Instantly share code, notes, and snippets.

@readingtype
Created January 9, 2024 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save readingtype/b953c38fce6a0d3dbc6fe09b05627706 to your computer and use it in GitHub Desktop.
Save readingtype/b953c38fce6a0d3dbc6fe09b05627706 to your computer and use it in GitHub Desktop.
Resolve issue in Ubuntu 22.04 desktop where LC_ALL was set for desktop apps so numbers and dates were incorrectly formatted for the chosen locale

Something was setting LC_ALL in my Ubuntu 22.04 desktop environment. Terminals were unaffected but desktop apps were apparently using the default C locale with 'US style' date formatting. There were also numerous log entries like this:

snapd-desktop-integration.snapd-desktop-integration[5623]: /bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.utf8)

According to sources online, LC_ALL shouldn't be set. I looked for the source of the command. There was nothing in any of the scripts in my $HOME (such as .profile, .bashrc). I created a brand new user and the same issues were there when logged into their account's desktop. I looked in /etc/profile.d which contains system defaults for user profile settings.

To find out what files in the profile directory were installed by a package:

$ for file in `ls /etc/profile.d/`; do dpkg --search $file; done
base-files: /etc/profile.d/01-locale-fix.sh
snapd: /etc/profile.d/apps-bin-path.sh
bash-completion: /etc/profile.d/bash_completion.sh
language-selector-common: /etc/profile.d/cedilla-portuguese.sh
libdebuginfod-common: /usr/share/libdebuginfod-common/debuginfod.csh
libdebuginfod-common: /usr/share/libdebuginfod-common/debuginfod.sh
gnome-session-common: /etc/profile.d/gnome-session_gnomerc.sh
im-config: /etc/profile.d/im-config_wayland.sh
dpkg-query: no path found matching pattern *rust.sh*
dpkg-query: no path found matching pattern *utf8.sh*
libvte-2.91-common: /etc/profile.d/vte-2.91.sh
libvte-2.91-common: /etc/profile.d/vte.csh
gnome-session-common: /etc/profile.d/xdg_dirs_desktop_session.sh

The content of utf8.sh:

export LANG="en_US.utf8"
export LC_ALL="en_US.utf8"
export LANGUAGE="en_US"

This and rust.sh were modified at the same time. I think that they might both come from some part of installing Rust or some part of Rust.

I left rust.sh, which does not look problematic, but moved utf8.sh out of the directory. I rebooted. The removel of the file had resolved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment