Asynchronous system time (with guest additions)

Discussions about using Linux guests in VirtualBox.
Post Reply
Jimini
Posts: 6
Joined: 22. Mar 2011, 19:36
Primary OS: Other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Gentoo 2.6.36-hardened-r9

Asynchronous system time (with guest additions)

Post by Jimini »

Hey there,
I have set up three virtual machines. The host system is Gentoo (2.6.36-gentoo-r5), the guests run Gentoo (2.6.36-hardened-r9), too. Guest additions are installed. On one of the three machines I simply can't synchronize the system time with the hosts time. Sometimes the system has a drift of about 6 minutes, then, after a reboot, about 3 oder 8.
NTP is _not_ running, I'd like to solve this only by using the guest additions. After a few hours, I do not know anymore where to search for the mistake.

This morning, I made a mistake by editing the /etc/fstab on two of the systems, which had the effect, that / was mounted with the options nosuid, noexec and nodev. So I had to boot the two systems with a rescue cd to fix this error. Afterwards, the systems booted normally, but if I remember correctly, one of the two systems had problems with the system time.
Of course I have compared the settings of these two vms again and again (I used VBoxManage showvminfo), but I could not find anything of interest.

Anyway, here are the specs:
Host: Gentoo 2.6.36-gentoo-r5, virtualbox-bin-3.2.12-r1, virtualbox-modules-3.2.12
Guests: Gentoo 2.6.36-hardened-r9, virtualbox-guest-additions-3.2.12

The specs of two vms. "VM1" works fine, "VM2" does not get the correct time.

VM1

Code: Select all

Name:            VM1
Guest OS:        Gentoo
UUID:            38800e35-421c-4575-af40-2985b1f8285f
Config file:     /home/vms/VM1/VM1.xml
Hardware UUID:   38800e35-421c-4575-af40-2985b1f8285f
Memory size:     256MB
Page Fusion:     off
VRAM size:       8MB
HPET:            off
Number of CPUs:  1
Synthetic Cpu:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): HardDisk
Boot Device (2): Not Assigned
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          off
PAE:             on
Time offset:     0 ms
RTC:             UTC
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
State:           running (since 2011-03-22T17:20:44.819000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Storage Controller Name (0):            sata1
Storage Controller Type (0):            IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  30
Storage Controller Port Count (0):      2
sata1 (1, 0): /home/vms/VM1/VM1.vdi (UUID: eae123d2-bf88-41a1-a90b-abd8ddad945f)
NIC 1:           MAC: 08002762872E, Attachment: Bridged Interface 'eth0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
Audio:           disabled
Clipboard Mode:  Bidirectional
Video mode:      720x400x0
VRDP:            enabled (Address 0.0.0.0, Ports 5031, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDP port:       5031
Video redirection: disabled
USB:             disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Shared folders:  <none>

VRDP Connection:    not active
Clients so far:     1
Last started:       2011/03/22 17:20:50 UTC
Last ended:         2011/03/22 17:58:01 UTC
Sent:               0 Bytes
Average speed:      0 B/s
Sent total:         0 Bytes
Received:           0 Bytes
Speed:              0 B/s
Received total:     0 Bytes

Guest:

OS type:                             Linux26
Additions active:                    yes
Configured memory balloon size:      0 MB
VM2

Code: Select all

Name:            VM2
Guest OS:        Gentoo
UUID:            7bce3bd8-992f-4030-b83c-1797eb720205
Config file:     /home/vms/VM2/VM2.xml
Hardware UUID:   7bce3bd8-992f-4030-b83c-1797eb720205
Memory size:     256MB
Page Fusion:     off
VRAM size:       8MB
HPET:            off
Number of CPUs:  1
Synthetic Cpu:   off
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): HardDisk
Boot Device (2): Not Assigned
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          off
PAE:             on
Time offset:     0 ms
RTC:             UTC
Hardw. virt.ext: on
Hardw. virt.ext exclusive: on
Nested Paging:   on
Large Pages:     off
VT-x VPID:       on
State:           running (since 2011-03-22T17:20:46.211000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address: 
Teleporter Password: 
Storage Controller Name (0):            sata1
Storage Controller Type (0):            IntelAhci
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  30
Storage Controller Port Count (0):      2
sata1 (1, 0): /home/vms/VM2/VM2.vdi (UUID: f0fb1c14-52fe-4fb6-a929-a205747b6171)
NIC 1:           MAC: 08002734F692, Attachment: Bridged Interface 'eth0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: PS/2 Mouse
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
Audio:           disabled
Clipboard Mode:  Bidirectional
Video mode:      720x400x0
VRDP:            enabled (Address 0.0.0.0, Ports 5032, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
VRDP port:       5032
Video redirection: disabled
USB:             disabled

USB Device Filters:

<none>

Available remote USB devices:

<none>

Currently Attached USB Devices:

<none>

Shared folders:  <none>

VRDP Connection:    not active
Clients so far:     1
Last started:       2011/03/22 17:20:53 UTC
Last ended:         2011/03/22 17:57:57 UTC
Sent:               0 Bytes
Average speed:      0 B/s
Sent total:         0 Bytes
Received:           0 Bytes
Speed:              0 B/s
Received total:     0 Bytes

Guest:

OS type:                             Linux26
Additions active:                    yes
Configured memory balloon size:      0 MB

Here is the logfile of VM2: http://nopaste.info/afb7349150.html

Any help or at least helpful ideas and comments would be really appreciated.

Best regards,
Jimini
Last edited by Jimini on 11. Apr 2011, 22:50, edited 2 times in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Asynchronous system time (with guest additions)

Post by Perryg »

You probably will get better help at Gentoo with this.
VirtualBox does not actually provide a Gentoo build only the source code which Gentoo builds from. (AFAIK)
Did you install this from the portage tree of Gentoo?
Jimini
Posts: 6
Joined: 22. Mar 2011, 19:36
Primary OS: Other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Gentoo 2.6.36-hardened-r9

Re: Asynchronous system time (with guest additions)

Post by Jimini »

Hey Perryg,
I installed it from the portage tree. It offers the sources and also the binaries, which I chose.

Best regards,
Jimini
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Asynchronous system time (with guest additions)

Post by Perryg »

Still the binaries are Gentoo complied.
Gentoo 2.6.36-gentoo-r5, virtualbox-bin-3.2.12-r1, virtualbox-modules-3.2.12
Here are the binaries that VirtualBox.org provides for ver 3.2.12 VirtuaBox Downloads 3.2.12
Jimini
Posts: 6
Joined: 22. Mar 2011, 19:36
Primary OS: Other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Gentoo 2.6.36-hardened-r9

Re: Asynchronous system time (with guest additions)

Post by Jimini »

You were absolutely right. I could not find my mistake in any case, so I simply cloned the image of the working vm - now the time is finally correct.

Thank you for your comments!

Best regards,
Jimini
Jimini
Posts: 6
Joined: 22. Mar 2011, 19:36
Primary OS: Other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Gentoo 2.6.36-hardened-r9

Re: [solved] Asynchronous system time (with guest additions)

Post by Jimini »

Unfortunately, I have to re-open this thread. My VMs were incactive for a couple of days, until I started them today, their state was saved, so I simple "continued" them. I noticed, that on all four machines the time was drifting. 15 minutes, 3 seconds, 40 minutes, from machine to machine it almost seemed as the current time was chosen at random. Of course, the service "virtualbox-guest-additions" was running. Re-starting the service had no effect.
I found out, that executing "vboxguest-service --timesync-set-start" corrected the local time - but with every start of that program, another instance is running. What do you recommend? I thought about putting that program into crontab: starting it and killing it afterwards. But actually, this program only needs to be started immediately after the VM came up from the saved state.

Any ideas?

Best regards,
Jimini
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Asynchronous system time (with guest additions)

Post by Perryg »

What causes this is saved state or pause. You can try to get around this as below. This changes the threshold to force a hard reset much faster. Usually about <= 30 Seconds on resume.

As su/sudo on guest to test
VBoxService --timesync-set-threshold 1000

Or run this on the host to make permanent
VBoxManage guestproperty set <VM name> "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
Jimini
Posts: 6
Joined: 22. Mar 2011, 19:36
Primary OS: Other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Gentoo 2.6.36-hardened-r9

Re: Asynchronous system time (with guest additions)

Post by Jimini »

Perryg, thank you for your quick response. I automatically stop the virtual machines when the host system is shut down - with "stop" I mean, that their state is saved. During boot-up, the virtual machines are continued.

This is what I executed:

Code: Select all

VBoxManage guestproperty set VM1 "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
VBoxManage guestproperty set VM2 "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
VBoxManage guestproperty set VM3 "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold" 1000
But this had absolutely no effect - the clock is still drifting.

I thought about putting vboxguest-service --timesync-set-threshold 1000 into /etc/conf.d/local.start, I'll give this a try.

Best regards,
Jimini
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Asynchronous system time (with guest additions)

Post by Perryg »

For any changes to take effect the guest will need to be (shutdown) not saved state.
Post Reply