There is an alternative approach available:
Unattended using timedatectl
First find out the name for the time zone you want to configure. The name is usually in the form <area>/<city>
where area
is a continent or ocean and city
is a big city in that area (e.g. Europe/Berlin
for Germany). timedatectl list-timezones
will show the known time zones.
To update the time zone in Ubuntu 16.04 and newer non-interactively, call timedatectl set-timezone
with the time zone and then reconfigure tzdata. Example for Europe/Berlin
:
sudo timedatectl set-timezone Europe/Berlin
sudo dpkg-reconfigure -fnoninteractive tzdata
Explanation: timedatectl
will update the /etc/localtime
symlink and dpkg-reconfigure
will set /etc/timezone
.