ports/156508: [PATCH] emulators/virtualbox-ose-additions: deal with gues OS time sync

Artem Naluzhnyy tut at nhamon.com.ua
Tue Apr 19 22:40:04 UTC 2011


>Number:         156508
>Category:       ports
>Synopsis:       [PATCH] emulators/virtualbox-ose-additions: deal with gues OS time sync
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 19 22:40:03 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Artem Naluzhnyy
>Release:        
>Organization:
>Environment:
>Description:
Add pkg-message and modify "vboxservice" rc-script accordingly to prevent simultaneous time synchronization by VirtualBox Additions and ntpd.

+------------------------------------------------------------------------------
To run VirtualBox Additions from startup, add the following in /etc/rc.conf:

  vboxguest_enable="YES"
  vboxservice_enable="YES"

To prevent time source conflict, both ntpd(8) and ntpdate(8) must be disabled in rc.conf while VirtualBox Additions are in use. You may use ntpd in your host OS instead.

If you still wish to use ntpd in guest OS you should disable time sync by the VirtualBox Additions - add extra lines in your in /etc/rc.conf:

  vboxservice_flags="--disable-timesync"
  vboxservice_ignore_ntpd="YES"
+------------------------------------------------------------------------------


This should fix the problems like

  Apr 17 13:37:55 devel ntpd[757]: time reset -0.886552 s
  Apr 17 13:54:01 devel ntpd[757]: time reset -0.968916 s
  Apr 17 14:10:15 devel ntpd[757]: time reset -0.935790 s
  Apr 17 14:26:29 devel ntpd[757]: time reset -0.982373 s
  Apr 17 15:02:07 devel ntpd[757]: time reset -0.940596 s
  Apr 17 15:02:16 devel ntpd[757]: time correction of -1200 seconds exceeds sanity limit (1000); set clock manually to the correct UTC time.

if host OS time is not synchronized properly.
>How-To-Repeat:

>Fix:
diff -ruN virtualbox-ose-additions.bak/Makefile virtualbox-ose-additions/Makefile
--- virtualbox-ose-additions.bak/Makefile	2011-01-31 23:06:45.000000000 +0000
+++ virtualbox-ose-additions/Makefile	2011-04-19 21:57:57.000000000 +0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	virtualbox-ose
 DISTVERSION=	3.2.12
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	emulators kld
 MASTER_SITES=	http://tmp.chruetertee.ch/ \
 		http://freebsd.unixfreunde.de/sources/ \
@@ -177,4 +177,7 @@
 		${PREFIX}/share/hal/fdi/policy/10osvendor/
 .endif
 
+post-install:
+	@${CAT} ${PKGMESSAGE}
+
 .include <bsd.port.post.mk>
diff -ruN virtualbox-ose-additions.bak/files/vboxservice.in virtualbox-ose-additions/files/vboxservice.in
--- virtualbox-ose-additions.bak/files/vboxservice.in	2011-01-31 23:06:45.000000000 +0000
+++ virtualbox-ose-additions/files/vboxservice.in	2011-04-19 21:43:06.000000000 +0000
@@ -3,7 +3,7 @@
 # $FreeBSD: ports/emulators/virtualbox-ose-additions/files/vboxservice.in,v 1.1 2011/01/31 23:06:45 decke Exp $
 
 # PROVIDE: vboxservice
-# REQUIRE: DAEMON vboxguest
+# REQUIRE: DAEMON vboxguest ntpdate ntpd
 # BEFORE: LOGIN
 # KEYWORD: shutdown
 
@@ -11,16 +11,36 @@
 #
 # vboxservice_enable (bool):  Set to "NO" by default.
 #                             Set it to "YES" to enable VBoxService.
+#
+# vboxservice_ignore_ntpd (bool):  Set to "NO" by default.
+#                                  Set it to "YES" to allow VBoxService start
+#                                  with ntpd running
 
 . /etc/rc.subr
 
 name="vboxservice"
 rcvar=`set_rcvar`
 command="%%PREFIX%%/sbin/VBoxService"
+start_precmd="vboxservice_prestart"
 
 load_rc_config $name
 
 : ${vboxservice_enable="NO"}
 : ${vboxservice_flags=""}
+: ${vboxservice_ignore_ntpd="NO"}
+: ${ntpd_enable="NO"}
+: ${ntpdate_enable="NO"}
+
+vboxservice_prestart()
+{
+	if checkyesno ntpd_enable || checkyesno ntpdate_enable; then
+		if checkyesno vboxservice_ignore_ntpd; then
+			return 0
+		else
+			err 1 "To prevent time source conflict, ntpd(8) and \
+ntpdate(8) must be disabled in rc.conf while VirtualBox Additions are in use."
+		fi
+	fi
+}
 
 run_rc_command "$1"
diff -ruN virtualbox-ose-additions.bak/pkg-message virtualbox-ose-additions/pkg-message
--- virtualbox-ose-additions.bak/pkg-message	1970-01-01 00:00:00.000000000 +0000
+++ virtualbox-ose-additions/pkg-message	2011-04-19 22:18:41.000000000 +0000
@@ -0,0 +1,18 @@
+
+------------------------------------------------------------------------------
+To run VirtualBox Additions from startup, add the following in /etc/rc.conf:
+
+  vboxguest_enable="YES"
+  vboxservice_enable="YES"
+
+To prevent time source conflict, both ntpd(8) and ntpdate(8) must be disabled
+in rc.conf while VirtualBox Additions are in use. You may use ntpd in your
+host OS instead.
+
+If you still wish to use ntpd in guest OS you should disable time sync by
+the VirtualBox Additions - add extra lines in your in /etc/rc.conf:
+
+  vboxservice_flags="--disable-timesync"
+  vboxservice_ignore_ntpd="YES"
+
+------------------------------------------------------------------------------


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list