質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

Q&A

解決済

3回答

3821閲覧

Raspberry Piの時計を合わせたい

rionvel

総合スコア11

Raspberry Pi

Raspberry Piは、ラズベリーパイ財団が開発した、名刺サイズのLinuxコンピュータです。 学校で基本的なコンピュータ科学の教育を促進することを意図しています。

0グッド

1クリップ

投稿2018/07/05 04:41

編集2018/07/09 03:01

Raspberry Piの日付も時間もめちゃくちゃなので合わせたいです。

sudo nano /etc/ntp.confで以下のものを追加

#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 3.debian.pool.ntp.org iburst
上の4行はコメントアウトしています。
pool ntp.nict.jp iburst

sudo service ntp restart
再起動して

ntpq -p
確認すると

remote refid st t when poll reach delay offset jitter

ntp.nict.jp. .POOL. 16 p - 64 0 0.000 0.000 0.001

となって同期ができてないようです。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

y_waiwai

2018/07/05 05:28

OSはなんでしょうか
rionvel

2018/07/05 05:47

raspbianです
guest

回答3

0

rionvelさん、

現在のRaspbian (2018-06-27-raspbian-stretch)では、ntpではなく、systemd-timesyncdというもので、時刻同期されます。

pi@rapberrypi:~ $ systemctl status systemd-timesyncd * systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/systemd-timesyncd.service.d `-disable-with-time-daemon.conf Active: active (running) since Mon 2018-07-09 15:47:03 JST; 24h ago Docs: man:systemd-timesyncd.service(8) Main PID: 255 (systemd-timesyn) Status: "Synchronized to time server 66.228.42.59:123 (2.debian.pool.ntp.org)." CPU: 295ms CGroup: /system.slice/systemd-timesyncd.service `-255 /lib/systemd/systemd-timesyncd Jul 09 15:47:02 raspberrypi systemd[1]: Starting Network Time Synchronization... Jul 09 15:47:03 raspberrypi systemd[1]: Started Network Time Synchronization. Jul 10 00:03:58 raspberrypi systemd-timesyncd[255]: Synchronized to time server 66.228.42.59:123 (2.debian.pool.ntp.org). pi@rapberrypi:~ $

あたらしいRaspbianに載せ替えてしまうのは、どうでしょうか。

投稿2018/07/10 16:01

mt08

総合スコア1825

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

rionvel

2018/07/11 02:47

ありがとうございます。 試してみます。
rionvel

2018/07/12 07:55

$ systemctl status systemd-timeyncdをすると、 Unit systemd-timeyncd.service could not be found.と表示されました。 解決策はありますか? raspbian (Jul 9 2018)です。
can110

2018/07/12 08:05

「s」が抜けています。 ×「systemd-timeyncd」→○「systemd-timesyncd」
rionvel

2018/07/12 08:15

● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendo Drop-In: /lib/systemd/system/systemd-timesyncd.service.d └─disable-with-time-daemon.conf Active: inactive (dead) Condition: start condition failed at Thu 2018-07-12 16:39:00 JST; 31min ago Docs: man:systemd-timesyncd.service(8) lines 1-7/7 (END) Activeのところが引っかかっているようです><
guest

0

ベストアンサー

(コメントとして返信すると、書式がなくなるので、回答に書きます)

rionvelさん、

systemd-timesyncd.serviceが、inactiveとなる件ですが、

ログのメッセージの↓のところ

Drop-In: /lib/systemd/system/systemd-timesyncd.service.d └─disable-with-time-daemon.conf

このファイルをcatしてみると、

pi@rapberrypi:~ $ cat /lib/systemd/system/systemd-timesyncd.service.d/disable-with-time-daemon.conf [Unit] # don't run timesyncd if we have another NTP daemon installed ConditionFileIsExecutable=!/usr/sbin/ntpd ConditionFileIsExecutable=!/usr/sbin/openntpd ConditionFileIsExecutable=!/usr/sbin/chronyd ConditionFileIsExecutable=!/usr/sbin/VBoxService pi@rapberrypi:~ $

don't run timesyncd if we have another NTP daemon installed
ほかのntpデーモンがインストールされてたら、timesyncdを実行しない

となっているので、競合するものがインストールされてませんか?

とりあえず、sudo apt-get autoremove --purge -y ntp をして再起動後、systemd-timesyncd.serviceがアクティブになるか、確認してみてください。

投稿2018/07/12 16:20

mt08

総合スコア1825

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

rionvel

2018/07/18 03:48

● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Drop-In: /lib/systemd/system/systemd-timesyncd.service.d └─disable-with-time-daemon.conf Active: active (running) since Mon 2018-07-16 14:28:35 JST; 1 day 22h ago Docs: man:systemd-timesyncd.service(8) Main PID: 257 (systemd-timesyn) Status: "Idle." CGroup: /system.slice/systemd-timesyncd.service └─257 /lib/systemd/systemd-timesyncd 7月 18 12:34:50 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 13.115.152.207:123 (1.debian.pool.ntp.org). 7月 18 12:35:01 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 122.215.240.52:123 (1.debian.pool.ntp.org). 7月 18 12:35:11 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 202.181.103.212:123 (2.debian.pool.ntp.org). 7月 18 12:35:21 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 160.16.75.242:123 (2.debian.pool.ntp.org). 7月 18 12:35:31 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 139.162.66.25:123 (2.debian.pool.ntp.org). 7月 18 12:35:42 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 45.76.218.213:123 (2.debian.pool.ntp.org). 7月 18 12:35:52 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 202.181.103.212:123 (3.debian.pool.ntp.org). 7月 18 12:36:02 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 172.105.232.39:123 (3.debian.pool.ntp.org). 7月 18 12:36:12 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 122.215.240.51:123 (3.debian.pool.ntp.org). 7月 18 12:36:23 Rionvel systemd-timesyncd[257]: Timed out waiting for reply from 49.212.186.27:123 (3.debian.pool.ntp.org). 実行するとこうなりました。statusがIdleになっているのが気になるのですが、、、
guest

0

/etc/ntp.conf に追加した以下の4行は、削除するかコメントアウト(行の先頭に # を追加)してください。

server 0.debian.pool.ntp.org iburst

server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst

pool ntp.nict.jp iburst
の行は、/etc/ntp.confに残してください。

/etc/ntp.confを修正した後に、

sudo service ntp restart

で再起動して

ntpq -p
で確認

をしてみてください。

投稿2018/07/05 06:21

coco_bauer

総合スコア6915

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

rionvel

2018/07/09 02:59

返事が遅くなり申し訳ありません。 すでにその4行はコメントアウトしているのですがきちんと動作しません。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問