ksaitoの日記

日々試したことの覚え書き

ubuntu 16.04のtimezone設定

移転しました。

自動的にリダイレクトします。

今までは、下記でtimezoneが設定できました。

# echo "Asia/Tokyo" > /etc/timezone
# dpkg-reconfigure --frontend noninteractive tzdata

Ubuntu 16.04では、このやり方は出来ませんでした。

# grep "VERSION=" /etc/os-release 
VERSION="16.04.1 LTS (Xenial Xerus)"
# cat /etc/timezone; file /etc/localtime 
Etc/UTC
/etc/localtime: symbolic link to /usr/share/zoneinfo/Etc/UTC
# echo "Asia/Tokyo" > /etc/timezone
# cat /etc/timezone; file /etc/localtime 
Asia/Tokyo
/etc/localtime: symbolic link to /usr/share/zoneinfo/Etc/UTC
# dpkg-reconfigure --frontend noninteractive tzdata

Current default time zone: 'Etc/UTC'
Local time is now:      Sun Sep  4 13:55:59 UTC 2016.
Universal Time is now:  Sun Sep  4 13:55:59 UTC 2016.

# cat /etc/timezone; file /etc/localtime 
Etc/UTC
/etc/localtime: symbolic link to /usr/share/zoneinfo/Etc/UTC
# 

以前は、/etc/timezoneに従って/etc/localtimeを返納してくれましたが/etc/localtimeの内容で/etc/timezoneが書き換えられてしまっているようです。 とりあえず、dpkg-reconfigure tzdataで手動で選択するしかないか...

timedatectlコマンドというので操作する見たいです。

# timedatectl set-timezone `timedatectl list-timezones | grep Tokyo`
# timedatectl 
      Local time: Sun 2016-09-04 23:11:36 JST
  Universal time: Sun 2016-09-04 14:11:36 UTC
        RTC time: Fri 2016-08-12 04:15:46
       Time zone: Asia/Tokyo (JST, +0900)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no
#