The Problem
I'm doing some extended travel, and I notice that when I change locations, the time zone does not update automatically. My current work around is to just run sudo dpkg-reconfigure tzdata each time I switch locations. However, it'd be nice to not have to do this manually.
I'm looking for a solution that:
- Makes the time zone update without human intervention (e.g., I don't have to run
sudo dpkg-reconfigure tzdatain order for the time zone to update) - Does not require me to install a third-party script (I believe automatic time zone updates is a built-in feature that should work out of the box without third-party help; please correct me if I'm wrong on this).
Research I've Done
Below are the relevant posts I've read that haven't helped.
- timezone not updated automatically: I updated
/etc/systemd/timesyncd.confas suggested, but it didn't resolve the issue. - Auto Timezone doesn't update: my location services are enabled (see system info below) and I would prefer not to install a third-party script.
- How can I make Ubuntu automatically detect the correct timezone based on my internet connection?: I would prefer not to install a third-party script
- Automatically set Linux timezone according to location: I would prefer not to install a third-party script.
- Would like local time to be automatically updated: The discussion in the comments doesn't have any suggestions.
- Ubuntu 22.04 Auto Timezone is wrong: This question is unanswered.
- Ubuntu 22.04.4 changing time zones stopped working: This question is unanswered.
My System Info
I'm running Ubuntu 22.04.4 LTS only (no dual boot), 64-bit on a Dell XPS 13 (9380).
Running
gsettings get org.gnome.system.location enabledreturnstrue(location services enabled; verified in the GUI as well)Running
gsettings get org.gnome.desktop.datetime automatic-timezonereturntrue(automatic timezone enabled; verified in the GUI as well)Output of
timedatectl status
Local time: Mon 2024-05-27 01:33:36 NZST
Universal time: Sun 2024-05-26 13:33:36 UTC
RTC time: Sun 2024-05-26 13:33:36
Time zone: Pacific/Auckland (NZST, +1200)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
- Output of
systemctl status systemd-timesyncd.service
systemd-timesyncd.service - Network Time Synchronization
Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2024-05-27 01:19:15 NZST; 1h 4min ago
Docs: man:systemd-timesyncd.service(8)
Main PID: 935 (systemd-timesyn)
Status: "Initial synchronization to time server 185.125.190.57:123 (ntp.ubuntu.com)."
Tasks: 2 (limit: 18597)
Memory: 1.6M
CPU: 208ms
CGroup: /system.slice/systemd-timesyncd.service
└─935 /lib/systemd/systemd-timesyncd
- Contents of
/etc/systemd/timesyncd.confI've tried both of the following and neither worked.
[Time]
NTP=
FallbackNTP=ntp.ubuntu.com
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
and
[Time]
NTP=ntp.ubuntu.com
FallbackNTP=pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
- Full output of
systemd-analyze cat-config systemd/timesyncd.conf(including comments).
# /etc/systemd/timesyncd.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See timesyncd.conf(5) for details.
[Time]
NTP=
FallbackNTP=ntp.ubuntu.com
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
or
# /etc/systemd/timesyncd.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
# Software Foundation; either version 2.1 of the License, or (at your option)
# any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file, or by creating "drop-ins" in
# the timesyncd.conf.d/ subdirectory. The latter is generally recommended.
# Defaults can be restored by simply deleting this file and all drop-ins.
#
# See timesyncd.conf(5) for details.
[Time]
NTP=ntp.ubuntu.com
FallbackNTP=pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048