The vboxadd-service
in my VirtualBox guests has to be running to obtain an ip from the following VagrantFile
code snippet, or else the vagrant hostupdater
command won't work as expected:
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if vm.id
`VBoxManage guestproperty get #{vm.id} "/VirtualBox/GuestInfo/Net/2/V4/IP"`.split()[1]
end
end
Resulting /etc/hosts
file when vboxadd-service
is turned off:
## vagrant-hostmanager-start
value bareOSdirector
value webserver
value bareOSremoteSD
## vagrant-hostmanager-end
And this is because...
If the vboxadd-service
is running...you can run this command and get:
VBoxManage guestproperty get "turnkey_lamp_packer_test_webserver_1502906374188_41719" "/VirtualBox/GuestInfo/Net/2/V4/IP"
Value: 10.0.3.8
But if it is not running instead you'll get:
VBoxManage guestproperty get "turnkey_lamp_packer_test_webserver_1502906374188_41719" "/VirtualBox/GuestInfo/Net/2/V4/IP"
No value set!
But in order for me to be able to easily change the time across my VMs for testing things out...the vboxadd-service
has to NOT be running on a guest vm, or else the time will sync with the host machine when I change it using the sudo date -s
command.
How can one keep the vboxadd-service
running while ignoring the time sync, apart from starting and stopping the service every time? Is there a way to keep the service running without syncing the time with the host?