Avatar of jaisonshereen
jaisonshereen
 asked on

Time syschronisation probelm

I have installed Vmware tools 4 linux vms and enabled time sychronisation

But i couldnt find all the time of 4 vms are same when i fired the "date" command.

Please help me !
VMwareLinuxUnix OS

Avatar of undefined
Last Comment
Duncan Roe

8/22/2022 - Mon
that1guy15

I have been fighting my ESX server for about a year with time sync on linux vm's and have been unsuccessful with with vmtools. I ended up creating a script that ran ntpdate every hour to keep my linux servers in sync.

I would be interested to know a resolve for this too.
jaisonshereen

ASKER
Will it be this the cause ?


You can synchronize the time in the guest operating system with time on the host operating system only when the time in the guest operating system is earlier than the time set in the host.


Did u checked this also?
michofreiha

You should synchronize the ate with an NTP server
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
jaisonshereen

ASKER
how to synchronize with NTP server?
that1guy15

You will need to install ntpdate on your linux box. you can then either run the command ntpdate  or do what i did a create a script that you place in cron to run at a regular interval.

You will then need to find a reliable ntp server. Search the net and you will find them everywhere

jaisonshereen

ASKER
Can u give me an IP ? i couldn't find it in net ..
where/how i can install ntpdate ?
so after install i execute this command ..
ntpdate  in all servers.
Will all the servers become sync?



⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
larstr

Time synchronization  inside a virtual environment can be tricky. By using VMware Tools it will only catchup time if the VM time is too slow.

Using a scheduled ntpdate might be good enough, depending on how precise timing you need inside your VM.

Lowering the HZ of your kernel will usually help quite a bit for fixing the clock inside your VM. Using the following parameters (for 32bit guests) will also help: clocksource=pit noapic nolapic nosmp

You do not mention what linux distros you're using. For precise timing you might want to use the VMware Descheduled time service (you need a supported guest os): http://www.vmware.com/pdf/vi3_esx_vmdesched.pdf 

Also see this document for details about the timekeeping challenges: http://www.vmware.com/pdf/vmware_timekeeping.pdf

Lars
Duncan Roe

I had the problem of VMWare clock running fast at work. It's all fine now; the solution is in 2 parts:

1. Disable VMWare tools' attempts to fix the time - it only make it worse
2. Refresh the time every minute from a "reasonably" accurate source (standard PC running Linux as native O/S)

Item 1 requires that you have or obtain a binary editor. Edit the VNMWare daemon executable, replacing every occurrence of "settimeofday" with "gettmeofday". The 2 functions have identical signatures so the code keeps running, it just stops messing up your time.

Item 2 is implemented by having a once per minute cron job run netdate (available from http://linux.maruhn.com/sec/netdate.html). Only give netdate a single host name on its command line, so it has no option but to get time from that host.

Do that on all your 4 systems and they should stay in sync.
jaisonshereen

ASKER
For Item 1 : Can i go ahead an uninstall vmware tools ?
For Item 2 : Please help me . Please explain me in detail
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
jaisonshereen

ASKER
i can see lots of rpm netdate files ..which one i have to use ?
jaisonshereen

ASKER
Will this be a solution?


 Vmware Time Sync

If you want to completely disable time synchronization in the guest, open the virtual machine's configuration file (.vmx) in a text editor and set the following options to FALSE.

tools.syncTime
time.synchronize.continue
time.synchronize.restore
time.synchronize.resume.disk
time.synchronize.shrink

If instead you want the guest to have a constant offset from real time as maintained by the host, you can use the rtc.diffFromUTC option, or simply set the CMOS TOD clock time from the virtual machine's BIOS setup screen or from within the guest operating system. In Microsoft Windows, setting the system time automatically updates the CMOS clock.

If you want, 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 directly to the CMOS RT
jaisonshereen

ASKER
i did this ...

http://kbase.redhat.com/faq/FAQ_43_9259.shtm



do the restarting guest is mandatory?
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
larstr

That solution will work if the clock inside your guest is too slow: Linux Guest Clock Runs Slowly on ESX Server 3

If the clock is running too quickly see: Clock in a Linux Guest Runs More Slowly or Quickly Than Real Time

Lars
jaisonshereen

ASKER
where i need to edit this? in guest or host or both ?
larstr

Which one of the solutions are you refering to now?
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
jaisonshereen

ASKER
In my four VMs   2 are going faster than esx and 2 are going slower than ESX.

So i refered the link :

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1420

Here i couldnt find etc/lilo.conf  ..but i can see grub.conf

but i found those in guest and host .. so which i need to edit ?

In the provided link..i seen some differences in configuration:

One is to add clock=pit or clock=pit nosmp noapic nolapic

and i coulnt find lilo.conf ...in my server..is this mandatory to edit ...?

and what else i need to edit ?
jaisonshereen

ASKER
do i need to change timer.max.hardperiod as per ur link : http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2219

if so which value i have to put ?

i am pretty confused now

and ..moreover editing these values ..will not make any harm ..right?
larstr

You should only add those kernel parameters inside your guest OS. If your kernel is 2.6.17 or newer you should use clocksource instead of clock even though clock is still working in many distros.

Changing  timer.max.hardperiod will help your too quick guests if you can't lower their HZ which is the optimal solution. We still don't know what linux distros you're using, but some of the later RHEL editions have kernels where you can lower the HZ easily without recompiling the kernel by using the kernel parameter divider=10.


Lars
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
jaisonshereen

ASKER
I am using centOS and

uname -a

Linux server.domain.com 2.8.16-53.e15 #1 SMP Mon Nov 12 ..... X86_64 X86_64 x86_64 GNU/Linux


jaisonshereen

ASKER
So is this 64 bit ?
jaisonshereen

ASKER
Kindly request me if anything else you need ?
Your help has saved me hundreds of hours of internet surfing.
fblack61
Duncan Roe

My solution does not rely on any cooperation from VMWare. We had a commercial deadline to meet, and we could not afford to await possible answers. The host, by the way, is Windows XP.
The netdate URL I gave you is for source: you build and install yourself. We run Slackware so had it anyway. I can't check the crontab entry right now because I'm off work for a few weeks following radical prostatectomy but from memory it looks like:

* * * * * /usr/sbin/netdate linuxhost 1>/dev/null

In this example, "linuxhost" is the name of some PC running linux native. The guests will sync their time to whatever it is on that PC. Windows systems don't offer that service (on port 37) so that's why you have to use linux. linuxhost might run ntpd - nothing else needs to.

You should run "crontab -e" as root and insert this line.

I can't advise you on which RPM to use as I hardly ever use them myself. But I guess anything with i386 in its name will probably be OK.

Quite possibly the suggestion to change the config file in http:#22083782 will work for you instead of editing the executable as I did. You can check if this has worked as follows:
Install the cron netdate line. Now keep an eye on the time for a few minutes: in an xterm or other shell window type "watch :". You will see the time ticking over every 2 seconds in the top right hand corner of the window. Make sure it changes smoothly: you may see the odd correction as the minute changes (because netdate ran) but if the time jumps around at other times then VMWare daemon is still messing with it.

Good luck and post if you have any further queries
Duncan Roe

Some new posts while I was typing. You need an RPM with x86_64 in its name instead of i386 (you may not have the 32-bit glibc libraries installed to run i386 binaries - I have them on my 64-bit system but after a lot of manual installation). Building from source will always work (providing you have the compiler toolchain installed).
Duncan Roe

Note the solution I posted will work for slower or faster guest.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
jaisonshereen

ASKER
can i do think ticking in vmware tools using a command in terminal?
jaisonshereen

ASKER
can i do this ticking using mouse click  in vmware tools window using a command in terminal?
ASKER CERTIFIED SOLUTION
larstr

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Duncan Roe

Sorry jaisonshereen, I don't understand what you mean by "ticking using mouse click". "watch" is a standard command to repeat *any* shell command every 2 seconds (you can vary that time - 2s is just the default). So I could have suggested you do "watch date" - but watch always displays the time anyway so I suggested "watch :": ":" is the shell no-op command.

Just follow my previous suggestions and everything will be fine. I have found the drift is too big for any other mechanism to cope.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
jaisonshereen

ASKER
i mean .....is it possible use a bunch of commands in terminal instead of using clicking on the time synchronization check box using mouse clicks?

So that i can put those commands to run as a crontab entry !

SOLUTION
Duncan Roe

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Duncan Roe

Sorry - last link above should be http:#22075733