Ubuntu/Raspberry Pi/Debianの時刻ずれを解消する
$ sudo apt updateGet:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]Get:2 http://archive.raspberrypi.org/debian buster InRelease [32.9 kB]Reading package lists... DoneE: Release file for http://raspbian.raspberrypi.org/raspbian/dists/buster/InRelease is not valid yet (invalid for another 27d 15h 31min 39s). Updates for this repository will not be applied.E: Release file for http://archive.raspberrypi.org/debian/dists/buster/InRelease is not valid yet (invalid for another 26d 5h 35min 24s). Updates for this repository will not be applied.
こういうエラーが出ることがある(ログはRaspberry Pi OS)。
sudo timedatectl set-timezone Asia/Tokyosudo date --set 2021-04-04sudo date --set 06:00
まずは手動でタイムゾーンと時刻を合わせる(だいたいでOK)。
これでaptが実行できるようになるので、Chronyを導入する。
sudo apt updatesudo apt install chrony
/etc/chrony/chrony.conf
を開く。
NTP DoS対策でポートがふさがれていて、組織のNTPサーバが提供されている場合、 このようにNTPサーバを設定してあげればOK。
# pool 2.debian.pool.ntp.org iburstpool your.ntp.server.example iburst
chronyを再起動。
sudo systemctl restart chrony