Solaris Hostname, Time Zone, Locale and Keyboard: sysidcfg, sysconfig and svccfg

Solaris Admin Series, part 12. Previous: Solaris Run Levels and Init States: init 0/S/1/2/3/5/6, shutdown -i vs init vs reboot. Related: part 5, Solaris First-Day Commands (uname -n and friends) and part 9, Solaris Text Editors on a Bare System (for editing the files below). Next up: remote console access with serial console, tip, cu and terminal settings.

The host name, time zone, locale and keyboard layout are the four bits of system identity you set during installation and then forget about, until a server is renamed, moved to another data center, or someone notices every log line is stamped in UTC instead of local time. This is also the area where Solaris 10 and Solaris 11 differ the most for such a simple job: Solaris 10 keeps these settings in flat files under /etc and the sysidcfg answer file, while Solaris 11 moved every one of them into SMF service properties that you change with svccfg or the sysconfig tool. Edit the old files on Solaris 11 and your change silently disappears or never takes effect.

Applies to: both Solaris 10 and Solaris 11 (11.4), SPARC and x86. Each section shows the Solaris 10 method first and the Solaris 11 method second. On Solaris 11, root is a role, so run the commands after su - or with pfexec/sudo.

Prerequisites

  • Root, the root role, or a rights profile that allows svccfg/svcadm on the services below (on Solaris 11, the System Configuration or Service Management profiles).
  • Console access (ILOM, serial console or LDoms console) if you plan to use sys-unconfig or sysconfig, because both take the system down and ask questions on the console.
  • A maintenance window for a host name change: applications, certificates, Kerberos keytabs, NFS exports, cluster membership and monitoring often have the old name baked in.
  • Basic SMF knowledge from part 11, Solaris Run Levels and Init States. SMF gets its own detailed posts later in the series.

Where the settings live: Solaris 10 vs Solaris 11

SettingSolaris 10Solaris 11 (11.4)
Host name (node name)/etc/nodename, plus /etc/hostname.<interface> and /etc/inet/hostsSMF svc:/system/identity:node, property config/nodename; hostname command is persistent
Time zoneTZ= line in /etc/default/init (/etc/TIMEZONE is a symlink to it)SMF svc:/system/timezone:default, property timezone/localtime
System localeLANG= / LC_* lines in /etc/default/init; install locales with localeadmSMF svc:/system/environment:init, properties environment/LANG, environment/LC_*; install locales with pkg facets
Keyboard layoutkbd -s; on x86 kept in the keyboard-layout boot propertySMF svc:/system/keymap:default, property keymap/layout; kbd -s updates it
Answer file at install / reconfiguration/etc/sysidcfg (JumpStart, sys-unconfig)System Configuration (SC) profile XML (Automated Installer, sysconfig)
Interactive re-run of the identity questionssys-unconfig then rebootsysconfig configure (optionally -g group)

On Solaris 11, /etc/default/init still exists, but its TZ and LANG lines are generated from the SMF properties at boot. Treat it as read-only output.

Setting the host name

Solaris 10

The node name comes from /etc/nodename at boot. Each statically configured interface has a /etc/hostname.<interface> file whose first word is the host name (or address) brought up on that interface, and that name must resolve through /etc/inet/hosts (/etc/hosts is a symlink to it). A permanent rename touches all three:

# cat /etc/nodename
sol10a
# ls /etc/hostname.*
/etc/hostname.e1000g0
# cat /etc/hostname.e1000g0
sol10a
# grep sol10a /etc/inet/hosts
192.168.10.21   sol10a  loghost

# cp -p /etc/nodename /etc/nodename.orig
# cp -p /etc/inet/hosts /etc/inet/hosts.orig
# echo sol10b > /etc/nodename
# echo sol10b > /etc/hostname.e1000g0
# vi /etc/inet/hosts                 # change sol10a to sol10b on the 192.168.10.21 line

Older Solaris 10 releases (before 8/07) also kept a copy in /etc/inet/ipnodes; update it if it still holds the name. The transport files /etc/net/ticlts/hosts, /etc/net/ticots/hosts and /etc/net/ticotsord/hosts contain the node name too, and fixing them avoids odd RPC loopback errors. Then set the running name and reboot so every service picks it up:

# for f in /etc/net/ticlts/hosts /etc/net/ticots/hosts /etc/net/ticotsord/hosts; do
>   sed 's/sol10a/sol10b/g' $f > $f.new && mv $f.new $f
> done
# hostname sol10b                    # running node name only, lost at reboot
# init 6

hostname newname (or uname -S newname) on Solaris 10 only changes the running kernel node name. It is handy for testing but not persistent. If the interface uses DHCP (/etc/dhcp.e1000g0), the node name in /etc/nodename still wins unless the DHCP client is told to request a host name.

Solaris 11 (11.4)

Solaris 11 stores the node name in the config/nodename property of svc:/system/identity:node. There is no /etc/nodename and no /etc/hostname.* files; interfaces are configured with ipadm. Since Solaris 11.2 the hostname command writes the SMF property for you, so the change is persistent:

# hostname
sol11a
# svcprop -p config/nodename svc:/system/identity:node
sol11a
# hostname sol11b
# svcprop -p config/nodename svc:/system/identity:node
sol11b
# uname -n
sol11b

The equivalent explicit SMF method, useful in scripts and on releases where you want to be certain, is:

# svccfg -s svc:/system/identity:node setprop config/nodename = astring: sol11b
# svcadm refresh svc:/system/identity:node
# svcadm restart svc:/system/identity:node

Neither method edits /etc/inet/hosts. By default Solaris 11 maps the node name to the loopback addresses there, so fix that file by hand and add the real address if you rely on local resolution:

# grep -v '^#' /etc/inet/hosts
::1             sol11a localhost
127.0.0.1       sol11a localhost loghost
192.168.10.31   sol11a.example.com sol11a

# vi /etc/inet/hosts                 # replace sol11a with sol11b on all three lines

A reboot is not required, but running daemons (sendmail, syslog, rpcbind clients, applications) may have cached the old name. Restart what matters, or reboot in the maintenance window to be sure.

Setting the time zone

Valid zone names are the files under /usr/share/lib/zoneinfo on both releases, for example US/Central, America/Chicago, Europe/London or UTC. Check the name before using it, because a typo silently falls back to GMT.

$ ls /usr/share/lib/zoneinfo/America/Chicago
/usr/share/lib/zoneinfo/America/Chicago
$ TZ=America/Chicago date
Tue Nov 10 14:30:12 CST 2026

Solaris 10

# grep '^TZ' /etc/default/init
TZ=US/Pacific
# cp -p /etc/default/init /etc/default/init.orig
# sed 's|^TZ=.*|TZ=America/Chicago|' /etc/default/init.orig > /etc/default/init
# grep '^TZ' /etc/default/init
TZ=America/Chicago

init reads this file at boot and passes TZ to every process it starts, so the change only applies to processes started afterwards. Log in again for your shell, restart cron (svcadm restart cron) and syslog (svcadm restart system-log) at minimum, or simply reboot. Keep the file’s owner and mode intact (root:sys 644); the sed into the original path above does that.

Solaris 11 (11.4)

# svcprop -p timezone/localtime svc:/system/timezone:default
US/Pacific
# svccfg -s svc:/system/timezone:default setprop timezone/localtime = astring: America/Chicago
# svcadm refresh svc:/system/timezone:default
# svcprop -p timezone/localtime svc:/system/timezone:default
America/Chicago

As on Solaris 10, already-running processes keep the old TZ until they restart. Reboot or restart cron, system-log and your applications.

x86 hardware clock

On x86, Solaris keeps the real-time clock in local time by default and records which zone the RTC uses in /etc/rtc_config. After a time zone change, update it so the clock is not off by hours at the next boot. If the machine dual-boots or you want the RTC in UTC, set it to UTC. SPARC systems keep their clock in UTC and do not use rtc.

# rtc -z America/Chicago          # tell the RTC which zone it is in
# rtc -c                          # check/adjust for daylight saving time
# cat /etc/rtc_config

Setting the system locale

The system default locale is what services and logins get unless a user sets their own LANG/LC_*. Check what is installed first; you cannot select a locale that is not on the system.

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
...
LC_ALL=
$ locale -a | grep -i en_US
en_US.ISO8859-1
en_US.ISO8859-15
en_US.UTF-8

Solaris 10

Set LANG (and optionally individual LC_* categories) in /etc/default/init, the same file as the time zone, then reboot. Add or list locale packages with localeadm:

# grep -E '^(LANG|LC_)' /etc/default/init
LANG=C
# vi /etc/default/init               # set LANG=en_US.UTF-8
# localeadm -l                       # list installed locale regions
# localeadm -q de_DE.UTF-8           # is it installed?
# localeadm -a de -d /cdrom/cdrom0   # add the German region from install media

Solaris 11 (11.4)

The default lives in svc:/system/environment:init. Set it with svccfg and refresh the service:

# svcprop -p environment svc:/system/environment:init
environment/LANG astring en_US.UTF-8
# svccfg -s svc:/system/environment:init setprop environment/LANG = astring: de_DE.UTF-8
# svcadm refresh svc:/system/environment:init
# svcprop -p environment/LANG svc:/system/environment:init
de_DE.UTF-8

To set one category only, for example to keep English messages but use metric/European formats, add environment/LC_TIME or similar properties the same way. Locales on Solaris 11 are installed through IPS facets. A default install delivers only a few languages; enable more with pkg change-facet (this is a package operation and may create a new boot environment depending on what changes):

$ pkg facet -a | grep 'locale.de'
facet.locale.de              False  system
facet.locale.de_DE           False  system
# pkg change-facet facet.locale.de=True facet.locale.de_DE=True
# locale -a | grep de_DE
de_DE.ISO8859-1
de_DE.ISO8859-15
de_DE.UTF-8

Some less common locales are delivered by the system/locale/extra package rather than by facets; pkg search -r for the locale name if a facet change does not bring it in.

Setting the keyboard layout

The keyboard layout matters only on the physical or virtual console (a local keyboard, ILOM remote console, or VM console). SSH sessions use the client’s keyboard.

# kbd -t                    # keyboard type, e.g. USB keyboard
USB keyboard
# kbd -l                    # type, layout code and repeat settings
type=6
layout=33 (0x21)
delay(ms)=500
rate(ms)=40

Solaris 10

kbd -s without an argument lists the available layouts and prompts for a number; with a name it sets that layout directly. On x86 the choice is stored as the keyboard-layout boot property so it survives a reboot. On SPARC, Sun Type 5/6/7 keyboards report their layout to OpenBoot, and USB keyboards use the OBP keyboard-layout variable when the keyboard does not report one.

# kbd -s                    # interactive list of layouts
# kbd -s German             # set directly
# eeprom keyboard-layout     # x86: the persistent setting

Solaris 11 (11.4)

# svcprop -p keymap/layout svc:/system/keymap:default
US-English
# svccfg -s svc:/system/keymap:default setprop keymap/layout = German
# svcadm refresh svc:/system/keymap:default
# svcadm restart svc:/system/keymap:default

kbd -s German also works on Solaris 11 and updates the SMF property for you.

Setting it all at once: sysidcfg and sysconfig

Solaris 10: sysidcfg and sys-unconfig

sysidcfg answers the identity questions during a JumpStart or interactive install, and again after sys-unconfig. A minimal file covering this post’s settings looks like this (put it in /etc/sysidcfg before running sys-unconfig, or in the JumpStart profile directory):

system_locale=en_US.UTF-8
timezone=America/Chicago
terminal=vt100
keyboard=US-English
timeserver=localhost
network_interface=e1000g0 {primary hostname=sol10b
                           ip_address=192.168.10.21
                           netmask=255.255.255.0
                           protocol_ipv6=no
                           default_route=192.168.10.1}
name_service=NONE
nfs4_domain=dynamic
security_policy=NONE
root_password=<encrypted hash from /etc/shadow>

The keyboard keyword is only recognized on later Solaris 10 updates; on older ones leave it out and answer the keyboard prompt on the console. sys-unconfig wipes the host name, network, name service, time zone and root password and halts the system; on the next boot the sysid tools read /etc/sysidcfg and ask on the console for anything missing. It is far more disruptive than the targeted edits above, so use it to re-image an identity, not to fix one setting.

# cp sysidcfg.sol10b /etc/sysidcfg
# sys-unconfig
WARNING
This program will unconfigure your system.  It will cause it
to revert to a "blank" system - it will not have a name or know
about other systems or networks.
...
Do you want to continue (y/n) ? y

Solaris 11 (11.4): sysconfig and SC profiles

Solaris 11 replaced sysidcfg and sys-unconfig with sysconfig and XML System Configuration (SC) profiles. You can re-run the interactive System Configuration Interactive (SCI) tool for everything, or for a single functional group, and you can generate a profile to reuse on other systems or in the Automated Installer:

# sysconfig configure -s                 # full interactive SCI tool, reboots/reconfigures
# sysconfig configure -g location        # only time zone and locale questions
# sysconfig create-profile -o /var/tmp/sc_sol11b.xml   # answer prompts, write a profile, change nothing
# sysconfig configure -c /var/tmp/sc_sol11b.xml        # apply a saved profile

The relevant parts of an SC profile map one-to-one onto the SMF properties used above:

<service name="system/identity" version="1">
  <instance name="node" enabled="true">
    <property_group name="config">
      <propval name="nodename" value="sol11b"/>
    </property_group>
  </instance>
</service>
<service name="system/timezone" version="1">
  <instance name="default" enabled="true">
    <property_group name="timezone">
      <propval name="localtime" value="America/Chicago"/>
    </property_group>
  </instance>
</service>
<service name="system/environment" version="1">
  <instance name="init" enabled="true">
    <property_group name="environment">
      <propval name="LANG" value="en_US.UTF-8"/>
    </property_group>
  </instance>
</service>
<service name="system/keymap" version="1">
  <instance name="default" enabled="true">
    <property_group name="keymap">
      <propval name="layout" value="US-English"/>
    </property_group>
  </instance>
</service>

Run sysconfig create-profile rather than hand-writing the whole file: it produces valid XML including the encrypted root and user passwords. sysconfig unconfigure without a group is the Solaris 11 equivalent of sys-unconfig and is just as disruptive.

Zones

  • Each non-global zone has its own node name, time zone and locale. Set them inside the zone with the same commands (Solaris 10 files or Solaris 11 SMF properties). A zone cannot change the system clock or the keyboard layout; those belong to the global zone.
  • Solaris 10 zones get their identity on first boot from /zones/<zone>/root/etc/sysidcfg if you place one there before booting, otherwise you answer the questions on zlogin -C.
  • Solaris 11 zones take an SC profile at install time: zoneadm -z appzone1 install -c /var/tmp/sc_appzone1.xml. Without one, the SCI tool runs on the zone console at first boot.
  • Zones get their own posts in the zones section of the series.

Verification

$ hostname; uname -n
$ getent hosts $(hostname)           # name resolves to the right address
$ date; echo $TZ
$ locale
$ kbd -l                             # console only

# Solaris 10
$ cat /etc/nodename; egrep '^(TZ|LANG|LC_)' /etc/default/init

# Solaris 11
$ svcprop -p config/nodename svc:/system/identity:node
$ svcprop -p timezone/localtime svc:/system/timezone:default
$ svcprop -p environment svc:/system/environment:init
$ svcprop -p keymap/layout svc:/system/keymap:default
$ svcs -x                            # nothing should be in maintenance

Log in fresh (a new SSH session) to check TZ and locale: your existing shell still carries the old environment.

Troubleshooting and gotchas

  • Edited /etc/default/init or created /etc/nodename on Solaris 11 and nothing changed. Those files are not the source of truth there. Use the SMF properties; the files are regenerated from them.
  • Time zone typo means GMT. If the name does not match a file under /usr/share/lib/zoneinfo, programs fall back to GMT with no error. Test with TZ=Name date first.
  • Cron jobs still run at the old times. cron read TZ when it started. svcadm restart cron (and restart applications) or reboot.
  • Clock jumps by hours after reboot on x86. The RTC zone in /etc/rtc_config does not match. Run rtc -z with the right zone, then set the time (NTP gets its own post).
  • couldn't set locale correctly or setlocale warnings at login. The requested locale is not installed, often because an SSH client forwards its own LANG/LC_*. Install the locale (facet or localeadm) or stop the client from sending it.
  • Host name change broke something. Typical casualties: Oracle listener and oratab host entries, TLS certificates, Kerberos host principals and keytabs (see the Kerberos client post for the same concept on Linux), NFS export ACLs, sendmail, cluster node names, LDoms and ILOM inventory, and backup clients. Search configs with grep -rl oldname /etc /opt 2>/dev/null before and after.
  • Solaris 10: interface came up with the wrong name. /etc/hostname.<interface> still holds the old name or the name is missing from /etc/inet/hosts. The boot messages show ifconfig: ... bad address.
  • Solaris 10 hostname was “lost”. It is not persistent there; only the files are.
  • Locale facets and boot environments. pkg change-facet can create a new boot environment if it touches packages that need one; check the output and beadm list.
  • Keyboard still wrong on the ILOM remote console. The redirection client may translate keys itself. Set the layout in the client too, or use the serial console.

What’s next in the Solaris Admin Series

Next up is remote console access: serial console, tip, cu and terminal settings (TERM, stty). Catch up with part 11, Solaris Run Levels and Init States, part 10, Solaris Process Management, part 9, Solaris Text Editors on a Bare System, part 6, Solaris Shells, part 5, Solaris First-Day Commands, and part 3, Solaris Filesystem Layout Tour. Networking with ifconfig vs ipadm/dladm, SMF, zones and the Automated Installer all get their own detailed posts later in the series.

Official references: hostname(1), nodename(5), hosts(5), init(5) (default/init), svccfg(8), svcprop(1), sysconfig(8), kbd(1), rtc(8), locale(1), pkg(1) and environ(7) in the Oracle Solaris 11.4 Reference Library, Managing System Information, Processes, and Performance and Installing Oracle Solaris 11.4 Systems (SC profiles) in the Oracle Solaris 11.4 documentation, and sysidcfg(4), sys-unconfig(1M), localeadm(1M) and the Installation Guide: Network-Based Installations in the Oracle Solaris 10 1/13 Information Library.

Leave a Reply

Your email address will not be published. Required fields are marked *