Time out of sync using VirtualBox + Vagrant + Homestead









up vote
2
down vote

favorite












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?










share|improve this question

















  • 1




    I have had this issue in the past as well. The only workaround I found was letting the computer put the monitor to sleep, but not the hard-drives. You also might try making sure the VirtualBox Guest Additions are up-to-date. (Placing this as a comment, and not a solution, because its only a work-around.)
    – mike.bronner
    Jan 14 at 18:20











  • The VirtualBox Guest Additions are up to date. Not letting the hard drives sleep is not ideal. I will keep looking for a better solution. Thanks though.
    – Fredrik
    Jan 15 at 9:45










  • So far the best solution is in this comment: stackoverflow.com/a/46480998/5191800
    – Fredrik
    Feb 4 at 11:46














up vote
2
down vote

favorite












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?










share|improve this question

















  • 1




    I have had this issue in the past as well. The only workaround I found was letting the computer put the monitor to sleep, but not the hard-drives. You also might try making sure the VirtualBox Guest Additions are up-to-date. (Placing this as a comment, and not a solution, because its only a work-around.)
    – mike.bronner
    Jan 14 at 18:20











  • The VirtualBox Guest Additions are up to date. Not letting the hard drives sleep is not ideal. I will keep looking for a better solution. Thanks though.
    – Fredrik
    Jan 15 at 9:45










  • So far the best solution is in this comment: stackoverflow.com/a/46480998/5191800
    – Fredrik
    Feb 4 at 11:46












up vote
2
down vote

favorite









up vote
2
down vote

favorite











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?










share|improve this question













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?







vagrant virtualbox homestead






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 14 at 11:25









Fredrik

599224




599224







  • 1




    I have had this issue in the past as well. The only workaround I found was letting the computer put the monitor to sleep, but not the hard-drives. You also might try making sure the VirtualBox Guest Additions are up-to-date. (Placing this as a comment, and not a solution, because its only a work-around.)
    – mike.bronner
    Jan 14 at 18:20











  • The VirtualBox Guest Additions are up to date. Not letting the hard drives sleep is not ideal. I will keep looking for a better solution. Thanks though.
    – Fredrik
    Jan 15 at 9:45










  • So far the best solution is in this comment: stackoverflow.com/a/46480998/5191800
    – Fredrik
    Feb 4 at 11:46












  • 1




    I have had this issue in the past as well. The only workaround I found was letting the computer put the monitor to sleep, but not the hard-drives. You also might try making sure the VirtualBox Guest Additions are up-to-date. (Placing this as a comment, and not a solution, because its only a work-around.)
    – mike.bronner
    Jan 14 at 18:20











  • The VirtualBox Guest Additions are up to date. Not letting the hard drives sleep is not ideal. I will keep looking for a better solution. Thanks though.
    – Fredrik
    Jan 15 at 9:45










  • So far the best solution is in this comment: stackoverflow.com/a/46480998/5191800
    – Fredrik
    Feb 4 at 11:46







1




1




I have had this issue in the past as well. The only workaround I found was letting the computer put the monitor to sleep, but not the hard-drives. You also might try making sure the VirtualBox Guest Additions are up-to-date. (Placing this as a comment, and not a solution, because its only a work-around.)
– mike.bronner
Jan 14 at 18:20





I have had this issue in the past as well. The only workaround I found was letting the computer put the monitor to sleep, but not the hard-drives. You also might try making sure the VirtualBox Guest Additions are up-to-date. (Placing this as a comment, and not a solution, because its only a work-around.)
– mike.bronner
Jan 14 at 18:20













The VirtualBox Guest Additions are up to date. Not letting the hard drives sleep is not ideal. I will keep looking for a better solution. Thanks though.
– Fredrik
Jan 15 at 9:45




The VirtualBox Guest Additions are up to date. Not letting the hard drives sleep is not ideal. I will keep looking for a better solution. Thanks though.
– Fredrik
Jan 15 at 9:45












So far the best solution is in this comment: stackoverflow.com/a/46480998/5191800
– Fredrik
Feb 4 at 11:46




So far the best solution is in this comment: stackoverflow.com/a/46480998/5191800
– Fredrik
Feb 4 at 11:46












5 Answers
5






active

oldest

votes

















up vote
2
down vote













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.






share|improve this answer



























    up vote
    0
    down vote













    When your computer sleeps it's using vagrant suspend command which is like hitting the pause button on time (and the universe) as far as the virtual machine is considered.



    The only real fix is to manually vagrant halt your VMs before you let your computer sleep.






    share|improve this answer



























      up vote
      0
      down vote













      You can run:



      sudo service ntp stop && sudo ntpdate -s time.nist.gov && sudo service ntp start



      (You may need to install ntpdate)



      I've added this to after.sh so it runs on provision, but it doesn't run on wake or "up".



      I'd love to find a way to do that automatically.






      share|improve this answer




















      • In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
        – Fredrik
        Mar 23 at 23:55










      • ntpdate is not installed on my homestead :(
        – Yevgeniy Afanasyev
        Sep 6 at 23:49

















      up vote
      0
      down vote













      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.







      share|improve this answer



























        up vote
        0
        down vote













        I logged into my database via phpmyAdmin, and server time synced correctly. Try it






        share|improve this answer




















          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48249066%2ftime-out-of-sync-using-virtualbox-vagrant-homestead%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          5 Answers
          5






          active

          oldest

          votes








          5 Answers
          5






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          2
          down vote













          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.






          share|improve this answer
























            up vote
            2
            down vote













            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.






            share|improve this answer






















              up vote
              2
              down vote










              up vote
              2
              down vote









              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.






              share|improve this answer












              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.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Apr 17 at 11:09









              Yami Glick

              1,313186




              1,313186






















                  up vote
                  0
                  down vote













                  When your computer sleeps it's using vagrant suspend command which is like hitting the pause button on time (and the universe) as far as the virtual machine is considered.



                  The only real fix is to manually vagrant halt your VMs before you let your computer sleep.






                  share|improve this answer
























                    up vote
                    0
                    down vote













                    When your computer sleeps it's using vagrant suspend command which is like hitting the pause button on time (and the universe) as far as the virtual machine is considered.



                    The only real fix is to manually vagrant halt your VMs before you let your computer sleep.






                    share|improve this answer






















                      up vote
                      0
                      down vote










                      up vote
                      0
                      down vote









                      When your computer sleeps it's using vagrant suspend command which is like hitting the pause button on time (and the universe) as far as the virtual machine is considered.



                      The only real fix is to manually vagrant halt your VMs before you let your computer sleep.






                      share|improve this answer












                      When your computer sleeps it's using vagrant suspend command which is like hitting the pause button on time (and the universe) as far as the virtual machine is considered.



                      The only real fix is to manually vagrant halt your VMs before you let your computer sleep.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jan 15 at 13:37









                      joepferguson

                      803413




                      803413




















                          up vote
                          0
                          down vote













                          You can run:



                          sudo service ntp stop && sudo ntpdate -s time.nist.gov && sudo service ntp start



                          (You may need to install ntpdate)



                          I've added this to after.sh so it runs on provision, but it doesn't run on wake or "up".



                          I'd love to find a way to do that automatically.






                          share|improve this answer




















                          • In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
                            – Fredrik
                            Mar 23 at 23:55










                          • ntpdate is not installed on my homestead :(
                            – Yevgeniy Afanasyev
                            Sep 6 at 23:49














                          up vote
                          0
                          down vote













                          You can run:



                          sudo service ntp stop && sudo ntpdate -s time.nist.gov && sudo service ntp start



                          (You may need to install ntpdate)



                          I've added this to after.sh so it runs on provision, but it doesn't run on wake or "up".



                          I'd love to find a way to do that automatically.






                          share|improve this answer




















                          • In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
                            – Fredrik
                            Mar 23 at 23:55










                          • ntpdate is not installed on my homestead :(
                            – Yevgeniy Afanasyev
                            Sep 6 at 23:49












                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          You can run:



                          sudo service ntp stop && sudo ntpdate -s time.nist.gov && sudo service ntp start



                          (You may need to install ntpdate)



                          I've added this to after.sh so it runs on provision, but it doesn't run on wake or "up".



                          I'd love to find a way to do that automatically.






                          share|improve this answer












                          You can run:



                          sudo service ntp stop && sudo ntpdate -s time.nist.gov && sudo service ntp start



                          (You may need to install ntpdate)



                          I've added this to after.sh so it runs on provision, but it doesn't run on wake or "up".



                          I'd love to find a way to do that automatically.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Mar 23 at 21:56









                          Hatcham

                          300210




                          300210











                          • In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
                            – Fredrik
                            Mar 23 at 23:55










                          • ntpdate is not installed on my homestead :(
                            – Yevgeniy Afanasyev
                            Sep 6 at 23:49
















                          • In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
                            – Fredrik
                            Mar 23 at 23:55










                          • ntpdate is not installed on my homestead :(
                            – Yevgeniy Afanasyev
                            Sep 6 at 23:49















                          In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
                          – Fredrik
                          Mar 23 at 23:55




                          In the latest release of Homestead, ntpdate is installed by default. So as of now, i run ntpdate ntp.ubuntu.com every time I wake up my computer. It’s not really ideal. I am thinking about making some sort of script for it.
                          – Fredrik
                          Mar 23 at 23:55












                          ntpdate is not installed on my homestead :(
                          – Yevgeniy Afanasyev
                          Sep 6 at 23:49




                          ntpdate is not installed on my homestead :(
                          – Yevgeniy Afanasyev
                          Sep 6 at 23:49










                          up vote
                          0
                          down vote













                          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.







                          share|improve this answer
























                            up vote
                            0
                            down vote













                            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.







                            share|improve this answer






















                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              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.







                              share|improve this answer












                              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.








                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Sep 6 at 23:48









                              Yevgeniy Afanasyev

                              7,75544464




                              7,75544464




















                                  up vote
                                  0
                                  down vote













                                  I logged into my database via phpmyAdmin, and server time synced correctly. Try it






                                  share|improve this answer
























                                    up vote
                                    0
                                    down vote













                                    I logged into my database via phpmyAdmin, and server time synced correctly. Try it






                                    share|improve this answer






















                                      up vote
                                      0
                                      down vote










                                      up vote
                                      0
                                      down vote









                                      I logged into my database via phpmyAdmin, and server time synced correctly. Try it






                                      share|improve this answer












                                      I logged into my database via phpmyAdmin, and server time synced correctly. Try it







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 10 at 21:35









                                      Toni

                                      371221




                                      371221



























                                          draft saved

                                          draft discarded
















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f48249066%2ftime-out-of-sync-using-virtualbox-vagrant-homestead%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Use pre created SQLite database for Android project in kotlin

                                          Darth Vader #20

                                          Ondo