■Raspberry Pi 4B(Ubuntu 20.04)の時刻設定をする。
6時間ほどずれていたので修正。
$ sudo systemctl status time
Unit time.service could not be found.
labunix@raspi:~$ timedatectl
Local time: 木 2020-09-24 16:17:31 JST
Universal time: 木 2020-09-24 07:17:31 UTC
RTC time: n/a
Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: no
NTP service: active
RTC in local TZ: no
$ sudo timedatectl set-ntp no
$ sudo timedatectl set-time "2020-09-24 22:50:00"
$ sudo timedatectl set-ntp yes
■NTPクライアントの設定をNICT宛に修正
1日経つと5分くらいずれているは、NTPサーバの参照先をFWで制限しているので、デフォルトの海外サーバにはアクセスできないから。
$ grep NTP= /etc/systemd/timesyncd.conf
$ sudo cp /etc/systemd/timesyncd.conf{,.org}
$ sudo diff /etc/systemd/timesyncd.conf{,.org}
20d19
< NTP=ntp.nict.jp
$ sudo systemctl restart systemd-timesyncd
$ sudo systemctl status systemd-timesyncd | cat
● systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-09-26 01:23:22 JST; 4min 4s ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 16343 (systemd-timesyn)
Status: "Initial synchronization to time server 133.243.238.243:123 (ntp.nict.jp)."
Tasks: 2 (limit: 9252)
CGroup: /system.slice/systemd-timesyncd.service
└─16343 /lib/systemd/systemd-timesyncd
9月 26 01:23:21 raspi.myhome.local systemd[1]: Starting Network Time Synchronization...
9月 26 01:23:22 raspi.myhome.local systemd[1]: Started Network Time Synchronization.
9月 26 01:27:08 raspi.myhome.local systemd-timesyncd[16343]: Initial synchronization to time server 133.243.238.243:123 (ntp.nict.jp).