[Pkg-virtualbox-devel] Bug#735595: virtualbox-guest-utils: guest additions should write system time to RTC after adjusting it

Sam Morris sam at robots.org.uk
Thu Jan 16 18:45:18 UTC 2014


Package: virtualbox-guest-utils
Version: 4.3.2-dfsg-1+b1
Severity: normal
Forwarded: https://www.virtualbox.org/ticket/11980

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

When systemd is used inside a VirtualBox virtual machine, the clock is
always wrong during bootup. This causes boot failure when e2fsck sees
that the modification date of the filesystem is newer than the system
time.

The reason is because systemd does not sync the system clock to the RTC
during shutdown. The rationale is documented at
<http://lists.freedesktop.org/archives/systemd-devel/2011-May/002526.html>.

My workaround is to drop the following file in to
/etc/systemd/system/virtualbox-hwclock.service:

	[Unit]
	Description=Save system time to RTC before shutdown
	Documentation=https://www.virtualbox.org/ticket/11980
	Before=final.target
	DefaultDependencies=no

	[Service]
	ExecStart=/sbin/hwclock --systohc
	Type=oneshot
	RemainAfterExit=yes

	[Install]
	WantedBy=final.target

Running 'systemctl daemon-reload && systemctl install
virtualbox-hwclock.service' ensures that hwclock will be run before
halt/shutdown/reboot/kexec, etc.

I suggest shipping the systemd unit as part of the
virtualbox-guest-utils package. If you want to do that, drop the file
into /lib/systemd/system, add dh-systemd to Build-Depends and then run
dh_systemd_enable in the postinst. If you use dh, you can add '--with
systemd' to the command line to have it done for you.

- -- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (540, 'testing'), (530, 'unstable'), (520, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.12-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages virtualbox-guest-utils depends on:
ii  adduser   3.113+nmu3
ii  dpkg      1.17.5
ii  libc6     2.17-97
ii  libpam0g  1.1.3-9
ii  pciutils  1:3.2.1-1

Versions of packages virtualbox-guest-utils recommends:
ii  virtualbox-guest-dkms  4.3.2-dfsg-1
ii  virtualbox-guest-x11   4.3.2-dfsg-1+b1

virtualbox-guest-utils suggests no packages.

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlLYKLkACgkQshl/216gEHiPcACfYSFdOoj5r8q7fpAapSrobH0H
hvIAoK5X/rlToa5QI/ZipqEx7XksX8E6
=+wLP
-----END PGP SIGNATURE-----



More information about the Pkg-virtualbox-devel mailing list