diff mbox series

[meta-arago,master/kirkstone] recipes-core: systemd: Fix Date and Time Service

Message ID 20230621111828.448565-1-c-shilwant@ti.com
State Accepted
Delegated to: Ryan Eatmon
Headers show
Series [meta-arago,master/kirkstone] recipes-core: systemd: Fix Date and Time Service | expand

Commit Message

Chirag Shilwant June 21, 2023, 11:18 a.m. UTC
- Currently oe-core's systemd-timesyncd defaults to Google's time servers. However those servers are not always reachable.
Even if they are, it is much more sensible to use pool servers from ntp.org and ubuntu. Hence, add a new timesyncd.conf file
for the same.

- For the above issue, oe-core maintainers suggested to use bbappends in own layers to point to the time servers suitable
for your projects [1]. Hence, use systemd_%.bbappend to install the newly created timesyncd.conf file in filesystem.


Reference
---------
[1] https://www.openembedded.org/pipermail/openembedded-core/2019-November/289792.html

Signed-off-by: Chirag Shilwant <c-shilwant@ti.com>
---
 .../recipes-core/systemd/systemd/timesyncd.conf | 17 +++++++++++++++++
 .../recipes-core/systemd/systemd_%.bbappend     |  6 +++++-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 meta-arago-distro/recipes-core/systemd/systemd/timesyncd.conf

Comments

Sai Sree Kartheek Adivi June 21, 2023, 11:30 a.m. UTC | #1
On 16:48-20230621, Chirag Shilwant wrote:
> - Currently oe-core's systemd-timesyncd defaults to Google's time servers. However those servers are not always reachable.
> Even if they are, it is much more sensible to use pool servers from ntp.org and ubuntu. Hence, add a new timesyncd.conf file
> for the same.
> 
> - For the above issue, oe-core maintainers suggested to use bbappends in own layers to point to the time servers suitable
> for your projects [1]. Hence, use systemd_%.bbappend to install the newly created timesyncd.conf file in filesystem.
> 
> 
> Reference
> ---------
> [1] https://www.openembedded.org/pipermail/openembedded-core/2019-November/289792.html
> 
> Signed-off-by: Chirag Shilwant <c-shilwant@ti.com>
> ---
>  .../recipes-core/systemd/systemd/timesyncd.conf | 17 +++++++++++++++++
>  .../recipes-core/systemd/systemd_%.bbappend     |  6 +++++-
>  2 files changed, 22 insertions(+), 1 deletion(-)
>  create mode 100644 meta-arago-distro/recipes-core/systemd/systemd/timesyncd.conf
> 
> diff --git a/meta-arago-distro/recipes-core/systemd/systemd/timesyncd.conf b/meta-arago-distro/recipes-core/systemd/systemd/timesyncd.conf
> new file mode 100644
> index 00000000..a9f762b7
> --- /dev/null
> +++ b/meta-arago-distro/recipes-core/systemd/systemd/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. Local configuration
> +# should be created by either modifying this file, or by creating "drop-ins" in
> +# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
> +# Defaults can be restored by simply deleting this file and all drop-ins.
> +#
> +# 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=ntp.ubuntu.com
> diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> index 3de94336..a4437449 100644
> --- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> +++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
> @@ -1,4 +1,4 @@
> -PR:append = ".arago6"
> +PR:append = ".arago7"
>  
>  FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
>  
> @@ -11,6 +11,7 @@ SRC_URI:append = " \
>      file://30-wlan.network \
>      file://60-usb.network \
>      file://sync-clocks.service \
> +    file://timesyncd.conf \
>  "
>  
>  do_install:append() {
> @@ -38,4 +39,7 @@ do_install:append() {
>      # Need NAMESPACES enabled in the kernel, workaround for now
>      install -m 0644 ${D}${systemd_system_unitdir}/systemd-hostnamed.service ${D}${sysconfdir}/systemd/system/
>      sed -i 's/PrivateNetwork=yes/PrivateNetwork=no/g' ${D}${sysconfdir}/systemd/system/systemd-hostnamed.service
> +    
> +    install -d ${D}${sysconfdir}/systemd/
> +    install -m 0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/
>  }
> -- 
> 2.34.1
> 

Agreed. Google ntp servers are not always reachable.

Acked-by: Sai Sree Kartheek Adivi <s-adivi@ti.com>
diff mbox series

Patch

diff --git a/meta-arago-distro/recipes-core/systemd/systemd/timesyncd.conf b/meta-arago-distro/recipes-core/systemd/systemd/timesyncd.conf
new file mode 100644
index 00000000..a9f762b7
--- /dev/null
+++ b/meta-arago-distro/recipes-core/systemd/systemd/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. Local configuration
+# should be created by either modifying this file, or by creating "drop-ins" in
+# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
+# Defaults can be restored by simply deleting this file and all drop-ins.
+#
+# 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=ntp.ubuntu.com
diff --git a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
index 3de94336..a4437449 100644
--- a/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
+++ b/meta-arago-distro/recipes-core/systemd/systemd_%.bbappend
@@ -1,4 +1,4 @@ 
-PR:append = ".arago6"
+PR:append = ".arago7"
 
 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
@@ -11,6 +11,7 @@  SRC_URI:append = " \
     file://30-wlan.network \
     file://60-usb.network \
     file://sync-clocks.service \
+    file://timesyncd.conf \
 "
 
 do_install:append() {
@@ -38,4 +39,7 @@  do_install:append() {
     # Need NAMESPACES enabled in the kernel, workaround for now
     install -m 0644 ${D}${systemd_system_unitdir}/systemd-hostnamed.service ${D}${sysconfdir}/systemd/system/
     sed -i 's/PrivateNetwork=yes/PrivateNetwork=no/g' ${D}${sysconfdir}/systemd/system/systemd-hostnamed.service
+    
+    install -d ${D}${sysconfdir}/systemd/
+    install -m 0644 ${WORKDIR}/timesyncd.conf ${D}${sysconfdir}/systemd/
 }