要设置时区,我尝试执行以下操作:
auser@localhost:~$ sudo timedatectl
Local time: Fri 2019-05-17 06:46:14 UTC
Universal time: Fri 2019-05-17 06:46:14 UTC
RTC time: Fri 2019-05-17 06:46:13
Time zone: n/a (UTC, +0000)
Network time on: yes
NTP synchronized: no
RTC in local TZ: no
auser@localhost:~$ sudo timedatectl set-ntp 0
auser@localhost:~$ sudo timedatectl
Local time: Fri 2019-05-17 06:46:34 UTC
Universal time: Fri 2019-05-17 06:46:34 UTC
RTC time: Fri 2019-05-17 06:46:33
Time zone: n/a (UTC, +0000)
Network time on: no
NTP synchronized: no
RTC in local TZ: no
auser@localhost:~$ sudo timedatectl set-timezone Europe/Berlin
auser@localhost:~$ sudo timedatectl
Local time: Fri 2019-05-17 08:46:56 CEST
Universal time: Fri 2019-05-17 06:46:56 UTC
RTC time: Fri 2019-05-17 06:46:55
Time zone: Europe/Berlin (CEST, +0200)
Network time on: no
NTP synchronized: no
RTC in local TZ: no
一切看起来都很好但随后重新启动......
auser@localhost:~$ sudo reboot
auser@localhost:~$ sudo timedatectl
Local time: Fri 2019-05-17 06:48:51 UTC
Universal time: Fri 2019-05-17 06:48:51 UTC
RTC time: Fri 2019-05-17 06:48:51
Time zone: n/a (UTC, +0000)
Network time on: yes
NTP synchronized: no
RTC in local TZ: no
NTP 同步已切换为是,本地时间和时区已切换回 UTC。我该如何更改这些设置,以便重启后仍能继续使用?
答案1
为了安装 snappy,请执行以下操作:
sudo apt install ubuntu-snappy-cli
为了读取 ubuntu-core 的当前配置:
snappy config ubuntu-core
然后为了更新它:
CONFIG=/tmp/core_config
snappy config ubuntu-core > "$CONFIG"
sed -i 's/timezone: .*$/timezone: America\/Cordoba/' "$CONFIG"
sudo snappy config ubuntu-core "$CONFIG"
如上所述这里。