Skip to main content
Topic: [patch] SDDM starts in wrong locale, correct one after restart (Read 690 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

[patch] SDDM starts in wrong locale, correct one after restart

Hi all!

SDDM always starts in English, no matter what I do (my locale is German, de_DE.UTF-8). This does not affect the keyboard layout, only the displayed text. I set the keyboard layout via DisplayCommand=/etc/sddm/scripts/Xsetup in /etc/sddm.conf and setxkbmap de in /etc/sddm/scripts/Xsetup.

After some investigation and searching bug reports, forum posts etc., I tried different thigs. E.g. exporting the locale in /etc/sddm/scripts/Xsetup, or setting it in /etc/default/locale. No matter what, SDDM always starts up in English.

I however noticed that if I restart it manually, also directly after booting, the locale is set correctly, and SDDM displays German texts. I investigated a bit more. I tried to delay the SDDM start to see if some service sets something too late (via manual dependencies in OpenRC's /etc/rc.conf). No matter what: Always English. Even if I started SDDM as the very last service via /etc/local.d/local.start.

But apparently, it's not the restarting that fixes it: If I remove SDDM from the default runlevel, login as root and start it manually, it also starts up in German. So I think it's a real shell that fixes it (as restarting it after booting also involves starting a real shell). Maybe, some environment variables aren't set without starting a shell session, and thus, SDDM falls back to the C locale if it's started via it's init script?

I come from Gentoo, where this doesn't happen (SDDM shows up in my system's locale). But I can't find the difference … on both systems, SDDM has a dedicated user with /var/lib/sddm as home. On Gentoo, the login shell is /sbin/nologin, on Artix, it's /bin/nologin. The home directoy looks identical (except for the .keep_acct-user_sddm-0 file that Gentoo sets, but this has nothing to do with the locale).

So: Is this a bug or a feature?! ;-) Can I configure SDDM to show up in my system's locale? And if so: how? And if not: How can this be fixed?

Thanks for all help!

Re: SDDM starts in wrong locale, correct one after restart

Reply #1
/etc/locale.conf
??

Quote
  GNU nano 6.3                    /etc/locale.conf                             
LANG=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8
Cat Herders of Linux

Re: SDDM starts in wrong locale, correct one after restart

Reply #2
Okay, after some additional investigation, I found a bugfix/workaround:

Gentoo starts SDDM a bit more complicated. There's an init script /etc/init.d/display-manager, which can start different display managers (SDDM, LightDM, xdm etc.). At one point, it calls /usr/bin/startDM, which sources /etc/profile.env. This is a file containing all kinds of environment variables which is not present on Artix; but it contains export LANG='de_DE.utf8' on my Gentoo machine.

My (Artix) /etc/locale.conf contains export LANG="de_DE.utf8". So I tried to source this file from within the SDDM init script. Et voilà: SDDM starts in German :-)

The following patch made it work:
Code: [Select]
--- sddm.orig   2022-07-27 13:31:20.221902730 +0200
+++ sddm        2022-07-27 13:23:28.341797921 +0200
@@ -3,6 +3,8 @@
 supervisor=supervise-daemon
 command="/usr/bin/sddm"
 
+. /etc/locale.conf
+
 depend() {
     need localmount
One could also add a check to make it fail-proof via e.g.
Code: [Select]
[ -e /etc/locale.conf ] && . /etc/locale.conf
or such.

Maybe you want to fix this?

Re: [patch] SDDM starts in wrong locale, correct one after restart

Reply #3
I don't think this should be downstream's job. I mean, sddm should check itself the existence of /etc/locale.conf (which is pretty standard location even for systemd distros) and source it. Otherwise, we'd have to change the service files for 4 different inits just to fix an upstream "bug", no matter how trivial the fix. Question: have you tried putting LANG in /etc/environment?

 

Re: [patch] SDDM starts in wrong locale, correct one after restart

Reply #4
Adding the LANG setting to /etc/environment has the same effect. I didn't find anything about this whilst searching for solutions though …

You may be right that this should be fixed upstream. I filed a bug report about this: https://github.com/sddm/sddm/issues/1570

Anyway, I think one should document this /etc/environment workaround somewhere. I think this actually is a workaround, as it's not convenient having to add the same setting to two config files (is this really supposed to be handled like this?).

Let's see if they fix this. At least, maybe the Google bot will index this so that others can find this patch/fix/workaround.