VMware Cloud Community
Myretyr
Contributor
Contributor
Jump to solution

Time on newly created VM

Is it possible to change time on a VM during creation? Or when booting the first time?

Is the BIOS setting the only way to adjust time on a VM before an OS has been installed?

Need to have correct time in order to get my installation of the guest os to work.

--==[ VCP 5 ]==-- --==[ VCP 4 ]==--
Reply
0 Kudos
1 Solution

Accepted Solutions
FaffeF
Contributor
Contributor
Jump to solution

Quote from the "Time keeping in VMware virtual machines" information guide:

You can force the CMOS TOD clock’s offset to be initialized to a specific value at power on. To do so, set the option rtc.diffFromUTC in the virtual machine’s .vmx configuration file to a value in seconds. For example, setting rtc.diffFromUTC = 0 sets the clock to UTC at power on, while setting rtc.diffFromUTC = -25200 sets it to Pacific Daylight Time, seven hours earlier than UTC. The guest operating system can still change the offset value after power on by writing a new time to the CMOS TOD clock

With Powershell it's pretty easy to figure out what time zone you're in, so if you're using PowerCLI you can configure this when you create the vm, and take into account DST.

View solution in original post

Reply
0 Kudos
14 Replies
peetz
Leadership
Leadership
Jump to solution

The VM's BIOS time is set to the host's time when the VM is powered on.

So, if your host has the correct time (make this sure by configuring NTP on the host) then the VM should also have the correct time.

- Andreas

Twitter: @VFrontDe, @ESXiPatches | https://esxi-patches.v-front.de | https://vibsdepot.v-front.de
Reply
0 Kudos
Myretyr
Contributor
Contributor
Jump to solution

The host has the correct time. And the VM has UTC time.

But as I am installing Windows the guest os want to have the local timezone...

--==[ VCP 5 ]==-- --==[ VCP 4 ]==--
Reply
0 Kudos
peetz
Leadership
Leadership
Jump to solution

Hmm, yes, I guess you are right. The ESXi host's time is always in UTC, so a newly created VM's BIOS time will also be in UTC.

However, Windows expects the BIOS time to be local. This is generally only a problem at the first boot, because once you have the correct time in Windows then Windows will correctly set the BIOS time.

However, there is a hack to let Windows interpret the BIOS time as UTC. See here: http://weblogs.asp.net/dfindley/archive/2006/06/20/Set-hardware-clock-to-UTC-on-Windows-_2800_or-how...

Maybe this works for you.

- Andreas

Twitter: @VFrontDe, @ESXiPatches | https://esxi-patches.v-front.de | https://vibsdepot.v-front.de
Reply
0 Kudos
bradstaenglen
Contributor
Contributor
Jump to solution

Have you tried turning off the Time Synch under VMTools Options. Edit Settings on the VM - Options - VMware Tools. Let me know if that works!

Reply
0 Kudos
Myretyr
Contributor
Contributor
Jump to solution

Peetz: Microsoft doesn't recommend to use their own solution...

http://support.microsoft.com/kb/2687252

--==[ VCP 5 ]==-- --==[ VCP 4 ]==--
Reply
0 Kudos
Myretyr
Contributor
Contributor
Jump to solution

Bradstaenglen:

Either you didn't read my post entirely or you don't know how VMware Tools work. When I boot my VM there are no VMware tools running until you have:

1 Guest OS installed

2 VMware tools installed

It is in order to get the guest OS installation running I have to have the right (local) time on my VM.

--==[ VCP 5 ]==-- --==[ VCP 4 ]==--
Reply
0 Kudos
peetz
Leadership
Leadership
Jump to solution

Great stuff ... :smileyshocked:

Okay, you could set this key only for the installation and remove it again when Windows is completely installed and established another time sync method (through VMwareTools, AD, NTP, etc.) ... And avoid installations on DST change days Smiley Wink

Bad hacks, but I can't think of another way right now.

Twitter: @VFrontDe, @ESXiPatches | https://esxi-patches.v-front.de | https://vibsdepot.v-front.de
Reply
0 Kudos
peetz
Leadership
Leadership
Jump to solution

By the way, how do you install Windows? Is it some kind of PXE boot environment or via bootable CD?

Twitter: @VFrontDe, @ESXiPatches | https://esxi-patches.v-front.de | https://vibsdepot.v-front.de
Reply
0 Kudos
bradstaenglen
Contributor
Contributor
Jump to solution

I don't know why I didn't see the big part about no OS being installed! Must learn to read closer, sorry about that Myretyr

Reply
0 Kudos
a_p_
Leadership
Leadership
Jump to solution

Interesting question. I thought about this too lately.

Although I can understand that the time zone configuration has been removed from the hosts (this was possible on ESX) I'm missing a "VM Time Zone" setting (e.g. under options) for the virtual machine, which takes affect when cold booting the system or even for the time sync events which currently have to be disabled manually (http://kb.vmware.com/kb/1189). This would make it a lot easier and secure to even run DCs in the virtual environment without experiencing Kerberos issues.

For now you need to run a time sync manually (e.g. using net timeor w32tm) during installation before adding a system to a domain.

André

Reply
0 Kudos
winstontj
Contributor
Contributor
Jump to solution

Not sure if it's best to reply to this or start my own new question but I essentially have the same issue.

I have ESXi 5.0 Ent + and I'm running a BSD operating system as the VM/Guest. The Host machine is sync'd to NTP servers and working fine. Every other VM on this host (Windows, Linux and BSD) is working fine and VMware tools works properly to sync the guest with the host.

For some reason, no matter how many times I change the time in the BIOS of this BSD x64 VM it always defaults back to four hours ahead of EST. I've deleted and rebuilt this VM about five times and it's still happening but this does not happen with any other guest OS.

How do I manually sync the BIOS time with the Host's time and force it to stay sync'd? I am using the same NTP servers for the host as I am on the BSD Guest OS and that's fine but I can't sync with Active Directory if the BIOS and the OS time are off by several hours like this.

Thanks for any help.

Reply
0 Kudos
winstontj
Contributor
Contributor
Jump to solution

Anyone??

There are KB articles on Linux flavors but nothing for BSD operating systems.

How do you force a time zone on the BIOS in ESXi 5.0? Is there a tutorial or knowledge base article on this?

Reply
0 Kudos
FaffeF
Contributor
Contributor
Jump to solution

Quote from the "Time keeping in VMware virtual machines" information guide:

You can force the CMOS TOD clock’s offset to be initialized to a specific value at power on. To do so, set the option rtc.diffFromUTC in the virtual machine’s .vmx configuration file to a value in seconds. For example, setting rtc.diffFromUTC = 0 sets the clock to UTC at power on, while setting rtc.diffFromUTC = -25200 sets it to Pacific Daylight Time, seven hours earlier than UTC. The guest operating system can still change the offset value after power on by writing a new time to the CMOS TOD clock

With Powershell it's pretty easy to figure out what time zone you're in, so if you're using PowerCLI you can configure this when you create the vm, and take into account DST.

Reply
0 Kudos
Myretyr
Contributor
Contributor
Jump to solution

:smileysilly:

Thanks! Will try that!

--==[ VCP 5 ]==-- --==[ VCP 4 ]==--
Reply
0 Kudos