84

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

8 Answers 8

89

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 Apr 18, 2016 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 Apr 18, 2016 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, 2016 at 14:46
  • 3
    maybe need: sudo apt-get install ntpdate beforehand
    – arcseldon
    May 13, 2019 at 0:47
36

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, 2014 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, 2015 at 4:56
  • Mine took a few minutes to run, then it finally set the clock correctly
    – Sam Barnum
    Aug 2, 2017 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, 2020 at 13:09
  • Installing this package removes another one systemd-timesyncd. Is it OK to do it?
    – Piotrek
    Oct 20, 2021 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.

3
  • 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, 2016 at 14:48
  • Don't you only need ntp? Apr 20, 2018 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, 2018 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, 2019 at 20:10
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
2

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

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

find your timezone:

timedatectl list-timezones

and then set your timezone based on your choice:

timedatectl set-timezone <YOUR_TIME_ZONE>
1
  • 1
    This was my issue, System was in wrong time zone
    – Arun
    Sep 21, 2023 at 5:32
0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .