78

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?

Organic Marble
  • 22,803
  • 12
  • 65
  • 118
dysonsphere
  • 781
  • 1
  • 6
  • 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

7 Answers7

87

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.

Peter Mortensen
  • 933
  • 2
  • 11
  • 17
Will Daniels
  • 1,696
  • 11
  • 10
  • 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
  • 3
    maybe need: `sudo apt-get install ntpdate` beforehand – arcseldon May 13 '19 at 00:47
35

Just install ntp server:

sudo apt-get install ntp

It will automatically keep your clock synchronized.

Eric Carvalho
  • 53,609
  • 102
  • 137
  • 162
  • 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
22

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.

Dare Devil
  • 396
  • 1
  • 3
  • 7
  • 13
    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

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
  • 4
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
  • 1
  • 10
  • 9
1

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

sudo ntpdate <my.ntp.server>
sudo hwclock -w
Peter Mortensen
  • 933
  • 2
  • 11
  • 17
renedet
  • 111
  • 2
0

find your timezone:

timedatectl list-timezones

and then set your timezone based on your choice:

timedatectl set-timezone <YOUR_TIME_ZONE>
Sina
  • 101
  • 2