what’s the better way to do so?
2. I am trying to set timezone using timedatectl:
timedatectl set-timezone <timezone>
it gets changed for about 5 minutes and falls back to UTC. Not sure what is changing it back. I have stopped systemd-timesyncd as well as systemd-timedated.
Also, i noticed
timedatectl set-ntp false
does not kill/stop systemd-timesyncd daemon
/lib/systemd/systemd-timesyncd
So if i don’t want to use ntp servers for syncing time do i need to stop it manually?
Ah, sorry, you “snap on ubuntu” in the title and the choice of the “snap” section kind of made it sound like snap on classic …
theoretically:
sudo timedatectl set-timezone <timezone>
should work …
and it definitely does for me on all images:
ogra@nanopi-air:~$ sudo timedatectl set-timezone Europe/Berlin
ogra@nanopi-air:~$ date
Tue Sep 19 11:47:06 CEST 2017
ogra@nanopi-air:~$ sudo reboot
Connection to 192.168.2.35 closed by remote host.
...
$ ssh 192.168.2.35
...
ogra@nanopi-air:~$ date
Tue Sep 19 11:48:30 CEST 2017
What image (stable, edge ?) on what device are you using ?
Is this a self-created image or one of our reference ones and did you also use a proper timezone when calling the command … (“timedatectl list-timezones” lists all valid options)
i wouldnt rely on that, after all there are certain systemd tools that were normally not used in xenial but are enabled on Ubuntu Core (networkd and timesyncd specifically, the safest option here is surely to disable systemd-timesyncd with systemctl instead.
I can observe the behavior that @Anmol mentioned: Setting the timezone to Europe/Berlin with timedatectl works fine, but gets reset after ~ 5 minutes. Running Ubuntu Core stable on a Raspberry Pi 3B.
snap info core
name: core
summary: snapd runtime environment
publisher: Canonical✓
contact: snaps@canonical.com
license: unset
description: |
The core runtime environment for snapd
type: core
snap-id: 99T7MUlRhtI3U0QFgl5mXXESAiSwt776
tracking: stable
refresh-date: 6 days ago, at 15:06 CET
channels:
stable: 16-2.36.1 (5898) 78MB - <
snap --version
snap 2.36.1
snapd 2.36.1
series 16
kernel 4.4.0-1100-raspi2
Just to point out, a nameserver is set correctly in systemd-resolved according to what DHCP hands out, so if you are in control of that then it works fine.
You can check it with resolvectl or cat /run/systemd/resolve/resolv.conf
Not saying that is relevant this particular scenario, but just in case someone else reads this and wonders.