Run away clock on a 1and1 Virtual Server

This is a little off topic, but it took me a while to find the fix: if you’re running CentOS on a Virtual Server and you find the clock is racing ahead, read on.

I’ve just been updating software on one of the servers I use, in advance of the launch today of a new website I’ve been working on for a client; I wanted to make sure that it was up to date with all the necessary security fixes and so forth, before unleashing it on the world.

So, I’ve updated the Plesk control panel, and all the various CentOS packages. And everything looked pretty normal. And then the messages began to arrive from users of another of my sites, the forum, which is used by many PVR users.

The forum, they said, was telling them they couldn’t post so soon after their last one, misdating posts, not showing posts since their last visit correctly, and various other issues, all time related.

And, yes, the database for that forum runs on the same server that I’ve just updated. My first thought was the timezone was wrong – and yes, once again, a Plesk update had changed the timezone to somewhere in the US, for reasons best known to itself.

But, fixing that wasn’t enough. It was still wrong, and a check showed that it was actually running almost double speed. Manual pages weren’t much help, and it took a while with Google to turn up some useful results – looking for something like ‘centos virtual server’ does tend to bring up far too many useful hits, but along the way I found a page at Microsoft that referred to problems on a Linux kernel in a virtual host environment, plus a bug report on another version of Centos.

That gave a few more clues, and the fix I found was contained in this post on the VirtualBox forum.

Essentially, the fix I’ve adopted has been to add the following boot options to the virtual server’s config

noapic nolapic nosmp divider=10 nolapic_timer

On the 1and1 virtual server I’m using, the way to do this is pretty straightforward. Log in to the server, via ssh or the serial console. Change directory to /boot/grub and edit the file grub.conf

You’ll see various entries that start “title Centos”, each followed by three indented lines, beginning “root”, “kernel” and “initrd”. The entry you need is the default, which should be the first one – it’ll have the most recent kernal version listed as part of the title.

All you need to do is add the options to the end of the appropriate kernel line, which on the virtual server will probably already have an option like this for the serial console access via the 1and1 control panel

console=tty0 console=ttyS0,57600

So, just add the new options to the end of the line

console=tty0 console=ttyS0,57600 noapic nolapic nosmp divider=10 nolapic_timer

then save the file, and restart the server with

shutdown -r now

When it’s started up again, sync the time


and hopefully all will be back to normal.

And, I hope this helps anyone else with the same problem who’s been trying to track down a speeding clock.

2 Replies to “Run away clock on a 1and1 Virtual Server”

  1. Just a heads up, at some point your edits to grub.cfg will disappear. I’m using almost all Debian, but I assume CentOS will be broadly similar. At the top of grub.cfg I see :

    # It is automatically generated by grub-mkconfig using templates
    # from /etc/grub.d and settings from /etc/default/grub

    Most of what you might want to tweak in GRUB is done via /etc/default/grub, and for the changes you want, almost certainly in the GRUB_CMDLINE_LINUX= line.

    Some more advanced stuff may mean fiddling in /etc/grub.d – though the only time I’ve needed to go in there is to rename the config files to make Xen hypervisor instances come before plain kernels.

    Next time you run update-grub, these config files will be read and a new grub.cfg will be created – removing any manual edits you’ve made.

  2. CentOS/RedHat doesn’t “suffer” from this problem.

    When you install a new kernel, the changes you made will be copied into the new stanzas.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.