Last active
October 22, 2024 17:38
-
-
Save unfulvio/1f921b3f356c25414b36e2423f5052da to your computer and use it in GitHub Desktop.
How to change server time on a Vagrant box on Virtualbox
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Log in into the box | |
vagrant ssh | |
# VirtualBox syncs host time with guest, so we need to shut off VBox Guest Additions first | |
sudo service vboxadd-service stop | |
# Now you can set any date and time | |
sudo date -s "2020-10-01 10:25:00" | |
# Want to sync again with host? Restart Guest Additions | |
# Anyway on the next Vagrant up it will sync again regardless | |
sudo service vboxadd-service start |
thanks, it works like a charm
sudo service vboxadd-service stop
and sudo service vboxadd-service start
is not needed in laravel homstead
Thanks... Was a lifesaver for me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have the same problem... But in my case the actual time is incorrect, I want to fix it and NOTHING! :-/
[root@localhost ~]# service vboxadd-service stop
vboxadd-service.sh: Stopping VirtualBox Guest Addition service.
vboxadd-service.sh: VirtualBox Guest Addition service failed to stop.
[root@localhost ~]# service vboxadd-service stop
[root@localhost ~]# date -s "2018-05-24 12:12:50"
Thu May 24 12:12:50 UTC 2018
[root@localhost ~]# service vboxadd-service start
vboxadd-service.sh: Starting VirtualBox Guest Addition service.
[root@localhost ~]# date
Thu May 24 15:12:44 UTC 2018