
設定時區我嘗試如下:
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 同步切換為 yes,本地時間和時區切換回 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"
如前所述這裡。