Solaris 11 - Changing systems default locale

Different in Solaris 10 in that you don't just edit TIMEZONE file. LANG is currently set to en_US.UTF-8 and want it to be C.

Heres what I did:-

# svccfg -s svc:/system/environment:init setprop environment/LANG = astring: C
# svcadm refresh svc:/system/environment

And afterwards these are the results I got:-

# svccfg -s svc:/system/environment:init listprop environment/LANG
environment/LANG astring     C
# echo $LANG
en_US.UTF-8

?????

# cat /etc/TIMEZONE
#__GENERATED__V1__
#
# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This file is /etc/default/init.  /etc/TIMEZONE is a symlink to this
# file.
#
# READERS OF THIS FILE: This file is Obsolete.  Migrate to reading
# properties from svc:/system/environment:init.  This file may be
# removed in future releases.
#
# WRITERS OF THIS FILE: This file is no longer user editable.  To
# effect changes to the configuration contained in this file, an
# administrator with the "System Administrator" or "System
# Configuration" Rights Profile may set the corresponding
# properties of the svc:/system/environment:init service
# instance and refresh the instance.
# See init(1M) for further details.
#
# WARNING: CHANGES TO THIS FILE WILL BE OVERWRITTEN BY THE SYSTEM.
#
CMASK=022
TZ=localtime
LANG=C

So its updated file....

Why on earth is echo $LANG still reporting wrong locale? Surely I dont need to reboot server?

Try this:

$ unset LANG
$ unset LC_ALL
$ locale

I wouldn't think that you need to reboot, but you may need to reset the environment variables that define your locale. The above will show you if that is the case. If you only have a couple of terminals open you may be able to do this manually, otherwise you may need to log out and in again.

Andrew

Its Solaris 11 you can't do it this way anymore. Have to use svccfg.

I rebooted the server and it worked fine but documentation seems to imply that you don't need to do this any more.

You are confusing global settings and process settings.

Changing the system locale isn't going to magically change the one currently set in your shell environment. No supported method allows to set a environment variable from the outside. Your shell was rightly keeping the LANG variable value that was set in the first place, before the svccfg.

1 Like

Why change those files in such manner for entire system ?

You need a certain locale for your application / database ?
Create a user to run app / db and change locale for that user, not system wide.

Hope that helps
Regards
Peasant.

2 Likes

Did you actually try my suggestion? I suspect that you didn't; I know that if you had you would have seen the new default locale.

Andrew

All working now after using svccfg and rebooting server.

Locale was wrong and needed changing for entire system.

Maybe a bug, I guess... Had to reboot the system...