2

I'm confused: what is the right way to change TZ on a freshly installed Solaris 11.2?

I have found these, but am unsure which to use:

  • 1
    The first link, referring to rtc, is not about changing the timezone of the system clock, but the offset between the OS clock and the BIOS clock. – alanc Jun 24 '15 at 4:59
4

To answer your question, use the instructions in the second link, summarized here. This will change the system-wide default timezone for libraries and utilities that print or return the time. It will not affect the actual contents of the real-time clock in the hardware (or virtual machine host infrastructure for a VM). The rtc command is used to configure the actual time stored in the hardware. You need to worry about that if you're going to be frequently rebooting from Solaris into Windows on the same hardware and you need to make sure they both understand the time value that's stored in the hardware realtime lock chip.

In Solaris 11.2 you can use the nlsadm utility to set this.

# date
Tuesday, December 15, 2015 08:54:04 PM UTC
# nlsadm get-timezone
timezone=UTC
# nlsadm list-timezone | grep US/Pacific
US/Pacific
# nlsadm set-timezone US/Pacific
Reading IPS package information ...
Setting SMF property timezone/localtime with value: 'US/Pacific' ...
Successfully set
# date
Tuesday, December 15, 2015 12:54:24 PM PST

You may need to install the nls-administration package using

# pkg install nls-administration

There is a man page for the nlsadm utility which is installed with the binary. Here is a link to the documentation describing the process.

http://docs.oracle.com/cd/E36784_01/html/E39134/gllkr.html

Under the covers, the nlsadm utility will use the svccfg commands described in an earlier answer. And under those covers there is a symlink in /etc for backwards compatibility. That's right, it's just covers all the way down. :-)

|improve this answer|||||
  • 1
    You can also run nlsadm list-timezone to view timezones that you can pick from. – sleepyweasel Jan 4 '17 at 16:26
  • Thanks sleepyweasel, I added that to the example commands. – Chris Quenelle Jan 5 '17 at 23:26
1

You should use TZ=localtime on Solaris 11. It is a symbolic link to actual timezone file, but it allows to switch timezones without restarting processes.

This symlink is created by svc:/system/timezone:default SMF service, so simply update its configuration:

# svccfg -s timezone:default
svc:/system/timezone:default> setprop timezone/localtime = Europe/Moscow
svc:/system/timezone:default> end
# svcadm refresh timezone
|improve this answer|||||
  • thanks for feedback. After completing these commands, where can I see the changes, which config files are supposed to be updated with new timezone? Also, date still reports old timezone. – Mark Jun 23 '15 at 13:31
1

nlsadm can also be used to set the timezone, along with other locale specifics such as language and keyboard.

Look for the timezone:

solaris11 [8]# nlsadm list-timezone | grep -i <TIME_ZONE>

Set the timezone:

solaris11 [9]# nlsadm set-timezone <TIME_ZONE>

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.