You are not logged in.

#1 2015-06-28 22:02:40

jamespharvey20
Member
Registered: 2015-06-09
Posts: 129

Hardware clock using localtime in a VM - Install OK reboot its wrong

I'm running arch as a guest in VMware.

My host BIOS is set to my local timezone, and my host O/S Windows 7 sees time in my local timezone as well.  Host Windows 7 automatically synchronizes with time.windows.com.

I'd love to run host Windows 7 in UTC using the registry option RealTimeIsUniversal, but using that option, you can't have Windows 7 run ntp (or its version of it.)  I need host Windows 7 time to be accurate.  If I always had arch running, I could have arch running ntp, and time synchronize to host Windows 7 through the vmware tools.  But, I won't always have the arch VM running.  So, I do need to keep host Windows 7 in UTC.

While booted off the arch install (2015.06.01) iso, under arch-chroot to the new install, I:

ln -s /usr/share/zoneinfo/America/Detroit /etc/localtime
hwclock --localtime --hctosys
date
hwclock --debug

Everything looked great.  After boothing into the installed system, however:

$ date
Sun Jun 28 12:36:14 EDT 2015 {nope, it should be saying 16:36:14}
$ timedatectl
      Local time: Sun 2015-06-28 12:36:16 EDT
  Universal time: Sun 2015-06-28 16:36:16 UTC
        RTC time: Sun 2015-06-28 16:36:16
       Time zone: America/Detroit (EDT, -0400)
 Network time on: no
NTP synchronized: no
 RTC in local TZ: no
$ sudo hwclock --debug
hwclock from util-linux 2.26.2
Using the /dev interface to the clock.
Assuming hardware clock is kept in UTC time. {nope, hardware clock is kept in localtime, shouldn't "hwclock --localtime --hctosys" during install have set that?}
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2015/06/28 16:36:19 {yep, that's the correct time, in localtime}
Hw clock time: 2015/06/28 16:36:19 = 1435509379 seconds since 1969
Time since last adjustment is 1435509379 seconds
Calculated Hardware Clock drift is 0.000000 seconds
Sun 28 Jun 2015 12:36:18 PM EDT  .258703 seconds
$ ls /etc/adjtime
ls: cannot access /etc/adjtime: No such file or directory

I tried running

sudo timedatectl set-local-rtc 1

And rebooted, and now it does say "Assuming hardware clock is kept in local time."  BUT, the time it reports reading from the hardware clock jumped backwards 4 hours, so it didn't really fix anything.

Offline

#2 2015-06-29 12:39:23

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,116

Re: Hardware clock using localtime in a VM - Install OK reboot its wrong

If I always had arch running, I could have arch running ntp, and time synchronize to host Windows 7 through the vmware tools.  But, I won't always have the arch VM running.

This suggests a possible workaround : Add a vm with  a minimal arch installation that runs on every windows boot.

The minimal-arch VM would be CLI-only, with base + ntp client installed . (you may have to add some things for network support).

Bios and windows would both be using UTC, while the minimal-arch vm takes care of keeping the time in sync.

Last edited by Lone_Wolf (2015-06-29 12:40:46)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB