Bug 1357861 - localectl ineffective for regular users
Summary: localectl ineffective for regular users
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 24
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-19 12:28 UTC by Aleksandar Kostadinov
Modified: 2016-07-19 16:59 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-07-19 16:34:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Aleksandar Kostadinov 2016-07-19 12:28:08 UTC
Description of problem:
It appears that doing localectl set-locale as root works globally. Doing as user changes locale settings but the locale after login is still what root has initially set.

I would expect that changes by root would affect whole system and changes by user would affect only the particular user. That means after user sets locale, new shells will use that locale for the particular user. See current behavior:

# localectl set-locale LANG=C.utf8
// now system locale changed to C.utf8
// lets do as a user
$ localectl set-locale LANG=bg_BG.utf8
// then in a new shell
$ locale
LANG=C.utf8
LC_CTYPE="C.utf8"
LC_NUMERIC="C.utf8"
LC_TIME="C.utf8"
LC_COLLATE="C.utf8"
LC_MONETARY="C.utf8"
LC_MESSAGES="C.utf8"
LC_PAPER="C.utf8"
LC_NAME="C.utf8"
LC_ADDRESS="C.utf8"
LC_TELEPHONE="C.utf8"
LC_MEASUREMENT="C.utf8"
LC_IDENTIFICATION="C.utf8"
LC_ALL=
$ localectl
   System Locale: LANG=bg_BG.utf8
       VC Keymap: us
      X11 Layout: us,bg
     X11 Variant: ,phonetic
     X11 Options: grp:alt_shift_toggle

Even worse as root:
# localectl status
   System Locale: LANG=bg_BG.utf8
       VC Keymap: us
      X11 Layout: us,bg
     X11 Variant: ,phonetic
     X11 Options: grp:alt_shift_toggle


Version-Release number of selected component (if applicable):
systemd-229-8.fc24.x86_64

I'm not even sure if there's any security implication here.

Comment 1 Zbigniew Jędrzejewski-Szmek 2016-07-19 16:34:23 UTC
localectl communicates with systemd-localed which modifies /etc/locale.conf, i.e. the global configuration. It does not dynamically modify the environment of a user, because there's no way to do that. You have to log in again to see the changes. Whether the root or a normal user invokes localectl makes no difference for the result of the command (assuming that the user has sufficient privileges to invoke set-locale). To summarize, localectl set-locale sets the state for all users, but does not influence existing sessions. That's the design and your examples seems to show everything working as designed.

Comment 2 Zbigniew Jędrzejewski-Szmek 2016-07-19 16:59:41 UTC
I also filed https://github.com/systemd/systemd/pull/3754 to maybe clarify things a bit in the man page.


Note You need to log in before you can comment on or make changes to this bug.