[OmniOS-discuss] Set locale in zone
Mark Harrison
mark at omniti.com
Wed Jan 29 19:11:58 UTC 2014
It appears that zlogin also messes with the environment, only in this
case it generates an environment with only a select few variables set
(LOGNAME, HOME, SHELL, MAIL), which leaves LANG unset (and locale uses
the environment to determine the values it prints out), so it looks
like zlogin -C is the only way to verify the locale on a zone.
As for system wide variables, somewhere like /etc/profile would
probably do the trick.
On Wed, Jan 29, 2014 at 1:53 PM, Christian Flaig
<christian.flaig at gmail.com> wrote:
> Thanks for all your help!
>
> I will now separate global zone and non-global zone, easier for me to report
> back.
>
> Global zone
> Eric, thanks, you were right about the global zone, ssh and taking settings
> from ssh client machine. Once I used IPMI to log into the machine, I had
> LANG and all LC_* on "C" again. So that explains why I couldn't find any
> configuration for my locale setting. I changed/added LANG and LC_ALL in
> /etc/default/init. Can't reboot right now, so need to wait for any impact.
>
> Non-global zone
> So I configured /etc/default/init again, like global zone above. Reboot.
> Logged into zone with zlogin, and got all locales on "C" again (ran command
> "locale"). Ran Lauri's command and it showed the wanted locale on LANG and
> LC_ALL.
>
> So I'm confused. "locale" always shows "C" or the setting of my SSH client
> machine, no change whatever I do. Lauri's command shows the right setting.
> And my application running in the zone seems to be happy with the new locale
> too.
>
> Is there a bug or something in locale? I understand that I can set LANG and
> LC_* also as env variables, where would I do that for a system, not only for
> one user?
>
> Thanks for your help.
>
> Regards,
>
> Chris
>
> On 29 Jan 2014, at 16:06, Eric Sproul <esproul at omniti.com> wrote:
>
> On Wed, Jan 29, 2014 at 8:37 AM, Lauri Tirkkonen <lotheac at iki.fi> wrote:
>
> On Wed, Jan 29 2014 12:35:26 +0100, Christian Flaig wrote:
>
> I'm still on r15006, will migrate/re-install soon.
> I've created a new zone, and can't set the locale from "C" to
> "en_GB.UTF-8" for that zone. The global zone has this setting, but I
> haven't found out how to configure it (in non-global zone) or where it
> is configured (global zone).
>
> I've tried the following:
> (1) /etc/default/init
> According to several instructions on the web, this is the place where
> I should put my locale configuration. I can define all the variables,
> but the system doesn't take them (command "locale" still shows "C").
>
>
> This works for me. You probably need to restart the zone for changes to
> take effect though. Tested as follows:
>
> # pargs -e $(pgrep -z kekkonen svc.startd)
> 5193: /lib/svc/bin/svc.startd
> envp[0]: _=*5088*/lib/svc/bin/svc.startd
> envp[1]: LANG=en_US.UTF-8
> envp[2]: LC_TIME=C
> envp[3]: PATH=/usr/sbin:/usr/bin
> envp[4]: PWD=/
> envp[5]: SHLVL=1
> envp[6]: TZ=Europe/Helsinki
> envp[7]: A__z="*SHLVL
>
>
> You should also try to test over a connection that is not ssh, such as
> zlogin from the global zone. OpenSSH clients are frequently
> configured by default to send the client's environment variables to
> the server (this is a feature of the SSH protocol version 2). See the
> "SendEnv" setting in your ssh_config man page. This tripped up
> another of our users recently.
>
> Unfortunately, our ssh daemon ("SunSSH"), having been forked quite a
> long time ago from OpenSSH, does not have the corresponding AcceptEnv
> server-side control, which could be used prevent clients from sending
> certain environment variables if you so choose, so for now you'd need
> to make sure your ssh client doesn't override the server's locale
> environment.
>
> Eric
>
>
>
> _______________________________________________
> OmniOS-discuss mailing list
> OmniOS-discuss at lists.omniti.com
> http://lists.omniti.com/mailman/listinfo/omnios-discuss
>
--
Mark Harrison
Lead Site Reliability Engineer
OmniTI
More information about the OmniOS-discuss
mailing list