88

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?

dysonsphere
  • 881
  • 1
  • 7
  • 3
  • 11
    Dude... your computer is fine - it is 1969. Woodstock is apparently going to be pretty good this year... – GrayedFox Mar 05 '18 at 01:24
  • To everyone with a later release:

    Quote: "Since Ubuntu 16.04 timedatectl / timesyncd (which are part of systemd) replace most of ntpdate / ntp. "

    From: https://ubuntu.com/server/docs/network-ntp

    – opinion_no9 Feb 06 '20 at 17:19
  • You may also need to set your timezone: https://www.serverlab.ca/tutorials/linux/administration-linux/how-to-check-and-set-timezone-in-ubuntu-20-04/ – GDP2 Nov 28 '21 at 03:18

8 Answers8

93

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.

Will Daniels
  • 1,756
  • 18 Apr 15:06:04 ntpdate[29230]: no server suitable for synchronization found – Vipin Verma 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 – Vipin Verma 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
  • 4
    maybe need: sudo apt-get install ntpdate beforehand – arcseldon May 13 '19 at 00:47
  • For some reason the ntpd on one of my servers stopped doing anything. Not amount of restart and/or uninstall+reinstall will get it working. Adding ntpdate ntp.ubuntu.com in root's crontab does the trick. – pieroxy Sep 26 '25 at 11:45
42

Just install ntp server:

sudo apt-get install ntp

It will automatically keep your clock synchronized.

Eric Carvalho
  • 55,573
  • 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 02 '14 at 08: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 04:56
  • Mine took a few minutes to run, then it finally set the clock correctly – Sam Barnum Aug 02 '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
26

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.

  • 14
    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? – Gabriel Fair Apr 20 '18 at 16:39
  • 1
    @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

find your timezone:

timedatectl list-timezones

and then set your timezone based on your choice:

timedatectl set-timezone <YOUR_TIME_ZONE>
Sina
  • 231
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.

aizquier
  • 186
3

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
shylynx
  • 2,411
2

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

sudo ntpdate <my.ntp.server>
sudo hwclock -w
renedet
  • 121
1

Install this package to get the clock of your server right:

sudo apt install aptitude
sudo aptitude install ntp

Then define your time zone (the one where your server is located):

sudo dpkg-reconfigure tzdata

Details:

https://safaetulahasan.medium.com/set-time-of-your-server-right-7145899166a4