On Mon, 22.05.17 19:36, Nikolai Kondrashov (Nikolai.Kondrashov(a)redhat.com) wrote:
On 05/22/2017 04:46 PM, Lennart Poettering wrote:
> On Mon, 22.05.17 14:11, Nikolai Kondrashov (Nikolai.Kondrashov(a)redhat.com) wrote:
> > I'm trying to solve a problem of supplying locale settings to non-shell
> > programs acting as login shells in Fedora and RHEL, as described
> > below.
>
> Which services precisely are running these PAM sessions?
>
> Note that explicitly importing /etc/locale.conf should be entirely
> unnecessary: systemd reads that anyway and adds it to the environment
> of all services it spawns.
>
> I am pretty sure instead of readding this to the env block through PAM
> it should just stay in place anyway, and simply be inherited
> down. Hence, I'd claim that the services setting up the PAM session
> are simply too eager in cleaning up the environment and should be
> fixed to leave LANG= and LC_*= in the environment passed to activates sessions.
>
> > So far it seems the Debian way of doing things will work.
> >
> > Could you please confirm that the format of locale.conf is not going to change
> > in a way incompatible with what pam_env.so expects?
> >
> > The pam_env.so manpage:
> >
> >
http://man7.org/linux/man-pages/man8/pam_env.8.html
> >
> > The locale.conf manpage:
> >
> >
https://www.freedesktop.org/software/systemd/man/locale.conf.html
> >
> > Also, am I missing anything? Is there another way systemd can help here?
>
> The syntax described in the man page is unlikely to change. I have no
> idea about the format pam_env expects though.
>
> And I can only recommend fixing the services in question instead of
> taping over the issue with pam_env...
Thanks for your prompt response, Lennart!
I'm talking about logins on console now, so I assume the service in question,
technically, is systemd-logind. However, I found out that it's working OK, and
the real problem is these two pieces in /lib/systemd/system/getty@.service:
# Unset locale for the console getty since the console has problems
# displaying some internationalized messages.
Environment=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_IDENTIFICATION=
and
ExecStart=-/sbin/agetty --noclear %I $TERM
What the first one does is obvious, and the second needs to be modified to
make login preserve the environment. Like this:
ExecStart=-/sbin/agetty -o "-p -- \u" --noclear %I $TERM
Do you think the two pieces above can be changed to let the locale environment
through?
Yes, I think that would make sense to do. Could you file an issue
asking for that on systemd github? (or even better: a PR implementing
it!)