66

I just ran a clean install of 12.10 on my sys76 laptop.

Time and date reads: 19:36 31 december 1969, even though it is: 13:29 07 november 2012.

I have it set for my location and it won't change manually, even tried in the command line with tz.

I think it is messing up the security certificates over the Internet cause I cannot change PPA over command line and going to Launchpad brings up the certificates page in Firefox.

Is this some known bug or is there a fix for it?

3
75

Try:

sudo ntpdate ntp.ubuntu.com

Yes, it would certainly mess with the SSL certificates, because they would be future-dated.

I doubt it's a bug in Ubuntu. Your CMOS clock in the BIOS must have been set to that somehow.

4
  • 18 Apr 15:06:04 ntpdate[29230]: no server suitable for synchronization found
    – vipin8169
    Apr 18 '16 at 10:36
  • 2
    after installing >> sudo apt-get install ntp>> 18 Apr 15:07:03 ntpdate[30070]: the NTP socket is in use, exiting
    – vipin8169
    Apr 18 '16 at 10:37
  • 1
    That's fine for a one-off fix, but you'll still have system drift and get off again. You really want to install ntp to get the ntpd deamon running (At that point ntpdate will then give the error "the NTP socket is in use, exiting" which is what you want, because ntpd is taking care of keeping the clock in sync)
    – Randall
    Oct 28 '16 at 14:46
  • 2
    maybe need: sudo apt-get install ntpdate beforehand
    – arcseldon
    May 13 '19 at 0:47
29

Just install ntp server:

sudo apt-get install ntp

It will automatically keep your clock synchronized.

5
  • This fixed the problem for me on Ubuntu 13.10. No idea why. (Problem was that the clock was off by one hour after daylight saving time/summer time took effect.)
    – Carl
    Apr 2 '14 at 8:40
  • I installed ntp however my time is still ahead by 5 minutes. How long does it take to update the time or do I need to run any command after? Thanks
    – Mo.
    Jul 12 '15 at 4:56
  • Mine took a few minutes to run, then it finally set the clock correctly
    – Sam Barnum
    Aug 2 '17 at 15:08
  • well this doesn't help if apt-get fails because of gpg errors that come from the system time being wrong
    – Algoman
    Nov 20 '20 at 13:09
  • Installing this package removes another one systemd-timesyncd. Is it OK to do it?
    – Piotrek
    Oct 20 '21 at 10:47
19

Install ntp and ntpdate executing the following commands-

sudo apt-get install ntp
sudo apt-get install ntpdate

Then, execute

sudo ntpdate ntp.ubuntu.com

This works for me.

3
  • 11
    Pretty sure that if you do it in that order, that ntpdate will give the error "the NTP socket is in use, exiting" because the ntp package should have started ntpd which grabs the socket.
    – Randall
    Oct 28 '16 at 14:48
  • Don't you only need ntp? Apr 20 '18 at 16:39
  • @Randall is correct, however it still updates the time. Don't know if there are any other side effects though.
    – JBaczuk
    Jun 15 '18 at 15:58
5

After installing 12.10 I had the same problem as well. Somehow the new installation set the BIOS clock to the year 2070 !! After this, Ubuntu wasn't able to set a different date both by ntp, manually, even using the date command.

Setting the right date in the BIOS settings solved the problem.

1
  • how did you set the right date in the BIOS?
    – Josh
    Sep 5 '19 at 20:10
2

This works for Ubuntu 16.04

  1. Stop the ntp service

  2. Run ntpdate command to fetch date/time from ntp.ubuntu.com

    systemctl stop ntp
    sudo ntpdate -s ntp.ubuntu.com
    

P.S: Make sure ntp is installed, if not just do

sudo apt-get install ntp
1

I changed the hardware clock. Use the hwclock command to fix it:

sudo ntpdate <my.ntp.server>
sudo hwclock -w

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.