Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Time reverts 7 hours back after each boot

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
lensesSenses
Posts: 3
Joined: 2019-01-16 19:48

Time reverts 7 hours back after each boot

#1 Post by lensesSenses »

Hello, I just installed Debian 9 and one thing I noticed is that I can't set the time right.
After adjusting the correct time and click 'Set System Time..' button, it changes but after each boot it will go back 7 hours.
I suspect I messed up when I had to select my timezone during installation which I just clicked next.

I also tried with terminal using

Code: Select all

sudo date --set
but the result only stays temporary.
Can you please guide me through fixing the clock? ty

Bulkley
Posts: 6386
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: Time reverts 7 hours back after each boot

#2 Post by Bulkley »

Is the battery any good?

lensesSenses
Posts: 3
Joined: 2019-01-16 19:48

Re: Time reverts 7 hours back after each boot

#3 Post by lensesSenses »

Bulkley wrote:Is the battery any good?
I should've mentioned I'm on a laptop, do you think I should get the CMOS battery inspected?

User avatar
sunrat
Administrator
Administrator
Posts: 6457
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 472 times

Re: Time reverts 7 hours back after each boot

#4 Post by sunrat »

Is this a dual boot system including Windows?
Is the hardware clock set to UTC or local time?
What time zone are you in, 7 hours different from UTC?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

lensesSenses
Posts: 3
Joined: 2019-01-16 19:48

Re: Time reverts 7 hours back after each boot

#5 Post by lensesSenses »

sunrat wrote:Is this a dual boot system including Windows?
Is the hardware clock set to UTC or local time?
What time zone are you in, 7 hours different from UTC?
I had single boot Ubuntu and installed debian over that, using whole drive. It did leave a uefi entry
Hardware clock is set to UTC (should I change it to 'LOCAL' ?)
I'm currently in Athens so I guess this is EET?

hwclock returns the time like this, is this normal?

Code: Select all

# hwclock 
2019-01-16 23:46:34.570013-0500

Bulkley
Posts: 6386
Joined: 2006-02-11 18:35
Has thanked: 2 times
Been thanked: 39 times

Re: Time reverts 7 hours back after each boot

#6 Post by Bulkley »

Take a look at ntpdate. If you have an Internet connection you'll never set time on a computer.

User avatar
sunrat
Administrator
Administrator
Posts: 6457
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 472 times

Re: Time reverts 7 hours back after each boot

#7 Post by sunrat »

UTC is default and Athens is UTC +2. Are you sure you have your timezone set correctly? UTC -5 is the time in New York.
Try

Code: Select all

# dpkg-reconfigure tzdata
There's probably some GUI way to do it depending on your DE.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 133 times

Re: Time reverts 7 hours back after each boot

#8 Post by Head_on_a_Stick »

Code: Select all

timedatectl set-ntp on
deadbang

CwF
Global Moderator
Global Moderator
Posts: 2669
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: Time reverts 7 hours back after each boot

#9 Post by CwF »

Edit /etc/adjtime, and change "UTC" to "LOCAL" if you want the hardware clock to be kept at local time instead of UTC.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Time reverts 7 hours back after each boot

#10 Post by llivv »

CwF wrote:Edit /etc/adjtime, and change "UTC" to "LOCAL" if you want the hardware clock to be kept at local time instead of UTC.
What is the diff between /etc/adjtime LOCAL and dpkg-reconfigure tzdata?
How does /etc/adjtime know what local time to use?
my time is set to my local time using dpkg-reconfigure tzdata and my /etc/adjtime is set to UTC

I also have /etc/timezone with my local time settings

nice find by the way CwF !

NTP daemon will sync the hwclock to the ntp servers time automagically
although it will not change timezone settings

ntpdate is a debain script to sync to debian ntp servers
but must be run manually every once in a while using

Code: Select all

 /usr/sbin/ntpdate-debian
17 Jan 11:39:26 ntpdate[2187]: step time server 204.9.54.119 offset -8.101395 sec
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1398
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 46 times
Been thanked: 68 times

Re: Time reverts 7 hours back after each boot

#11 Post by None1975 »

llivv wrote:NTP daemon will sync the hwclock to the ntp servers time automagically
This is not necessary. You can use systemd utilities. For example, systemd-timesyncd is a daemon that has been added for synchronizing the system clock across the network. It implements an SNTP client. In contrast to NTP implementations such as chrony or the NTP reference server this only implements a client side, and does not bother with the full NTP complexity, focusing only on querying time from one remote server and synchronizing the local clock to it. Unless you intend to serve NTP to networked clients or want to connect to local hardware clocks this simple NTP client should be more than appropriate for most installations.
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Time reverts 7 hours back after each boot

#12 Post by Segfault »

Your Debian is hinting it is time to move to Jamaica.

User avatar
llivv
Posts: 5340
Joined: 2007-02-14 18:10
Location: cold storage

Re: Time reverts 7 hours back after each boot

#13 Post by llivv »

Bob Marley wrote:don't worry... / be happy....
Dr E vil wrote:making two (binary compatiable) moon bases, moon unit alpha and moon unit zappa :cry:
In memory of Ian Ashley Murdock (1973 - 2015) founder of the Debian project.

Post Reply