Install NTP server

I want to run a small ntp server.

What is the recommended way to install ntp daemon or chrony on a board like the Toradex Verdin iMX8M Plus?

Can I customize the os image accordingly?

Or do I have to use a container for this and is there a recommendation?

Best regards
René

Hi, I’m the Toradex AI Assistant. I’m in early beta, and I would appreciate your feedback.
The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello,

To install an NTP server on a Toradex Verdin iMX8M Plus, you have a couple of options depending on your preferences and the specifics of your project. Both ntp daemon and chrony are popular choices for time synchronization and can be used effectively on your board.

Installing NTP daemon or Chrony Directly on the OS

  1. Customizing the OS Image with Yocto Project: You can include ntp or chrony directly into your custom OS image using the Yocto Project. This involves adding the package to your local.conf or your image recipe. For chrony, you would add chrony to your IMAGE_INSTALL append in the local.conf file like so:

    IMAGE_INSTALL_append = " chrony"
    

    For ntp, replace chrony with ntp in the above line. This method integrates the NTP server directly into your OS, ensuring it’s available from the first boot without requiring additional installation steps.

  2. Using TorizonCore with Debian Containers: If you’re using TorizonCore, you can leverage the Debian container images to install either ntp or chrony in a container. This method isolates the NTP server from the host OS, providing flexibility and ease of deployment or updates.

    • Creating a Container for NTP/Chrony: You can create a Debian-based container and install ntp or chrony using apt-get. Here’s a basic example of a Dockerfile to get you started:

      FROM debian:buster-slim
      RUN apt-get update && apt-get install -y chrony
      COPY mychrony.conf /etc/chrony/chrony.conf
      CMD ["chronyd", "-d"]
      

    Replace chrony with ntp and adjust the configuration file path if you prefer to use the NTP daemon. Build and run this container on your Verdin iMX8M Plus module with TorizonCore.

Recommendation

  • For Simplicity and Ease of Use: If you’re looking for the simplest setup and integration into your system, customizing the OS image with Yocto to include chrony or ntp is straightforward and efficient.
  • For Flexibility and Isolation: If you prefer to keep your time synchronization service isolated or plan to deploy updates independently of the OS, using a container with

Please, also check if these links can help you solve your problem:

How to use OpenCL 1.2 in iMX8 on Torizon | Toradex Developer Center.

Thanks! This is ok for me.

Hello @rema,

As the @ToradexAI put, both approaches would be possible when using Torizon OS.

That being said, we typically recommend that containers are used for adding new applications or libraries to Torizon OS if possible.
The reason for this is that using containers avoids setting up a Yocto build environment and reduces the maintenance overhead when creating new releases.

Best Regards,
Bruno

Thank you Bruno.

That being said, we typically recommend that containers are used for adding new applications or libraries to Torizon OS if possible.

That’s clear, I understand. That’s exactly what we do with our customer applications.

The reason for this is that using containers avoids setting up a Yocto build environment and reduces the maintenance overhead when creating new releases.

We are realizing that setting up a Yocto build environment is really complicated… On the other hand, we need to solve the problem that the board time is managed and controlled from a container (it should be the other way around IMHO).

We are thinking about it.

Beste ragrads
René

Hello @rema,

By default the board time on Torizon OS is set by a service using an NTP client running on Torizon OS itself, so no containers are used.

Feel free to reach out if you have other questions.

Best Regards,
Bruno