Bug 792182

Summary: systemd uses wrong locale
Product: [openSUSE] openSUSE Tumbleweed Reporter: Stefan Seyfried <seife>
Component: BasesystemAssignee: Frederic Crozat <fcrozat>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: fcrozat, Stromeko
Version: 13.1 Milestone 1   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Third Party Developer/Partner Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Stefan Seyfried 2012-11-30 13:48:40 UTC
I have set my locale to german, but root should only use LC_CTYPE:

susi:~ # grep -v ^# /etc/sysconfig/language|grep -v '""'|grep -v ^$
RC_LANG="de_DE.UTF-8"
ROOT_USES_LANG="ctype"
AUTO_DETECT_UTF8="no"

However, systemd-started services use LANG=de_DE.UTF-8:
susi:~ # pidof libvirtd
1216
susi:~ # cat /proc/1216/environ|xargs -0 -n1 echo
ROOTFS_FSTYPE=ext4
ROOTFS_FSCK=0
OLDPWD=/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
vga=0x367
splash=silent
ROOTFS_BLKDEV=/dev/disk/by-label/root-FACTORY
LANG=de_DE.UTF-8
LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf
LIBVIRTD_ARGS=--listen

And thus pollute syslog etc. with german messages.

IMVHO, systemd should respect teh ROOT_USES_LANG setting.
Comment 1 Stefan Seyfried 2012-11-30 13:49:57 UTC
standard root user locale:

susi:~ # locale
LANG=POSIX
LC_CTYPE=de_DE.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"susi:~ # locale
LANG=POSIX
LC_CTYPE=de_DE.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Comment 2 Frederic Crozat 2012-11-30 14:06:25 UTC
I guess enforcing (or not) English for root is debatable :)

systemd doesn't handle ROOT_USE_LANG for now. I'll see what I can do (but of course, patch would be welcome ;)
Comment 3 Frederic Crozat 2012-11-30 17:37:57 UTC
fix will be  available in a few minutes at http://download.opensuse.org/repositories/home:/fcrozat:/branches:/Base:/System/openSUSE_Factory/

please test
Comment 4 Stefan Seyfried 2012-11-30 19:02:40 UTC
Yes, works.
But I think the patch is incomplete (i just checked the sysconfig/language description and /etc/profile.d/lang.sh):
* if ROOT_USES_LANG == yes => behaviour as before the handle-root-uses-lang.patch
* else if ROOT_USES_LANG == ctype => LANG=POSIX, LC_CTYPE=$RC_LANG
  -> this is implemented in handle-root-uses-lang.patch
* else (ROOT_USES_LANG != yes && != ctype) => LANG=POSIX

The default of ROOT_USES_LANG (even if unset) is "no", even though the comment in my /etc/sysconfig/language says the default would be "ctype".

So the missing case in the patch is the "ROOT_USES_LANG != yes".

... and IMHO for system daemons this is also a better default ...
Comment 5 Frederic Crozat 2012-12-03 14:07:53 UTC
I've updated the patch in my repository, please test again, it looks like it is doing the same thing as "before".
Comment 6 Stefan Seyfried 2012-12-05 08:16:47 UTC
Still works for me (with ROOT_USES_LANG=ctype) and the patch looks correct.

Thanks!
Comment 7 Bernhard Wiedemann 2012-12-05 19:00:15 UTC
This is an autogenerated message for OBS integration:
This bug (792182) was mentioned in
https://build.opensuse.org/request/show/144340 Factory / systemd
Comment 8 Frederic Crozat 2013-03-11 16:26:57 UTC
*** Bug 807608 has been marked as a duplicate of this bug. ***
Comment 9 Frederic Crozat 2013-03-12 10:52:21 UTC
closing as fixed