If you use vagrant with the virtual box for your project then you might have come across system time sync issue. It happens when you have active system session and your host os either gets locked after a timeout or you lock it intentionally.

Two Unsync clocks

Two Unsync clocks

The issue is not as big as it is just that your host system and system you have installed in the vagrant get out of system time synchronization. It is very easy to sync them again. Just follow the steps below to sync them again so you can work on your project as it might have blocked you from processing anything in your virtual box.

You need to install below packages to sync your virtual system time with the host system.

ntp: ntpd server that helps you to adjusts the system time and utilities used to query and modify the ntpd daemon service.

ntpdate: tool to set the time and date via NTP server.

ntp-doc: NTP documentation

Step 1: Install NTP if you don’t have already.

yum install ntp ntpdate ntp-doc

Step 2: Start the installed service to use it afterward.

chkconfig ntpd on

Step 3: Below command will sync your systems times, so use it once or as needed in future. You have to run one of the below commands to access time from the different server.

server 0.rhel.pool.ntp.org

server 1.rhel.pool.ntp.org

server 2.rhel.pool.ntp.org

Step 4: That’s it

The above process needs to be done just once because you haven’t installed NTP on your virtual system. But in future, if you need to do the sync again then you just have stopped the ntpd service, sync the time and start the ntpd service again by executing below command one after another.

service ntpd stop

server 0.rhel.pool.ntp.org

service ntpd start

As I have mentioned earlier you can use any server listed in step 3 to sync your virtual system’s time

Feel free to ask any query that you might come across while performing the above step. We would be glad to help you in the process.

Thank you and stay Techie…