crosspost from http://rextang.net/blogs/work/
The title came from VMWare KB and just said exactly the problems I’ve faced those 2 days!
As I’ve written in the Windows X Server Client post, I used VMWare 5.5 to setup a Fedora Core 6 Linux VM to be the linux test server. the linux kernel version is 2.6.18 and after I finished that post soon I found that my server’s system time is little bit strange. it’s not sync with the host time.
Since correct time is very important for a server, I think it should be more important in a linux server since there were lots of logs and crontabs that’s based by time. The very first thoughts to fix this problem is to use NTP protocol to sync with world time servers. in linux kernel 2.6 there is ntpd for ntp server, in 2.4 it should be xntpd. so I quickly modified “/etc/ntp.conf” file and started the ntpd.
the time is still not sync with real time after I started ntpd. also I found that the ntpd installed is not able to sync to outside server, it will only sync to LOCAL server, even if I turned on udp port 123 in iptables (both in and out), just like what it was written in this maillist I found. also, the system time is slow, it takes more than one second to pass a second (inside this linux guest system). there seems also having problems related to VM hardware’s clock settings.
This tooks me one day and didn’t find any solution on the internet. finally I decided that maybe it’s only happened on linux kernel 2.6.18 and decide to build up another distribution with different kernel version to test again.
I choosed CentOS 4.4 with linux kernel 2.6.9 to build up another linux vm. and after the installation, the system time is still slow like the one inside Fedora vm. this concluded that it will almost happened with 2.6 kernel in VMWare and won’t happened in 2.4 kernel (since my colleague had a RedHat 7.2 with kernel 2.4.18 running without the time slow problem). some posts I read indicated that this should have something related to system clock. so I started dig into that direction.
A search to Google finally found the answer. From VMWare KB. It’s exactly the answer of this problem if you are running kernel 2.6 inside VMWare. the reason that caused the slowing time inside guest system is because of that the guest clock frequency is setting too high than the host OS can offer. in 2.4 kernel the clock rate is set to 100HZ and after 2.6 kernel the clock is set to 1000HZ on compiling time, thus cause the timer in guest OS slower than host OS. refer to this KB for more detail explaination.
Just follow what the KB said to tune bootup kernel options for both slow time and quick time problem, like the following (GRUB case):
append=”resume=/dev/hda6 splash=silent clock=pit nosmp noapic nolapic“
“clock=pit” is to fix quick clock problem, “nosmp noapic nolapic” is to fix slow clock problem.
after a reboot of guest linux (both my Fedora one and CentOS one) , the clock is back to normal and strangely that the ntpd also back to normal work and can query outside time server without problems. cool!
As also provided in another VMWare KB talking about Timekeeping in VMWare Virtual Machine, it is also able to use VMWare Tools to sync guest OS time with host one. by installing VMWare Tools in Linux server, there will be a vmware-guestd running and by setting parameter “tools.syncTime = TRUE” inside VMWare .vmx setting file, time will be sync.ed with host OS using VMWare Tools and will be not necessary to run ntpd or ntpdate in crontab to sync your time inside guest system, it will auto sync with host OS and it will now be only the host OS that needs to sync with world time server thus save the bandwith also the loading of outside time servers.
finally solved the time problem, and got to learn one more linux distribution install, also get deeper understanding of ntpd during this problem solving, nice (tough) learning.
actually Fedora Core distribution is pretty different from CentOS installation, CentOS is pretty much like RedHat distribution and many daemon names are different from Fedora and CentOS (RedHat). another tough learning to remember those difference! (should be more differences if touching FreeBSD systems!)
anyway, now I can also setup my xdmcp and vnc server env on my CentOS guest system and now have 2 guest linux systems to start my learning of those network services installation. keep walking…
Technorati Tags: linux , redhat, fedora, CentOS, ntp, clock, kernel , vmware