5

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
  • While I understand the convenience to set RTC to UTC, here is an article in 2004 which says that under some scenarios setting the RTC to local time might be reasonable. – Cloudy Apr 23 at 1:44
5

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.

| improve this answer | |
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.
| improve this answer | |
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
| improve this answer | |
1

This worked for me:

timezonectl set-timezone <tz> && \
timedatectl set-local-rtc 0    && \
timedatectl set-local-rtc 1 --adjust-system-clock

I don't really have an explanation (this was the result of button-mashing).

| improve this answer | |
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.

| improve this answer | |
0

It is better for the RTC to follow UTC, so you should use this command

timedatectl set-local-rtc 0

Can you show us the current settings by running the timedatectl command without any parameters? An example of what to look out for is:

$ timedatectl
                  Local time: Wed 2020-02-19 09:46:42 +08
              Universal time: Wed 2020-02-19 01:46:42 UTC
                    RTC time: Wed 2020-02-19 01:46:43
                   Time zone: Asia/Singapore (+08, +0800)
   System clock synchronized: no
             RTC in local TZ: no

If the system clock is synchronized, it can stop you from setting the RTC. So you need to disable it by:

sudo timedatectl set-ntp false

Now you can reset the RTC time by:

sudo timedatectl set-time "2014-11-08 06:40:00"

Note that Windows use the RTC differently from Linux. By default, Windows assumes the RTC is stored in local time, while Linux assumes the time is stored in UTC time and applies an offset. This leads to one of your operating systems showing the wrong time in a dual boot situation.

References:

| improve this answer | |
0

As suggested by other people here, I strongly recommend that you keep RTC in UTC and adjust your localtime in both operating systems. In Windows, you could use the procedure described in https://superuser.com/questions/494432/force-windows-8-to-use-utc-when-dealing-with-bios-clock.
Basically, you create a Registry entry called

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversal

and that tells Windows what time your RTC is set to. If you use Windows 10 64bit, you should use a QWord; other versions use a DWord, but the values are the same for any Windows version that honors this registry entry: 1, to say your RTC is set to UTC, 0 to say it's set to localtime. This is known to work at least from Win7 to Win10, and most Win Servers. Maybe XP works, too, but I don't know.

| improve this answer | |
0

what I usually do every time I install a new distro is this :

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

Then I reboot into Windows, and force the update of Internet Time.

From this time on, both systems have the correct time.

Point of attention: every time you launch a live distro (like boot-repair) this setting is overwritten)

| improve this answer | |

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.