October 30th, 2006
Here’s a little thing I came across while doing my new mail / web server setup. After I got both servers up and running I realised they were suffering from a problem I’d noticed before with VMware machines I’d run but which had never really been a major issue: their clocks lost time rapidly, about half an hour every hour. When you’re just testing out Ubuntu or something that’s not a major problem, but on a machine I intended to be my production server, obviously it was. I read a bunch of documentation on the VMware site and apparently the most common cause of this problem is to do with the kernel timer. VMware say that most distros configure the kernel timer at 1000Hz, so when you install a Linux client it wants 1000 timer updates per second and VMware has trouble providing this from the host. Their recommended fix is to recompile the kernel with the timer configured at 100Hz.
I checked the Mandriva kernel sources and determined it’s actually built with a 100Hz default. Me being an idiot, this stymied me for a few hours.
Then I realised the obvious answer – if the Mandriva kernel is configured at 100Hz, that means my _host_ is also only providing 100 timer updates per second, because it’s running the Mandriva kernel too. What VMware’s advice really means is that you want the host to run a 1000Hz timer and the guest to run a 100Hz timer.
So all I needed was a kernel with a 1000Hz timer to run on the host. Now I could have rebuilt the stock MDV kernel with the timer set to 1000Hz, but I’m criminally lazy and get good intuitive ideas sometimes, so I thought ‘I just bet that kernel-multimedia is configured with a 1000Hz timer’. And sure enough, it is. Using kernel-multimedia on the host and stock kernel on the guests, the clocks stay in sync pretty well (and I sync the guests via ntp every hour to make sure they’re never more than a couple of seconds out). Problem solved.
So, if you’re running Mandriva VMware clients on a Mandriva machine, use kernel-multimedia on the host and stock kernel on the guests to alleviate your clock woes. Or if you don’t want to go with an unsupported kernel, rebuild the stock kernel with the timer at 1000Hz to use as the host’s kernel.