How To Update System Time and Date from the Internet on Linux Ubuntu
Getting your system clock right on Ubuntu can be a bit frustrating sometimes. Like, you think you’ve set everything correctly, but then timestamps are off, or apps complain about inaccurate time. Not sure why it’s so flaky, but toggling between manually setting and syncing from the net seems to help. This quick guide walks through how to use simple commands and settings so Ubuntu keeps its time accurate via internet servers. No need for complicated configs or third-party apps—just some terminal magic and a few clicks. Once configured, the system should stay synced, preventing those weird timestamp bugs and ensuring everything runs smoothly.
How to Fix Time and Date Sync Issues on Ubuntu
Ensure the system has internet access
First off, make sure the machine is actually online. If your internet isn’t working, nothing will sync properly. Open a browser and visit a website or ping Google from terminal (ping -c 3 google.com
). If that works, you’re good to go. If not, sort your network connection first—nothing else matters if the system can’t reach time servers in the first place. Sometimes firewall rules can block access, so keep that in mind if sync refuses to work even when online.
Open up the terminal and check current time sync status
This is kind of the core. Hit Ctrl + Alt + T to open terminal. Then run timedatectl status
. It shows info about your system clock and sync status. If NTP (Network Time Protocol) service is inactive or no, your system isn’t syncing automatically. On some machines this fails the first time, then works after a reboot, so if it seems off, try rebooting after enabling NTP.
timedatectl status
Look for NTP service. If it says inactive, that’s your problem.
Activate automatic time sync
This is the main fix—turning on NTP. Run sudo timedatectl set-ntp true
. That tells Ubuntu’s systemd to synchronize time as long as the network is up. Easy. Expect it to take a few seconds to kick in. Sometimes, this command doesn’t work right away, so if it’s not working, try rebooting or restarting the timedatectl service (sudo systemctl restart systemd-timesyncd
). It’s weird how sometimes it needs a fresh start to kick into gear, but it’s worth checking after a minute or so.
Verify that the sync is working
Run timedatectl status
again. You should see NTP service: active and System clock synchronized: yes. If not, double-check your internet is still working and maybe try a manual restart of the time sync service (sudo systemctl restart systemd-timesyncd
). On some setups, it just takes a little nudge. If it still doesn’t sync, check for any firewall rules blocking access to pool.ntp.org or your preferred time servers.
Extra tips if sync still doesn’t work
Sometimes, if the time still isn’t right, it’s worth pointing your system directly at a specific NTP server. For example, edit /etc/systemd/timesyncd.conf by running sudo nano /etc/systemd/timesyncd.conf
. Inside, add or uncomment the line like NTP=0.pool.ntp.org 1.pool.ntp.org
. Save and restart the service (sudo systemctl restart systemd-timesyncd
). Also, make sure your timezone is correct—run timedatectl list-timezones
to browse or set it explicitly with sudo timedatectl set-timezone America/New_York
or wherever you are.
Because of course, Ubuntu has to make it harder than necessary, and sometimes you need to specify the exact servers instead of relying on defaults.
If all else fails, consider alternative tools
On some setups, the default time sync system isn’t enough. You might want to try installing GitHub: Winhance (or just use standard NTP clients) as a backup. But usually, fiddling with timedatectl
or systemd-timesyncd
fixes most issues.
Summary
- Check internet connection — gotta reach those time servers.
- Run
timedatectl status
to see current sync status. - Enable auto-sync with
sudo timedatectl set-ntp true
. - Verify the sync actually took hold.
- Adjust for your timezone if needed, using
timedatectl set-timezone
.
Wrap-up
Getting your Ubuntu system to keep accurate time isn’t as hard as it sounds, once you know the commands and where to look. Sometimes, a reboot or restarting the service makes a big difference, especially on flaky setups or after network changes. If everything’s correct, your system should stay in sync, avoiding all those timestamp headaches and security warnings. Fingers crossed this helps someone avoid those annoying time desync issues that pop up for no reason.