Setting an NTP timeserver on Ubuntu Core

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
sudo reboot

After reboot you can see with journalctl that the default timeserver now points to “

ogra@pi:~$ sudo journalctl|grep systemd-timesyncd|grep Sync
Feb 11 19:47:53 pi systemd-timesyncd[1170]: Synchronized to time server (

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)

1 Like

Hi @ogra, thanks for the repo. I gave it a try with some customization. I didn’t include the ntpcontrol script in my snap file. I can run the command snap set ntpcontrol in the image but didn’t see the timesyncd conf file got updated after a reboot. I’ve connected timeserver-control.


Update: cat /etc/systemd/timesyncd.conf command got denied by AppArmor. Will do more troubleshooting soon.