I am trying to set the system date on my linux machine. If it matters, it is an Amazon EC2 machine that I provisioned. I tried to set the date with this command:

sudo date -s "19 APR 2018 11:14:00";

However the date does not stay set for long; when I run the following:

sudo date -s "19 APR 2018 11:14:00"; date; date; date; date; date; date

I obtain:

Thu Apr 19 11:14:00 UTC 2018
Thu Apr 19 11:14:00 UTC 2018
Thu Apr 19 11:14:00 UTC 2018
Thu Apr 19 11:14:00 UTC 2018
Thu Apr 19 11:14:00 UTC 2018
Thu Apr 19 11:14:00 UTC 2018
Thu Oct 25 18:37:09 UTC 2018

Is there a background process resetting the date every second or so? What is going on here? How can I fix it?

Thanks in advance!

  • 4
    The system is fixing it for you. You don't need to do anything. – Michael Hampton Oct 25 '18 at 18:50
  • 1
    (That system is likely to be something like ntp or chrony. You should note that disabling it to set an incorrect date may have side-effects; in my experience, for example, the AWS CodeDeploy agent fails if it sees more than about 15 minutes in time slip.) – ceejayoz Oct 25 '18 at 18:52
  • Hi Lorenzo, if the response below answered your question please upvote and accept it. That's the ServerFault's way to say thank you for the time and effort someone took to help you. Thanks! – MLu Nov 3 '18 at 4:00

It's being corrected by chrony, at least on my Amazon Linux 2 instance. When I run your command I see this in the journalctl logs:

Oct 26 01:17:19 .. dhclient[2183]: XMT: Solicit on eth0, interval 115280ms.
Apr 19 11:14:00 .. systemd[1]: Time has been changed
Apr 19 11:15:10 .. chronyd[1853]: Backward time jump detected!
Apr 19 11:15:10 .. chronyd[1853]: Can't synchronise: no selectable sources
Apr 19 11:18:23 .. chronyd[1853]: Selected source
Apr 19 11:18:23 .. chronyd[1853]: System clock wrong by 16380213.742276 seconds, adjustment started
Apr 19 11:18:24 .. chronyd[1853]: Selected source

Eventually chronyd will bring the time back to the correct one. If you want to use the instance with a wrong time you'll have to stop chrony:

[root@ip-172-31-31-74 ~]# systemctl stop chronyd.service 

Hope that helps :)


¿Have you checked your timezone? You can check you /etc/timezone file if your machine is a debian distribution


  • 2
    Which time zone do you have in mind? I am not aware of any time zone that is 6 months behind UTC. – kasperd Oct 25 '18 at 21:48
  • I didn´t realize the month. Tnks for the correction :) – David Garcia Oct 26 '18 at 12:32

Use ntp, easy to set and will synchronize you local time with the peers yo set.

  • 1
    OP has something like ntp in place. They're trying to set an invalid date, and are confused about what's fixing it. (That'd be ntp.) – ceejayoz Oct 25 '18 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.