Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time out of sync using VirtualBox + Vagrant + Homestead

Whenever my computer sleeps, the time in the Homestead environment goes out of sync. The time doesn't update when it wakes up, it just keeps on going from when the computer started to sleep. This forces me to destroy and then up Vagrant.

Versions:

  • Homestead 5.0.1
  • Vagrant 2.0.1
  • VirtualBox 5.2.4

I have added this to the Vagrantfile:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
    config.vm.provider 'virtualbox' do |vb|
       vb.customize [ "guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000 ]
    end

    config.vm.provider "virtualbox" do |vb|
       vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
    end

    // More code...

How do I make the Homestead environment sync the time?

like image 406
Fredrik Avatar asked Jan 14 '18 11:01

Fredrik


2 Answers

I came across this solution when going out of sync with s3.

edit the ntp.conf

sudo vim /etc/ntp.conf

change the servers to:

server 0.amazon.pool.ntp.org iburst
server 1.amazon.pool.ntp.org iburst
server 2.amazon.pool.ntp.org iburst
server 3.amazon.pool.ntp.org iburst

restart the ntp service

sudo service ntp restart

and you're done.

like image 128
Yami Glick Avatar answered Oct 07 '22 17:10

Yami Glick


restart the ntp service

$sudo service ntp restart

Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. In operation since before 1985, NTP is one of the oldest Internet protocols in current use.

like image 1
Yevgeniy Afanasyev Avatar answered Oct 07 '22 18:10

Yevgeniy Afanasyev