2

We are hosting a VPS on a popular host and are experiencing a regular time drift of several minutes a day forward (approx 7).

Linux Kernel: 2.6.18-164.11.1.el5 GNU/Linux Distro: CentOS release 5.4 (Final)

We reached out to our hosting provider and their support advised us " This is a known issue with Cloud Servers. To fix this you will need to add one line to your grub config located at: /boot/grub/menu.lst

The line you need to add is: noapic nolapic divider=10 nolapic_timer

This should correct this issue. You will need to restart after this is added in. "

Because I am wary of manipulating grub, mostly I'm terrified that our server may fail to restart - I ask you guys, the pro *nix admins - where exactly in this file does the recommended insertion below:

# line from 1&1 for time syncing issue (Case 5163)
noapic nolapic divider=10 nolapic_timer

go? Please specify where exactly, and whether the order of commands is or is not important. Why is the block below "title CentOS ..." indented?

If someone could give me an overview of how this works or point me to a resource that's easy to follow, that's what I'm looking for immediately, a light overview or basic understanding of what I;m doing. If GRUB and bootloaders are a deep dark treasure trove of kernel hacking or something, that's great well-recommended in-depth resources are also very welcome.

This is my current /boot/grub/menu.lst

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
#boot=/dev/sda
#
serial --unit=0 --speed=57600
terminal --timeout=5 serial console

timeout=5

title CentOS (2.6.18-164.11.1.el5)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/hda1 console=tty0 console=tty
    initrd /boot/initrd-2.6.18-164.11.1.el5.img

MOST IMPORTANT: I need to know where in the file above it is appropriate to paste the suggested line so I can confidently restart my VPS after manipulating GRUB config

MikeyB
  • 38,725
  • 10
  • 102
  • 186

2 Answers2

2

Those parameters are kernel tweaks.

Add those parameters to your kernel line:

kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/hda1 console=tty0 console=tty noapic nolapic divider=10 nolapic_timer


Oh, by the way, you probably mean console=ttyS0 if you're trying to use a serial console.
MikeyB
  • 38,725
  • 10
  • 102
  • 186
2

Since you have access to the serial console, my first suggestion is to do the test settings and perform the changes temporarily, so that in case you need to reboot it won't cause you trouble.

Testing the settings temporarily

Connect to the serial console for the server and reboot. When server starts up and shows the grub count down press any key (e.g. SPACE) to cancel the default boot process and enter the GRUB menu.

It will get you to a menu where you will see the

CentOS (2.6.18-164.11.1.el5)

as an option

press e to enter the command-line edit option.

This will show you these lines:

    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/hda1 console=tty0 console=tty
    initrd /boot/initrd-2.6.18-164.11.1.el5.img

Press the ↓ to select the kernel line and press e to edit it. Use arrow keys to go left and write ... Press → to the end (chances are you are already there).

NOTE: if the line is too long for the screen it will only show the last bits of the line at the left of the screen don't get frightened by it :-)

Here you can add the extra parameters that your support staff gave you:

... noapic nolapic divider=10 nolapic_timer

So your entire kernel line will be

    kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/hda1 console=tty0 console=tty noapic nolapic divider=10 nolapic_timer

Press

and you will go back to the previous screen showing the boot commands.

Simply press b so that the system can boot.

If all goes well APIC drivers will be off and your timer will tick along ... :-)

When you want to make the changes permanent... You can add them to the grub file as under.

PERMANENT CHANGE

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
#boot=/dev/sda
#
serial --unit=0 --speed=57600
terminal --timeout=5 serial console

timeout=5

title CentOS (2.6.18-164.11.1.el5)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18-164.11.1.el5 ro root=/dev/hda1 console=tty0 console=tty noapic nolapic divider=10 nolapic_timer
    initrd /boot/initrd-2.6.18-164.11.1.el5.img

Reboot if you want and enjoy.

Note that you can always fix things by doing what i showed you in grub.

In case you end up at grub> prompt :-)

if you end up a the grub> prompt by accident on your console

grub> configfile /grub/grub.conf

You can always look at the current partition by typing a benign command such as configfile followed by a slash (/) and pressing tab twice the way you would on a bash prompt to do name completion and you will see the list of files in your boot partition

Ahmed Masud
  • 176
  • 3