[OE-core] [PATCH] systemd-conf: add timesyncd.conf

Cengiz Can cengiz at kernel.wtf
Tue Nov 26 13:39:43 UTC 2019


Currently OE-Core's systemd-timesyncd defaults to Google's time servers.

However those servers are not always reachable.

```
systemd-timesyncd[242]:
  Timed out waiting for reply from 216.239.35.12:123 (time4.google.com).
systemd-timesyncd[242]:
  Timed out waiting for reply from 216.239.35.0:123 (time1.google.com).
systemd-timesyncd[242]:
  Timed out waiting for reply from 216.239.35.4:123 (time2.google.com).
systemd-timesyncd[242]:
  Timed out waiting for reply from 216.239.35.8:123 (time3.google.com).
systemd-timesyncd[242]:
  Timed out waiting for reply from 216.239.35.12:123 (time4.google.com).
```

Even if they are, it is much more sensible to use pool servers from
ntp.org.

This patch adds a default timesyncd.conf with Google's time servers
moved to Fallback and pool.ntp.org as primary time servers.

Signed-off-by: Cengiz Can <cengiz at kernel.wtf>
---
 .../systemd/systemd-conf/timesyncd.conf         | 17 +++++++++++++++++
 meta/recipes-core/systemd/systemd-conf_243.bb   |  3 +++
 2 files changed, 20 insertions(+)
 create mode 100644 meta/recipes-core/systemd/systemd-conf/timesyncd.conf

diff --git a/meta/recipes-core/systemd/systemd-conf/timesyncd.conf b/meta/recipes-core/systemd/systemd-conf/timesyncd.conf
new file mode 100644
index 0000000000..84fdc354b8
--- /dev/null
+++ b/meta/recipes-core/systemd/systemd-conf/timesyncd.conf
@@ -0,0 +1,17 @@
+#  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.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org 3.pool.ntp.org
+FallbackNTP=time1.google.com time2.google.com time3.google.com time4.google.com
+
diff --git a/meta/recipes-core/systemd/systemd-conf_243.bb b/meta/recipes-core/systemd/systemd-conf_243.bb
index d9ec023bfd..238bca9373 100644
--- a/meta/recipes-core/systemd/systemd-conf_243.bb
+++ b/meta/recipes-core/systemd/systemd-conf_243.bb
@@ -11,6 +11,7 @@ SRC_URI = "\
     file://system.conf \
     file://system.conf-qemuall \
     file://wired.network \
+    file://timesyncd.conf \
 "
 
 do_install() {
@@ -18,6 +19,7 @@ do_install() {
 	install -D -m0644 ${WORKDIR}/logind.conf ${D}${systemd_unitdir}/logind.conf.d/00-${PN}.conf
 	install -D -m0644 ${WORKDIR}/system.conf ${D}${systemd_unitdir}/system.conf.d/00-${PN}.conf
 	install -D -m0644 ${WORKDIR}/wired.network ${D}${systemd_unitdir}/network/80-wired.network
+	install -D -m0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/timesyncd.conf
 }
 
 # Based on change from YP bug 8141, OE commit 5196d7bacaef1076c361adaa2867be31759c1b52
@@ -35,4 +37,5 @@ FILES_${PN} = "\
     ${systemd_unitdir}/logind.conf.d/ \
     ${systemd_unitdir}/system.conf.d/ \
     ${systemd_unitdir}/network/ \
+    ${sysconfdir}/systemd/timesyncd.conf \
 "
-- 
2.24.0



More information about the Openembedded-core mailing list