The system time runs too fast on a Linux-based virtual machine that is hosted in Virtual Server 2005 R2 (918461)
The information in this article applies to:
- Microsoft Virtual Server 2005 R2 Standard Edition
- Microsoft Virtual Server 2005 R2 Enterprise Edition
SYMPTOMSAfter you install a Linux-based virtual machine in Microsoft Virtual Server 2005 R2, the system time in the Linux guest operating system runs too fast. For example, the current time in the Linux guest operating system may advance by one minute approximately every 48 seconds. After some time, the Linux-based virtual machine resets the clock to the correct time.
You experience this issue if you are running a Linux distribution that uses the Linux 2.6 kernel. CAUSE This behavior occurs because the default algorithm in the Linux 2.6 kernel adjusts for the possible loss of timer ticks. Because of this adjustment, the virtual machine may gain time. RESOLUTIONTo resolve this issue, add the clock=pit parameter to the Linux bootloader file. The clock=pit parameter causes the Linux 2.6 kernel to use a more efficient algorithm to synchronize time between the virtual machine and the host computer. This algorithm does not adjust for lost ticks. Therefore, the algorithm does not cause the virtual machine to gain time. To add this parameter, follow these steps. For the GRUB bootloader- In the guest operating system, open the /boot/grub/menu.lst file by using a text editor such as Vi. For example, type the following command from a console, and then press ENTER: This file contains the Linux boot options and resembles the following:
title Linux
kernel (hd0,4)/vmlinuz root=/dev/hda7 vga=791
initrd (hd0,4)/initrd
title windows
root (hd0,0)
makeactive
chainloader +1
title floppy
root (fd0)
chainloader +1
title failsafe
kernel (hd0,4)/vmlinuz.shipped root=/dev/hda7 ide=nodma apm=off acpi=off vga=normal nosmp maxcpus=0 3
initrd (hd0,4)/initrd.shipped - In the title Linux area of this file, add the clock=pit parameter to the kernel entry. This area should resemble the following:
title Linux
kernel (hd0,4)/vmlinuz root=/dev/hda7 vga=791 clock=pit
initrd (hd0,4)/initrd - Save the changes to the file, exit Vi, and then restart the Linux-based virtual machine.
For the LILO bootloader- In the guest operating system, open the /etc/lilo.conf file by using a text editor such as Vi. For example, type the following command from a console, and then press ENTER: This file contains the Linux boot options and resembles the following:
### LILO global section
boot = /dev/hda # LILO installation target: MBR
vga = normal # normal text mode (80x25 chars)
read-only
lba32 # Use BIOS to ignore
# 1024 cylinder limit
prompt
password = q99iwr4 # LILO password (example)
timeout = 80 # Wait at prompt for 8 s before
# default is booted
message = /boot/message # LILO's greeting
### LILO Linux section (default)
image = /boot/vmlinuz # Default
label = linux
root = /dev/hda7 # Root partition for the kernel
initrd = /boot/initrd
### LILO Linux section (fallback)
image = /boot/vmlinuz.shipped
label = Failsafe
root = /dev/hda7
initrd = /boot/initrd.suse
optional
### LILO other system section (Windows)
other = /dev/hda1 # Windows partition
label = windows
### LILO memory test section (memtest)
image = /boot/memtest.bin
label = memtest86 - In the ### LILO Linux section (default) area of this file, type the following entry: This area should resemble the following:
### LILO Linux section (default)
image = /boot/vmlinuz # Default
label = linux
root = /dev/hda7 # Root partition for the kernel
initrd = /boot/initrd
Append = "clock=pit" - Save the changes to the file, and then exit Vi.
- Run the lilo command. For example, type the following command, and then press ENTER:
- Restart the Linux-based virtual machine.
MORE INFORMATIONA virtual machine generally has difficulty synchronizing its time with the physical host computer. Although Microsoft Virtual Server 2005 Virtual Machine Additions are intended to help correct this problem, you might experience time synchronization problems because of the way in which the guest operating system keeps track of the system time. Every kind of operating system has its own way to keep track of the system time.
The Linux 2.6 kernel uses three different kinds of algorithms to keep track of the system time. These algorithms are more efficient than the algorithms that are used by the Linux 2.4 kernel and by earlier Linux kernels. Time synchronization in a virtual machineAn operating system generally tracks time by using the periodic time interrupts that are generated by a specific hardware device. Generally, an operating system obtains the time from a battery-backed Complimentary Metal Oxide Semi-conductor (CMOS) clock during the operating system's startup procedure. The operating system then configures a timer device to generate periodic interrupts. The operating system keeps track of time by counting these interrupts. For a virtual machine, the actual physical hardware is shared by the host operating system and by the guest operating system. When a virtual machine generates a time interrupt, the guest operating system may be running or may not be running. Therefore, the guest operating system does not immediately account for some of these interrupts. To work around this issue, the virtual machine keeps a backlog of these interrupts. Additionally, the virtual machine increases the frequency of timer interrupts when it is running. The increased frequency of timer interrupts is intended to help the guest operating system maintain the correct time. However, the increased frequency of these interrupts could cause the guest operating system to miss some of the interrupts. These missed interrupts are known as "lost ticks." Lost ticks cause the guest operating system time to lag behind the actual time. Although you may experience this issue on a physical computer, you are more likely to experience this issue in a guest operating system that is running on a virtual machine. The Linux 2.4 kernel and earlier Linux kernels rely on the timer interrupts that are delivered by the timer.
The algorithms that are implemented for time synchronization in the Linux 2.4 kernel do not account for lost ticks. This behavior may cause the Linux guest operating system time to lag behind the actual clock. To help resolve this issue, some Linux distributions patch the Linux 2.4 kernel to deliver timer interrupts at a faster rate. However, the Linux guest operating system could still experience time synchronization issues because of lost ticks. The Linux 2.6 kernel
implements more efficient algorithms to resolve this time synchronization issue. Unlike the Linux 2.4 algorithms, the Linux 2.6 algorithms adjust for lost ticks. However, this adjustment may cause the Linux-based virtual machine to gain time. The Linux 2.6 kernel has three different clock parameters that can be passed to the kernel at boot time. Use these parameters to select the algorithms to use for time synchronization. For more information about these algorithms, see the "Timekeeping in Linux" section. Each of these timekeeping algorithms has advantages and disadvantages. However, you are more likely to notice disadvantages on a virtual machine than on a physical computer. Computer timer hardwareEvery operating system has its own method to handle timekeeping issues. There are various kinds of timer mechanisms that are used to keep time on a computer. These timer mechanisms include the following: - Programmable Interval Timer (PIT)
- CMOS Real Time Clock (RTC)
- Local Advanced Programmable Interrupt Controller (APIC) Timers
- Advanced Configuration and Power Interface (ACPI) (This mechanism is also known as a Chipset Timer.)
- Time Stamp Counter (TSC)
- High Precision Event Timer (HPET)
Timekeeping in LinuxOn an x86-based platform, the Linux 2.6 kernel interacts with the following kinds of clocks to keep track of time: - Power Management Timer (PMTMR)
This clock has the following characteristics:- This clock is set by using the clock=pmtmr kernel parameter.
- This clock uses the ACPI timer.
- This clock may cause smaller time gains.
- Time Stamp Counter (TSC)
This clock has the following characteristics:- This clock is set by using the clock=tsc kernel parameter. (This is the default parameter.)
- This clock uses the PIT counter and the TSC for time interpolation.
- This clock may cause overcorrection in a virtual machine environment. Therefore, the guest operating system clock may run too fast.
- This clock may cause time gains of up to 10 percent.
- Programmable Interval Timer (PIT)
This clock has the following characteristics:- This clock is set by using the clock=pit kernel parameter.
- This clock uses only the PIT counter for time interpolation.
- This clock uses the simplest of the available algorithms.
- This clock does not gain time because it does not use lost tick correction code.
For more information about Virtual Server 2005, visit the following Microsoft Web site:
The third-party products that this article discusses are manufactured by companies that are independent of Microsoft. Microsoft makes no warranty, implied or otherwise, regarding the performance or reliability of these products.
Modification Type: | Minor | Last Reviewed: | 5/4/2006 |
---|
Keywords: | kbtshoot kbenv kbDeployment kbprb KB918461 kbAudITPRO |
---|
|