BEIKE blog

備忘録です

raspiインターネット時刻合わせ

ファイルの編集を行う。

sudo vim /etc/systemd/timesyncd.conf

なぜか、ntp.nict.jpだと上手く行かなかったで、pool.ntp.orgを選択した。

#  This file is part of systemd.
# 
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See timesyncd.conf(5) for details.

[Time]
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.jp.pool.ntp.org

修正内容を反映し、サービスを再起動。

sudo systemctl daemon-reload
sudo timedatectl set-ntp true
sudo systemctl restart systemd-timesyncd.service

こんな感じのログが出てくれば大丈夫そう。

ubuntu@ubuntu:~(17:54:19)$ sudo systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2022-02-19 17:53:05 JST; 1min 16s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 1935 (systemd-timesyn)
   Status: "Connecting to time server 129.250.35.251:123 (pool.ntp.org)."
    Tasks: 2 (limit: 4442)
   CGroup: /system.slice/systemd-timesyncd.service
           └─1935 /lib/systemd/systemd-timesyncd

 2月 19 17:53:05 ubuntu systemd[1]: Starting Network Time Synchronization...
 2月 19 17:53:05 ubuntu systemd[1]: Started Network Time Synchronization.
 3月 06 14:03:56 ubuntu systemd-timesyncd[18103]: Synchronized to time server 129.250.35.250:123 (2.arch.pool.ntp.org).