4

I had a Ubuntu 18.04.1 machine dual boot with Windows 10, and these two OS has time conflict. Previous on my machine with ubuntu 16.04 this conflict can be easily solved with timedatectl set-local-rtc 1 — adjust-system-clock, but this command does not work any more on my Ubuntu 18.04 system.

Here is the terminal output:

yunhui@hp:~$ timedatectl set-local-rtc 1 --adjust-system-clock
yunhui@hp:~$ timedatectl 
                      Local time: Thu 2018-08-02 16:31:58 CST
                  Universal time: Thu 2018-08-02 08:31:58 UTC
                        RTC time: Thu 2018-08-02 08:31:58
                       Time zone: Asia/Shanghai (CST, +0800)
       System clock synchronized: no
systemd-timesyncd.service active: yes
                 RTC in local TZ: yes

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'.
yunhui@hp:~$ grep -i utc /etc/default/rcS
grep: /etc/default/rcS: No such file or directory

Basically Ubuntu knows I have change to interpret hardware clock as local time, but the RTC time is still Universal time. Also the “rcS” file does not exist, but I have tried manually create the file and write “UTC=no”, still no luck.

Does somebody know how to solve this problem?

  • Facing the exact same issue myself, this is an absolute deal-breaker for dual-booting systems. Looks like Bionic isn't ready for prime time yet. – Prahlad Yeri Sep 7 '18 at 16:01
  • 1
    @PrahladYeri Actually Windows is on fault here as it cannot handle a properly set up RTC in UTC. Consider what happens when you carry your WIndows laptop to some other location. – PerlDuck Sep 7 '18 at 16:45
  • 1
    I agree with @PerlDuck. The BIOS setting should be in UTC and the OS should use locale / location info to correctly display time. In this spirit, Windows default setting is wrong and there is a registry setting in Windows that can be used to tell Windows to treat BIOS time as UTC and accordingly display local time. This worked fine for me on all dual-boots until now. Ubuntu 18.04 seem to mimic old Windows (wrong) behaviour unfortunately. Solutions presented here are the wrong approach, IMO. BIOS should continue to be set to UTC and OS should correct based on location / locale setting. – tagMacher Sep 28 '18 at 7:27
3

The command suggested by @Jens works, but adjusting the clock back to local RTC isn't quite easy, you need to pass through multiple hoops!

sudo timedatectl set-local-rtc 1 --adjust-system-clock

Running the above command did set the local-rtc flag to 1, but it also changed the time that appears on my desktop from IST (Indian Standard Time) to UTC. In other words, the above command didn't "adjust" or made changes to the hardware or BIOS clock, all it did was displayed whatever the BIOS time was (which was still UTC) and consider it the local time and show it on desktop. But I didn't want that since I don't live in the UTC timezone, so I went to XFCE Settings Manager and changed it to +5.5 hours, so that my clock now reflects IST. But alas, the XFCE Settings manager doesn't seem to be in sync with the timedatectl. It did change my desktop time to IST, but pushed back the BIOS clock by 5.5 hours, so it again went to UTC after a reboot. Finally, the only way to resolve this issue was to get into BIOS and change that clock to IST. So the instructions to set the clock in local time are:

  1. Run sudo timedatectl set-local-rtc 1 --adjust-system-clock.
  2. Restart computer, go to your BIOS settings.
  3. Set time to your local timezone, save and reboot.
1

Did you try this as root too? I was able to do what you want as root user. Try using the command:

sudo timedatectl set-local-rtc 1 --adjust-system-clock
1

An alternative to the method suggested by @PrahladYeri is that instead of brute-changing the RTC time from the BIOS, boot into Windows and let Windows automatically overite the RTC.

sudo timedatectl set-local-rtc 1 --adjust-system-clock

Now boot into Windows and in "Change the Date and Time", disable and then again enable "Set time automatically". This should overwrite the local time on the RTC.

0

IMO the correct solution is to have RTC set to UTC. Then Ubuntu default behaviour shows correct local time on the basis of either locale / region setting or location sensing if available. How Ubuntu treats RTC can be checked with output of sudo hwclock --debug; it will tell you that Ubuntu expects the RTC to be set to UTC. Windows behaviour can be corrected by suitable edit of a particular registry key - info on this is available on the Internet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.