How to fix incorrect UTC time on Debian/Ubuntu

I was getting headache when I am trying to fix the time of a Linux Mint server PC. The current time was suddenly become 1 hour ahead the correct time. I don’t know how or when did it happen. I have googled a lot to find a solution but I couldn’t find a simple ‘how to’. My problem looks similar to this.

ali@merbabu:~$ date -u
Wed May 25 01:13:38 UTC 2016

The UTC time shows 01:13:38 instead of 02:13:38.

Please take a note that in this case, NTP is not an option because the ISP that I am using is blocking the protocol. So, if I am able connect to the NTP service, I would like to use NTP instead of changing the time manually.

So, here is the solution:

  1. Change the current default time zone to UTC:
    ali@merbabu:~$ sudo dpkg-reconfigure tzdata
    

    tzdata

    There will be several options. Choose ‘None of the above’, then choose ‘UTC’.

    Current default time zone: 'Etc/UTC'
    Local time is now:      Wed May 25 01:14:04 UTC 2016.
    Universal Time is now:  Wed May 25 01:14:04 UTC 2016.
  2. Change/set the system time to the correct time:
    ali@merbabu:~$ sudo date --set 02:17:30
    Wed May 25 02:17:30 UTC 2016
  3. Set the hardware/BIOS time to match the system time:
    ali@merbabu:~$ sudo hwclock --systohc --utc
    ali@merbabu:~$ date
    Wed May 25 02:17:41 UTC 2016

That’s it!

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s