A while ago i created a test tool for the timeserver-control interface on Ubuntu Core devices. I decided to turn this into a proper snap that people can consume to set a custom timeserver on their devices by using the “snap set” command.
The source can be found at:
To use it you can do the following:
snap install ntpcontrol snap connect ntpcontrol:timeserver-control snap set ntpcontrol ntpserver=0.europe.pool.ntp.org sudo reboot
After reboot you can see with journalctl that the default timeserver now points to “0.europe.pool.ntp.org”
ogra@pi:~$ sudo journalctl|grep systemd-timesyncd|grep Sync Feb 11 19:47:53 pi systemd-timesyncd: Synchronized to time server 18.104.22.168:123 (0.europe.pool.ntp.org).
To unset the custom NTP server you can use:
sudo ntpcontrol off
(and then uninstall the ntpcontrol snap)
Indeed you can also include this snap by default in a custom image via the “required-snaps” directive in the model assertion and define the default server in your gadget.yaml (details can be found above in the README of the github tree)