![Ubuntu Core 16 - 如何更改时区持久性?](https://linux22.com/image/1166095/Ubuntu%20Core%2016%20-%20%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%E6%97%B6%E5%8C%BA%E6%8C%81%E4%B9%85%E6%80%A7%EF%BC%9F.png)
要设置时区,我尝试执行以下操作:
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"
如上所述这里。