How to Update the Date and Time in Ubuntu with NTP

Ubuntu Logo

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.

Issue

Updating your system’s with NTPDate throws the error, bind() fails: Permission denied, or “The NTP socket is in use, exiting”.

Solution

  1. Install NTPDdate
1
2
sudo apt-get install ntp
sudo apt-get install ntpdate
  1. Stop the NTP service
1
sudo service ntp stop
  1. Update the date and time
1
sudo ntpdate time.nist.gov

Common Errors

Error: bind() fails: Permission denied

You need to execute the command using sudo.

Error: The NTP socket is in use, exiting

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.