Syncing VM time with actual local/computer time?

djkilla

Weaksauce
Joined
Nov 16, 2008
Messages
104
I'm trying to get HFM.net to display the correct completion date/time when folding on a VM. Is there anyway to sync the date/time of the VM to the date/time of my computer or my local time? I'm not sure if it's the VM or Linux running in VM that needs to be synced to my computer/local date and time.

 
Last edited:
I'd like to know how to do this as well. I'm sure there is some command in the VM to make it do a time check with an outside source.
 
NTP? You could try 'ntpdate pool.ntp.org' for a one-time update, or configure the ntp daemon to run continuously and keep the time in sync. It's fairly common to see at least ntpdate installed by default; both should be available under any distro. What do you DC types run for a distro in your VMs?
 
NTP? You could try 'ntpdate pool.ntp.org' for a one-time update, or configure the ntp daemon to run continuously and keep the time in sync. It's fairly common to see at least ntpdate installed by default; both should be available under any distro. What do you DC types run for a distro in your VMs?

A custom kernel. This particular one I think is based on Slackware. I highly doubt it has any easy way to update the clock.

I unfortunately can't answer this question. I used to run some flavor of Ubuntu in VMs, which I figured out how to set the clock. I have no idea with Linux in general.

Tobit...where are you??

 
Same issue here. Awaits answer

evga 1.1 vm / vmware player
Posted via [H] Mobile Device
 
A custom kernel. This particular one I think is based on Slackware. I highly doubt it has any easy way to update the clock.

Unless you're doing something very strange it would be easy to install NTP from the Slackware packages then. Though musky's link looks to describe a process that should work with the image you guys are using.
 
Keep in mind that most of us are lucky to get FAH started in Linux from the command line. The FAH image is the only Linux experience a lot of us have.

 
If you'll link me to where I can get the image you guys are using I'll try and figure out an easy process for you.
 
If you'll link me to where I can get the image you guys are using I'll try and figure out an easy process for you.

I'm using the following from the EVGA site:

Linux FAH Image v1.1 - Includes folding client 6.29

I did change the current VM Player 3.0.1 to 3.0. Other than that, it's just not syncing the date/time. My guess is within Linux in the VM, you probably have to manually set the timezone and the date/time. I don't know if it will sync with the actual computer date/time or a time server unless you run some kind of script or program.
 
Arrgh, I love Windows' helpful error messages :rolleyes:. If anyone can tell me WTF this is supposed to mean and how to fix it, maybe I can get VMware installed...

In the event log:

Product: VMware Player -- Installation operation failed.
Windows Installer installed the product. Product Name: VMware Player. Product Version: 3.0.1.11056. Product Language: 1033. Manufacturer: VMware, Inc.. Installation success or error status: 1603.

Accompanied by:

msierror.png


Oh and the accompanying KB article is equally useless. Is it really that hard to just log what failed and why?
 
Last edited:
Not sure, but try the old 3.0.0, you need it for more than 4 cores if your gonna set up anyqys
Posted via [H] Mobile Device
 
Won't matter...he is just trying to get us an easy way to sync the time in the eVGA VM.
 
Somewhat ironically I guess I'll just do it on my Linux laptop instead of this box...
 
Okay, so Virtualbox can load .vmdk images, so that's easier. Got it booted up now, and it seems like both ntpdate and the NTP server are included.

Here's a step by step:
Code:
root@FAH:~# cp /usr/share/zoneinfo/PST8PDT /etc/localtime
[i]Pick your timezone, US ones are EST5EDT, CST6CDT, MST7MDT and PST8PDT. Full list with 'ls /usr/share/zoneinfo'[/i]
root@FAH:~# ntpdate pool.ntp.org
[i]Should print how many seconds offset you are and the server IP[/i]
root@FAH:~# echo "server pool.ntp.org iburst dynamic" > /etc/ntp.conf
root@FAH:~# ntpd
[i]Now make it happen at startup:[/i]
root@FAH:~# echo "ntpdate pool.ntp.org" >> /etc/rc.d/rc.local
root@FAH:~# echo "ntpd" >> /etc/rc.d/rc.local
That's it, ntpd should continuously keep your clock in sync, within a few tens of ms. And it should keep its state and restart after a reboot. If your VM is well-behaved, the clock shouldn't drift much, but sometimes the realtime clock the guest OS gets goes a bit haywire with power management and so on. If that's the case, ntpd might not be able to keep up with it and you might be better off with a cron job running ntpdate every few minutes. If the time turns out to drift a lot let me know in the thread and I'll help with that, it's easy.
 
Thanks Keenan. How often does ntpd update the clock? I'm wondering if you will see a performance hit with the daemon running.

 
Thanks Keenan. How often does ntpd update the clock? I'm wondering if you will see a performance hit with the daemon running.


The operation of NTP is actually quite complicated, and I don't really understand all the ins and outs of it, it doesn't just poll periodically, it maintains a lock on the server's clock and estimates the local offset and rate error and compensates for them. If it detects that the local clock has a lot of jitter (the local error rate changes a lot so the offset is hard to predict), it will poll the upstream clock more often to try and keep the clock accurate. I don't expect you will see any noticeable performance hit, but you may as well test it. I may call it 'complicated', but it's something a 486-era PC can run with hardly any performance impact, so I don't think you'll have problems.

If you're concerned about it and can tolerate some clock drift, just the ntpdate at startup which is a one-time sync should be sufficient to keep the clock close enough as long as you're not running for months on end, and as long as the VM solution provides a properly stable clock to the guest (I know I've had trouble with this in the past). Just skip the ntpd commands. I'm lazy and I use ntp everywhere because it means I never have to set clocks and all my logs are in sync to the second - but it's definitely overkill if you just want a reasonable clock, NTP is good enough to keep pretty much any system within 50ms of 'the one true UTC', and most modern systems within 10ms or so if you sync with 3 or 4 servers, or a couple nationally-run atomic clock time servers, though it's quite good as long as it has several servers to work with even if they're not very good themselves (just one used here).

Can you tell I'm a huge nerd? :p
 
Last edited:
50ms is probably way overkill, but these things rarely get rebooted so a one-time deal may cause these VMs to get out of sync again. I have no idea how good the clock is in them. Something that would update every hour or every day might end up being better. I didn't notice if sshd is running on them, but assuming it is, you could use PuTTY to manually update your clock without having to stop the FAH client. I unfortunately do not have one running to test any of this.

We love nerds around here, especially ones who know things that most of us don't. I can tell you that my experience with system clocks and ntp was in Windows and was because if you played a spell caster character in Everquest and you system clock was off, your spell reset timer would lock you out by the amount of time your system clock was off. I'd say that puts me somewhere between geek and nerd ... :)

 
50ms is probably way overkill, but these things rarely get rebooted so a one-time deal may cause these VMs to get out of sync again. I have no idea how good the clock is in them. Something that would update every hour or every day might end up being better. I didn't notice if sshd is running on them, but assuming it is, you could use PuTTY to manually update your clock without having to stop the FAH client. I unfortunately do not have one running to test any of this.

Yeah, but I really don't think it will make any difference to run it or not, and it's nice to just leave it alone and trust it's in line. But...

If you prefer that approach, try something like this instead of the 'ntpd' stuff in rc.local:
Code:
echo -e '#!/bin/sh\n/usr/sbin/ntpdate pool.ntp.org' > /etc/cron.daily/ntp.sh
chmod a+x /etc/cron.daily/ntp.sh
 
Last edited:
Just to be sure. If I wanted the time to be synced each time I start the VM image, I would enter the following:

root@FAH:~# cp /usr/share/zoneinfo/EST5EDT /etc/localtime
root@FAH:~# ntpd
root@FAH:~# echo "ntpd" >> /etc/rc.d/rc.local
 
Just to be sure. If I wanted the time to be synced each time I start the VM image, I would enter the following:

root@FAH:~# cp /usr/share/zoneinfo/EST5EDT /etc/localtime
root@FAH:~# ntpd
root@FAH:~# echo "ntpd" >> /etc/rc.d/rc.local

This will keep time continuously in sync. If you just want it to sync at startup, keep the 'ntpdate' lines and skip the 'ntpd' ones.

So:

root@FAH:~# cp /usr/share/zoneinfo/PST8PDT /etc/localtime
root@FAH:~# echo "ntpdate pool.ntp.org" >> /etc/rc.d/rc.local

You can do the one-time 'ntpdate pool.ntp.org' to sync the current instance if you want.
 
There is a checkbox in the web config for enabling NTPD. This will start NTPD on next boot. You also have the option to add iburst to /etc/ntp.conf after each server to sync the time more frequently and the option to specify different ntp servers if desired.

Another option is to hit ALT+F2 and run the command timesync. This will sync the time with the hardware clock every so often. This example sets the time every 3 minutes:

timesync 180
 
I figured there was an easy way to do this. linuxfah, have you noticed any performance hit when running NTPD? Thanks for the info.

 
I figured there was an easy way to do this. linuxfah, have you noticed any performance hit when running NTPD? Thanks for the info.

I have not seen any performance hit from running NTPD. NTPD uses very little in the way of resources.
 
Back
Top