1

https://help.ubuntu.com/community/UbuntuTime at "Using the Command Line (unattended)" seems to answer by question but doesn't seem to work in the latest Ubuntu (Xenial). The dpkg-reconfigure command seems always to reset the timezone to UTC regardless of what is written to /etc/timezone. How do I set the default timezone programmatically in Ubuntu Xenial?

1 Answers1

5

The command for setting the timezone in Ubuntu 16.04 is timedatectl.

The following command will set your timezone to what you want:

timedatectl set-timezone Country/City

To turn UTC off, run the following command:

timedatectl set-local-rtc 1

But this is NOT recommended because of the updates not happening to the RTC in time sync. I have actually found that in dual-booting with Windows, it is better to set Windows to use UTC, then the clock is always correct between reboots between Windows and Ubuntu. An answer for setting Windows to UTC can be found here: https://askubuntu.com/a/169384/231142

Running that command you will get the following warning:

Warning: The system is configured to read the RTC time in the local time zone.
         This mode can not be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.

To find your timezone that you set to, run the following:

timedatectl list-timezones

and choose the closest city to you.

Hope this helps!

Terrance
  • 41,612
  • 7
  • 124
  • 183
  • 1
    You shouldn't do timedatectl set-local-rtc 1. That controls whether Ubuntu sees the RTC clock as being in UTC (which is a concern only if you're dual-booting with Windows). Setting Ubuntu's timezone should be enough. – muru Oct 10 '16 at 02:31
  • @muru Yep, I agree. That is why I put the warning in there. It was in the question about it keep going back to UTC, so I hope that part answers. =) – Terrance Oct 10 '16 at 02:32
  • But the way put it in there makes it seem that warning is a "normal" thing. You yourself don't caution against doing so at all. Neither do you explain why this might be needed. – muru Oct 10 '16 at 02:35
  • @muru Ah, good point. =) – Terrance Oct 10 '16 at 02:35