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

 

 

 

Debian system clock reset hardware (BIOS) clock on boot [SOLVED]

Ask for help with issues regarding the Installations of the Debian O/S.
Post Reply
Message
Author
jazbar
Posts: 43
Joined: 2021-08-03 11:10
Has thanked: 4 times

Debian system clock reset hardware (BIOS) clock on boot [SOLVED]

#1 Post by jazbar »

I have 2 boot system Windows and Debian on separate disks. When Debian is loading always reset hardware (BIOS) clock on UTC time. I not be bothered if I use only Debian but whenewe is loading Windows, must always prior go to BIOS settings and set the time.
How to set the system (Debian) not to do that?
I tried solved the problem with hwclock (https://manpages.debian.org/stretch/uti ... .8.en.html) but this do not apply on my system.

Image
Last edited by jazbar on 2021-08-26 10:36, edited 1 time in total.
My PC: MB MSI 790GX-G65, AMD Phenom II X3, 6 GB RAM, onboard graphic HD3300 DirectX 10, (AMD 790GX chipset)

mm3100
Posts: 336
Joined: 2020-10-21 21:39
Has thanked: 8 times
Been thanked: 13 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#2 Post by mm3100 »

Windows uses local time while Debian uses UTC. You can easily change it on Debian, but then summer/standard time might not automatically change according to your region. So just have that in mind. You can change Windows to use universal time, but is a bit more troublesome.

To set Debian to use local time run

Code: Select all

timedatectl set-local-rtc 1 --adjust-system-clock 
Where set-local-rtc is your local time time zone, for me it is +1. To change back to UTC just run it again with 0 instead.
To check run

Code: Select all

timedatectl

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#3 Post by sunrat »

I prefer to set Windows to use UTC and leave the hwclock on UTC, which is dead easy and preferable to changing Linux to local time especially for a system with several Linux installations as I have.
Just need to set one registry entry:
Create HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversal
with this value:

Code: Select all

"RealTimeIsUniversal"=dword:00000001
or just save this as a ".reg" file and click on it to import to Windows registry:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
     "RealTimeIsUniversal"=dword:00000001
Thanks to https://wiki.archlinux.org/title/System ... ft_Windows
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

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

Re: Debian system clock reset hardware (BIOS) clock on boot

#4 Post by CwF »

..another reason not to dual boot!
there is also the older Debian method of /etc/adjtime which is 'UTC' or "LOCAL"
I think that still works, and the preferred methods posted above.

Be careful with the registry hack in windows! I'm sure it works better maybe post XP, don't know.
I still have somewhat current hardware XP's and when setting 'acquisition gadgets' hooked up on usb and serial ports something in the programming reverts the windows clock to bios as local +TZ regardless of the registry setting.

Only a reboot fixes it, so a few years ago I decided XP boxes are XP boxes... Virtual machines do do the job, assume the time is local, pass the devices, work fine.

jazbar
Posts: 43
Joined: 2021-08-03 11:10
Has thanked: 4 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#5 Post by jazbar »

^ ^ ^
Image

Is such GUI app exist in (Debian) Synaptic Package Manager. And if is what is the name of the package?
https://forums.opensuse.org/showthread. ... ost2491919
Last edited by jazbar on 2021-08-25 19:13, edited 1 time in total.
My PC: MB MSI 790GX-G65, AMD Phenom II X3, 6 GB RAM, onboard graphic HD3300 DirectX 10, (AMD 790GX chipset)

mm3100
Posts: 336
Joined: 2020-10-21 21:39
Has thanked: 8 times
Been thanked: 13 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#6 Post by mm3100 »

/etc/adjtime is a file. You need to edit it with editor like vim, nano or similar.

User avatar
4D696B65
Site admin
Site admin
Posts: 2696
Joined: 2009-06-28 06:09
Been thanked: 85 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#7 Post by 4D696B65 »

Please stop posting pictures of text. Just cut/paste the text into code tags. Thanks.

jazbar
Posts: 43
Joined: 2021-08-03 11:10
Has thanked: 4 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#8 Post by jazbar »

CwF wrote: 2021-08-25 15:14 ..another reason not to dual boot!
there is also the older Debian method of /etc/adjtime which is 'UTC' or "LOCAL"
I think that still works, and the preferred methods posted above.

Be careful with the registry hack in windows! I'm sure it works better maybe post XP, don't know.
I still have somewhat current hardware XP's and when setting 'acquisition gadgets' hooked up on usb and serial ports something in the programming reverts the windows clock to bios as local +TZ regardless of the registry setting.

Only a reboot fixes it, so a few years ago I decided XP boxes are XP boxes... Virtual machines do do the job, assume the time is local, pass the devices, work fine.
What should be written or correct in Nano Terminal? RTC = LOCAL time?
GNU nano 3.2 /etc/adjtime

Code: Select all

.000000 1629916542 0.000000
1629916542
UTC
My PC: MB MSI 790GX-G65, AMD Phenom II X3, 6 GB RAM, onboard graphic HD3300 DirectX 10, (AMD 790GX chipset)

mm3100
Posts: 336
Joined: 2020-10-21 21:39
Has thanked: 8 times
Been thanked: 13 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#9 Post by mm3100 »

Should be just LOCAL

Code: Select all

$ cat /etc/adjtime 
0.000000 1622327125 0.000000
1622327125
LOCAL
Command
timedatectl set-local-rtc 1 --adjust-system-clock
Does that for you
set-local-rtc [BOOL]
Takes a boolean argument. If "0", the system is configured to maintain the RTC in universal
time. If "1", it will maintain the RTC in local time instead. Note that maintaining the RTC in
the local timezone is not fully supported and will create various problems with time zone
changes and daylight saving adjustments. If at all possible, keep the RTC in UTC mode. Note that
invoking this will also synchronize the RTC from the system clock, unless --adjust-system-clock
is passed (see above). This command will change the 3rd line of /etc/adjtime, as documented in
hwclock(8).

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

Re: Debian system clock reset hardware (BIOS) clock on boot

#10 Post by CwF »

mm3100 wrote: 2021-08-25 19:34 0.000000 1622327125 0.000000
1622327125
jazbar wrote: 2021-08-25 19:24 .000000 1629916542 0.000000
1629916542
Any one have any idea what the magic numbers are all about?

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#11 Post by sunrat »

CwF wrote: 2021-08-25 15:14 ..another reason not to dual boot!
What was the first reason? :mrgreen: I have several boxen with multiple Win/Linux installs. No downsides IMO.
there is also the older Debian method of /etc/adjtime which is 'UTC' or "LOCAL"
I think that still works, and the preferred methods posted above.

Be careful with the registry hack in windows! I'm sure it works better maybe post XP, don't know.
I can assure you the registry entry works in Win 7 and Win 10. I haven't had an XP box for ~12 years to test it.
Much easier to set Win for UTC than set the six Linux installs on this box to LOCAL!
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

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

Re: Debian system clock reset hardware (BIOS) clock on boot

#12 Post by CwF »

sunrat wrote: 2021-08-26 00:07 What was the first reason? :mrgreen: I have several boxen with multiple Win/Linux installs. No downsides IMO.
...
I can assure you the registry entry works in Win 7 and Win 10. I haven't had an XP box for ~12 years to test it.
Sure, I don't disagree, I just don't. First reason, VM's work fine, all fuction available at all times and they talk to each other, dual boot doesn't offer that.

I did deduce the problem with XP years ago with the things I use it for. That need won't ever change, so I learned the vm way to cover the need forever. That machine got old, so I built a new one (ok, more than once) and I put XP on it to cover the need, that I don't need, and turned it off! I always have an XP or two running, but use the VM's. The bare metal XP's are far beyond my E5's vm speed, but I think to slow for it to matter.

I figure modern windows figured out the issue. I do run a Debian on 'XP boxes ' for testing things, never need to leave it on for long.

mm3100
Posts: 336
Joined: 2020-10-21 21:39
Has thanked: 8 times
Been thanked: 13 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#13 Post by mm3100 »

Any one have any idea what the magic numbers are all about?
Reading in hwclock manual
The Adjtime File
While named for its historical purpose of controlling adjustments only, it actually contains other
information used by hwclock from one invocation to the next.

The format of the adjtime file is, in ASCII:

Line 1: Three numbers, separated by blanks: 1) the systematic drift rate in seconds per day, float‐
ing point decimal; 2) the resulting number of seconds since 1969 UTC of most recent adjustment or
calibration, decimal integer; 3) zero (for compatibility with clock(8)) as a floating point decimal.

Line 2: One number: the resulting number of seconds since 1969 UTC of most recent calibration. Zero
if there has been no calibration yet or it is known that any previous calibration is moot (for exam‐
ple, because the Hardware Clock has been found, since that calibration, not to contain a valid
time). This is a decimal integer.

Line 3: "UTC" or "LOCAL". Tells whether the Hardware Clock is set to Coordinated Universal Time or
local time. You can always override this value with options on the hwclock command line.

You can use an adjtime file that was previously used with the clock(8) program with hwclock.

jazbar
Posts: 43
Joined: 2021-08-03 11:10
Has thanked: 4 times

Re: Debian system clock reset hardware (BIOS) clock on boot

#14 Post by jazbar »

"nano etc/adjtime" set to local

Code: Select all

000000 1629916542 0.000000
1629916542
LOCAL
Result:

Code: Select all

jazbar@ABC:~$ timedatectl
        Local time: Thu 2021-08-26 12:23:34 CEST
        Universal time: Thu 2021-08-26 10:23:34 UTC
        RTC time: Thu 2021-08-26 12:23:32
        Time zone: Europe/Ljubljana (CEST, +0200)
System clock synchronized: no
        NTP service: active
        NTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
         This mode cannot be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
jazbar@ABC:~$ 
It works. Who cares if summer and winter time should be set manually in BIOS as long this is home PC.
Thanks for help.
My PC: MB MSI 790GX-G65, AMD Phenom II X3, 6 GB RAM, onboard graphic HD3300 DirectX 10, (AMD 790GX chipset)

Post Reply