RaspberryPiでNTPdが同期されていません。

RaspberryPiでNTPdが同期されていません。

私のハードウェア(RasberryPi)にはハードウェアクロックがなく、すべてのブートが1970年代に戻るため、NTPを使用してください。私のネットワークのゲートウェイはNTPサーバーサービスを提供します。

私は/etc/ntp.conf次のようになります(コメント行は省略)

server 192.168.170.254 //gateway that hosts the service
driftfile /var/lib/ntp/ntp.drift

/etc/profile:

[connect wifi...]
timeout 15 ntpd -q -g //forces update so I have a time to work with, times out so I don't get a total hang if it doesn't work
systemctl start ntpd.service //in hopes that I will work at some point and to keep it in sync
date //see if it worked
[start main program...]

私は何を逃したことがありませんか?

編集する
出力ntpd -q

DEC 31 17:00:43 alarmpi ntpd[349]: ntpd [email protected] Wed Jul  2 03:23:39 UTC 2014 (1): Starting
DEC 31 17:00:43 alarmpi ntpd[349]: Command line: /usr/bin/ntpd -q
DEC 31 17:00:43 alarmpi ntpd[349]: proto: precision = 3000 usec (-18)
DEC 31 17:00:43 alarmpi ntpd[349]: Listen and drop on 0 v4wildcard 0.0.0.0:123
DEC 31 17:00:43 alarmpi ntpd[349]: Listen normally on 1 lo 127.0.0.1:123
DEC 31 17:00:43 alarmpi ntpd[349]: Listen normally on 2 wlan0 192.168.170.100:123
DEC 31 17:00:43 alarmpi ntpd[349]: Listening on routing socket on fd #19 for interface updates
#hangs here till interrupted

出力systemctl status ntpd

* ntpd.service - Network Time Service
Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled)
Active: active (running) since Wed 1969-12-31 17:00:43 MST, 16s ago
Process: 332 ExecStart=/usr/bin/ntpd -g -u ntp:ntp -p /run/ntpd.pid (code=exited, status=0/SUCCESS)
Main PID: 335 (ntpd)
CGroup: /system.slice/ntpd.service
        `-335 /usr/bin/ntpd -g -u ntp:ntp -p /run/ntpd.pid

DEC 31 17:00:43 alarmpi ntpd[332]: ntpd [email protected] Wed Jul  2 03:23:39 UTC 2014 (1): Starting
DEC 31 17:00:43 alarmpi ntpd[332]: Command line: /usr/bin/ntpd -g -u ntp:ntp -q /run/ntpd.pid
DEC 31 17:00:43 alarmpi systemd[1]: PID file /run/ntpd.pid not readable (yet?) after start.
DEC 31 17:00:43 alarmpi ntpd[335]: proto: precision = 3000 usec (-18)
DEC 31 17:00:43 alarmpi ntpd[335]: Listen and drop on 0 v4wildcard 0.0.0.0:123
DEC 31 17:00:43 alarmpi ntpd[335]: Listen normally on 1 lo 127.0.0.1:123
DEC 31 17:00:43 alarmpi ntpd[335]: Listen normally on 2 wlan0 192.168.170.100:123
DEC 31 17:00:43 alarmpi ntpd[335]: Listening on routing socket on fd #19 for interface updates
DEC 31 17:00:43 alarmpi systemd[1]: Started Network Time Service

ベストアンサー1

おじさん回答もう一つの質問はこの問題を非常によく解決します。ハードウェアの問題(リアルタイムクロックの不足)により、これは少し難しくなります。

RaspberryPiの欠点を考慮してリアルタイムクロック、最後の時間をディスクに保存するツールを使用し、起動時にそのツールを参照して時計を変更することをお勧めします。Unix時代の始まり

組み合わせの使用システム時刻同期/etc/systemd/timesyncd.confおよび優先タイムサーバーのオプションの構成ファイルシステムネットワーク起動時にネットワークを起動し、時計のドリフトを変更します。できるだけ早く。その後、デーモンはクロックを定期的に(約30分ごとに)同期します。

おすすめ記事