Here’s how to fix the date and time on Ubuntu using NTP.
I fired up a Virtual Machine that I’d created months ago to update a Let’s Encrypt certificate and noticed that the date showed as January, but it was actually April. This particular VM didn’t have VMWare Tools installed [yet] so it wasn’t picking up on the host’s time. It’s no problem to fix, just update the time using NTP.
Updating your system’s with NTPDate throws the error, bind() fails: Permission denied, or “The NTP socket is in use, exiting”.
- Install NTPDdate
sudo apt-get install ntp
- Stop the NTP service
sudo service ntp stop
- Update the date and time
sudo ntpdate time.nist.gov
You need to execute the command using sudo.
The reason you get the socket error is because NTP is already using that socket. You need to stop the process, force an update, then restart the daemon.