Hi,
I have been facing strange behavior with my setup: Some settings in locale are set to de_AT and I can’t figure out why. Setting everything to en_US didn’t solve the issue. If de_At is not enabled in locale.gen, stuff breaks, because it is missing.
Errors include:
Warning: locale not supported by C library, locale unchanged
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Excepted Behavior
If I use Manjaro Seetings to change my language, I expect stuff to work and not to break.
Observed behavior
Stuff breaks:
Error messages
I cannot open gnome-terminal anymore.
$ gnome-terminal --verbose
# Locale not supported by C library.
# Using the fallback 'C' locale.
# Error creating terminal: Could not activate remote peer 'org.gnome.Terminal': startup job failed
Using xterm I get this error:
manpath: can't set the locale; make sure $LC_* and $LANG are correct
Actual output from diferent files:
more details
# grep -v "^#" /etc/locale.gen
en_US.UTF-8 UTF
# cat /etc/default/locale
LANG=en_US.UTF-8
/etc/profile.d/locale.sh (default)
# cat /etc/profile.d/locale.sh
#!/bin/sh
# load locale.conf in XDG paths.
# /etc/locale.conf loads and overrides by kernel command line is done by systemd
# But we override it here, see FS#56688
if [ -z "$LANG" ]; then
if [ -n "$XDG_CONFIG_HOME" ] && [ -r "$XDG_CONFIG_HOME/locale.conf" ]; then
. "$XDG_CONFIG_HOME/locale.conf"
elif [ -n "$HOME" ] && [ -r "$HOME/.config/locale.conf" ]; then
. "$HOME/.config/locale.conf"
elif [ -r /etc/locale.conf ]; then
. /etc/locale.conf
fi
fi
# define default LANG to C.UTF-8 if not already defined
LANG=${LANG:-C.UTF-8}
# export all locale (7) variables when they exist
export LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY \
LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT \
LC_IDENTIFICATIO
$ echo $LANG
en_US.UTF-8
$ cat $XDG_CONFIG_HOME/locale.conf
cat: /locale.conf: No such file or directory
cat $HOME/.config/locale.conf
cat: ~/.config/locale.conf: No such file or directory
# cat /etc/locale.conf
LANG=en_US.UTF-8
$ locale -a
C
C.utf8
en_US.utf8
POSIX
$ localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: de
X11 Layout: de
X11 Model: pc105
$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_AT.UTF-8
LC_TIME=de_AT.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_AT.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_AT.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS=de_AT.UTF-8
LC_TELEPHONE=de_AT.UTF-8
LC_MEASUREMENT=de_AT.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
This output doesn’t make a lot of sense, because de_AT is nowehere configured.
What I tried
Following some guides
links
I followed these guides:
- [root tip] [How To] Troubleshooting locale errors
- Locale - ArchWiki
- locale: Cannot set LC_ALL to default locale: No such file or [SOLVED] / Newbie Corner / Arch Linux Forums
- [SOLVED]man: can't set the locale; make sure $LC_* and $LANG are corre / Newbie Corner / Arch Linux Forums
- Changing KDE language settings messed up locale
- [root tip] [How To] Troubleshooting locale errors
- Changing locales
- Rofi failed to set locale
- Change date format for locale / region
without success.
Adding another format languange
adding de_DE
When I change the local to “Display Language = en_US” and “Formats = de_DE” in the Manjaro Settings Manager, I get this:
$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_AT.UTF-8
LC_TIME=de_AT.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_AT.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_AT.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_AT.UTF-8
LC_TELEPHONE=de_AT.UTF-8
LC_MEASUREMENT=de_AT.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
$ cat /etc/locale.conf
LANG=en_US.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
$ localectl
System Locale: LANG=en_US.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
VC Keymap: de
X11 Layout: de
X11 Model: pc105
$ grep -v "^#" /etc/locale.gen
de_DE.UTF-8 UTF-8
en_US.UTF-8 UTF-8
xterm still giving the error:
Warning: locale not supported by C library, locale unchanged
gnome-terminal
still wont start
didn’t chnage the format and didn’t fix the issue.
Adding the missing languange
adding de_AT
If I also add de_AT it works
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=de_AT.UTF-8
LC_TIME=de_AT.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=de_AT.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=de_AT.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_AT.UTF-8
LC_TELEPHONE=de_AT.UTF-8
LC_MEASUREMENT=de_AT.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=
$ localectl
System Locale: LANG=en_US.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
VC Keymap: de
X11 Layout: de
X11 Model: pc105
$ cat /etc/locale.conf
LANG=en_US.UTF-8
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_MONETARY=de_DE.UTF-8
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
$ grep -v "^#" /etc/locale.gen
de_AT.UTF-8 UTF-8
de_DE.UTF-8 UTF-8
en_US.UTF-8 UTF-8
xterm
gives no error and gnome-terminal
opens normally.
solves the errors.
This is how it is intended to be configured: If a language is used, it must be enabled in locale.gen
. Question is though, why and where is it enabled in first place
The source of the issue
I tried to search for de_AT and found it in some places:
investigating further where de_AT comes from
# grep -rI "=de_AT.UTF-8" ~
~/.local/share/containers/storage/overlay/{id}/diff/etc/locale.conf:LANG=de_AT.UTF-8
~/.local/share/containers/storage/overlay-containers/{id]/userdata/{id]/exec-process-{id}:
{...,
"LANG=en_US.UTF-8",
"LC_TELEPHONE=de_AT.UTF-8",
"LC_PAPER=de_AT.UTF-8",
"LC_NAME=de_AT.UTF-8",
"LC_IDENTIFICATION=de_AT.UTF-8",
"LC_MEASUREMENT=de_AT.UTF-8",
"LC_ADDRESS=de_AT.UTF-8",
"LC_MONETARY=de_AT.UTF-8",
"LC_NUMERIC=de_AT.UTF-8",
"LC_TIME=de_AT.UTF-8",...
}
As per my understanding, those containers got this data from the host, but there should be no upstream effect on the host.
# grep -rI "=de_AT.UTF-8" /etc
There is no configuration in /etc or ~/ pointing towards de_AT
Some processes have been started with LC_*=de_AT.UTF-8
# ps eww $(pgrep PROCESS_NAME) | grep 'de_AT'
7633 tty2 Sl+ 0:00 /usr/lib/gnome-session-binary ...
18467 pts/0 Ss 0:02 zsh ...
18476 pts/0 S 0:00 zsh
18854 pts/0 S 0:00 zsh
18855 pts/0 S 0:00 zsh
18857 pts/0 Sl 0:00 /usr/share/zsh-theme-powerlevel10k/gitstatus/usrbin/gitstatusd
19149 pts/2 Ss+ 0:00 zsh
19160 pts/2 S 0:00 zsh
19538 pts/2 S 0:00 zsh
19539 pts/2 S 0:00 zsh
19541 pts/2 Sl 0:00 /usr/share/zsh-theme-powerlevel10k/gitstatus/usrbin/gitstatusd
The setting is originating from /usr/bin/gnome-session
, whichs shows that Gnome is setting the region:
/usr/bin/gnome-session
#cat /usr/bin/gnome-session
#!/bin/sh
if [ "x$XDG_SESSION_TYPE" = "xwayland" ] &&
[ "x$XDG_SESSION_CLASS" != "xgreeter" ] &&
[ -n "$SHELL" ] &&
grep -q "$SHELL" /etc/shells &&
! (echo "$SHELL" | grep -q "false") &&
! (echo "$SHELL" | grep -q "nologin"); then
if [ "$1" != '-l' ]; then
exec bash -c "exec -l '$SHELL' -c '$0 -l $*'"
else
shift
fi
fi
SETTING=$(G_MESSAGES_DEBUG='' gsettings get org.gnome.system.locale region)
REGION=${SETTING#\'}
REGION=${REGION%\'}
if [ -n "$REGION" ]; then
unset LC_TIME LC_NUMERIC LC_MONETARY LC_MEASUREMENT LC_PAPER
if [ "$LANG" != "$REGION" ] ; then
# LC_CTYPE
export LC_NUMERIC=$REGION
export LC_TIME=$REGION
# LC_COLLATE
export LC_MONETARY=$REGION
# LC_MESSAGES
export LC_PAPER=$REGION
# LC_NAME
export LC_ADDRESS=$REGION
export LC_TELEPHONE=$REGION
export LC_MEASUREMENT=$REGION
# LC_IDENTIFICATION
fi
fi
exec /usr/lib/gnome-session-binary "$@"
This is the source of my de_AT problem:
$ gsettings get org.gnome.system.locale region
'de_AT.UTF-8'
After I found this, I also found the proper menu to change this info:
Solution
- Configure Gnome Settings and Manjaro Settings to be consistent
- Clear region info:
gsettings set org.gnome.system.locale region ''
Proposal
Manjaro Settings
Manjaro Settings should take Gnome Settings for the Region into account, when changing language. The languange for the region should always be enabled. Better even to have the region setting in Manjaro Settings too. Maybe also to be discussed why these settings are dubplicated in first place.
Gnome Settings
Not a proposal, just a rant: I don’t know who thought it would be a good idea to have the region inside GNOME settings, which is completly detached from locale
-scripts and config files, thus making it extremly difficult to find it. I don’t understand, why this is not written to /etc/locale.conf in first place, which would make things way simpler. I anyone has a good idea how to bring this to GNOMEs atention, I’m happy to create a report there as well.
Summary
I hope this get’s fixed, so that the UX is consistent and users don’t run into completly random situations like I did. Also I hope this write up will be indexed and found by people. The usual links don’t help, because it’s technically not a locale
issue, but GNOME doing dark wizardry.