Debian Guest on Virtualbox - wrong time

Aus Weis nix
Wechseln zu: Navigation, Suche

After setting up a debian Guest Server on a Virtualbox Headless machine, the Time in the Debian VBox was drifting forward within minutes for more than 10secs.

After trying to find the reason for that, I did a lot of things with /etc/init.d/ntp and ntpdate ...

Debian uses the hwclock to set the correct time but expects it to be UTC. Virtualbox sets the Hardware Clock to the Timezone you live in (the server resides in). Therefore its a good idea to set "UTC=no" in /etc/default/rcS.

But the solution to the Problem finally was :

It looks like you have to install the Guest Additions on your Debian Headless virtual machine:

On the Host:

  1. Login as virtuser
  2. Find vm names or ids with VBoxManage list vms
  3. Do VBoxManage controlvm VMNAMEorVMID dvdattach /usr/share/virtualbox/VBoxGuestAdditions.iso

On the Guest:

  1. Login to your Guestsystem as root;
  2. Update your APT database with apt-get update;
  3. Install the latest security updates with apt-get upgrade;
  4. Install required packages with apt-get install build-essential module-assistant;
  5. Configure your system for building kernel modules by running m-a prepare;
  6. mount the CD/DVD on the Guest "mount /media/cdrom"
  7. Do "/bin/bash /media/cdrom/VBoxLinuxAdditions-x86.run

On the Host:

  1. VBoxManage controlvm VMNAMEorVMID dvdattach none

On the Guest:

  1. reboot

After the reboot, the System has the right time. Even with ntp removed.