How to set fallback NTP servers in Yocto

I have a Colibri iMX6ULL on a custom carrier board. Within the company network I need to add a NTP time server IP that the time sync works properly.

I checked the time sync with:
timedatectl status
Local time: Mon 2026-05-04 14:27:45 UTC
Universal time: Mon 2026-05-04 14:27:45 UTC
RTC time: Thu 1970-01-01 00:58:11
Time zone: Universal (UTC, +0000)
System clock synchronized: no
NTP service: active
RTC in local TZ: no

I checked the current configured servers with:
timedatectl show-timesync
FallbackNTPServers=time1.google.com time2.google.com time3.google.com time4.google.com
ServerName=time4.google.com
ServerAddress=2001:4860:4806:c::
RootDistanceMaxUSec=5s
PollIntervalMinUSec=32s
PollIntervalMaxUSec=34min 8s
PollIntervalUSec=34min 8s
Frequency=0

Where is the file to set fallback NTP servers when one server has a time out?

My system is:
tdx-info

Software summary

Bootloader: U-Boot
Kernel version: 6.6.69-7.1.0-devel-00039-g2ae8e6b7f80c-dirty #1 SMP PREEMPT Thu Jan 2 09:32:11 UTC 2025
Kernel command line: ubi.mtd=ubi root=ubi0:rootfs rw rootfstype=ubifs ubi.fm_autoconvert=1 console=tty1 console=ttymxc0,115200n8 mtdparts=gpmi-nand:512k(mx6ull-bcb),1536k(u-boot1)ro,1536k(u-boot2)ro,512k(u-boot-env),-(ubi)
Distro name: NAME=“TDX Wayland with XWayland Upstream”
Distro version: VERSION_ID=7.1.0-devel-20250127153124-build.0
Distro variant: -
Hostname: colibri-imx6ull-15076219

Hardware info

HW model: Toradex Colibri iMX6ULL 512MB on Colibri Evaluation Board V3
Toradex version: 0040 V1.1A
Serial number: 15076219
Processor arch: armv7l

Hi, I’m the Toradex AI Assistant.

I might make mistakes or occasionally get you wrong. Our support team will step in if needed.


Based on your system information, you’re running a custom Yocto build (TDX Wayland with XWayland Upstream, version 7.1.0-devel) on a Colibri iMX6ULL 512MB module.

NTP Configuration in Yocto

For configuring fallback NTP servers in your Yocto build, you’ll need to customize your build configuration. Since you’re using a systemd-based system (as evidenced by timedatectl working), the NTP configuration is handled by systemd-timesyncd.

Configuration Methods

1. Runtime Configuration

You can temporarily configure NTP servers at runtime by editing:

/etc/systemd/timesyncd.conf

Add your company’s NTP server to this file:

[Time]
NTP=your.company.ntp.server
FallbackNTP=time1.google.com time2.google.com time3.google.com time4.google.com

Then restart the service:

systemctl restart systemd-timesyncd

2. Yocto Build Integration

To make this permanent in your Yocto build, you’ll need to create a custom recipe or modify an existing one to include your NTP configuration. This involves creating a custom meta layer as described in the Toradex documentation for customizing Yocto builds(1).

The process involves:

  1. Creating a custom meta layer in your Yocto build environment(1)
  2. Adding a recipe to configure the timesyncd.conf file with your company’s NTP servers
  3. Rebuilding your image with the custom configuration

Since you’re working with a custom build environment, you’ll need to follow the Yocto Project customization guidelines to integrate this configuration into your build process(2)(1).

Verification

After implementing the changes, you can verify the configuration with:

timedatectl show-timesync
systemctl status systemd-timesyncd

The sources I have available focus on building and customizing Yocto images rather than specific NTP configuration details. For the exact implementation steps of integrating NTP server configuration into your custom Yocto build, you may find relevant discussions on the Toradex Community by searching for “NTP Yocto configuration”.

Best regards, Toradex AI Assistant.


Did you like my answer? :+1: :-1:

If I answered your question, please tick the “Solution” checkbox.

For follow-up questions to me, please use @ToradexAI in your post.