How to correct system clock in vagrant automatically

The simplest way is to set the timezone automatically is to use the vagrant-timezone plugin.

Install it once with:

vagrant plugin install vagrant-timezone



After that, add the below to your Vagrantfile:

if Vagrant.has_plugin?("vagrant-timezone")
   config.timezone.value = "UTC"
end

You may replace "UTC" with any of the tz values listed here. For example: "Asia/Kolkata".



Or you can use your host's timezone with this entry in your Vagrantfile:

if Vagrant.has_plugin?("vagrant-timezone")
   config.timezone.value = :host
end

The method I use and it should not be provider specific is to add the following in my Vagrantfile

  config.vm.provision :shell, :inline => "sudo rm /etc/localtime && sudo ln -s /usr/share/zoneinfo/Europe/Paris /etc/localtime", run: "always"

you would need to replace '/Europe/Paris' with the timezone you want to set