Unable to edit /etc/systemd/timesyncd.conf . I have some local NTP servers in my network. I wanted to add them so that time of my Ubuntu Core 16 system gets sychronized from them. As I am unable to edit the file. Is there a way out ?
you need a snap that uses the timeserver-control interface to change the /etc/systemd/timesyncd.conf file … here is an example of doing exactly this:
(you can install it from the store as: https://snapcraft.io/ntpcontrol )
Hi Ogra,
How do I put multiple ntp server entries in the below command. I see that I am only able to put one entry like either my local ntp server or ntp.ubuntu.com. If I put mutiple entries, it gives me the below error:
error: invalid configuration: “ntp.ubuntu.com” (want key=value)
Below command executed:
sudo ntpcontrol set ntpserver=xx.xx.xx.xx ntp.ubuntu.com
wherein xx is the ip address of my local server
first of all, do not forget to run
snap connect ntpcontrol:timeserver-control
then … if you want multiple entries you need to add quoting:
sudo ntpcontrol set "ntp.ubuntu.com time.example.com"
$ sudo grep ^NTP /etc/systemd/timesyncd.conf
NTP=ntp.ubuntu.com time.example.com
also … if you are on ubuntu core it is always good to have snapd keep your config values for you in the database, so use snap set
instead:
$ snap set ntpcontrol ntpserver="ntp.ubuntu.com time.example.com"
$ snap get ntpcontrol
Key Value
ntpserver ntp.ubuntu.com time.example.com
$ sudo grep ^NTP /etc/systemd/timesyncd.conf
NTP=ntp.ubuntu.com time.example.com
Thanks Ogra. Looks like it is working fine now