Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #245217 > unrolled thread

/etc/adjtime (setting the hardware clock to local time on Debian 11)

Started byJosé Luis González <bugs.jlg@gmail.com>
First post2022-02-11 13:00 +0100
Last post2022-02-11 20:20 +0100
Articles 5 — 4 participants

Back to article view | Back to linux.debian.user


Contents

  /etc/adjtime (setting the hardware clock to local time on Debian  11) José Luis González <bugs.jlg@gmail.com> - 2022-02-11 13:00 +0100
    Re: /etc/adjtime (setting the hardware clock to local time on Debian  11) Greg Wooledge <greg@wooledge.org> - 2022-02-11 13:50 +0100
      Re: /etc/adjtime (setting the hardware clock to local time on Debian  11) Greg Wooledge <greg@wooledge.org> - 2022-02-11 17:40 +0100
    Re: /etc/adjtime (setting the hardware clock to local time on Debian 11) Anssi Saari <as@sci.fi> - 2022-02-11 14:40 +0100
      Re: /etc/adjtime (setting the hardware clock to local time on Debian 11) Cindy Sue Causey <butterflybytes@gmail.com> - 2022-02-11 20:20 +0100

#245217 — /etc/adjtime (setting the hardware clock to local time on Debian 11)

FromJosé Luis González <bugs.jlg@gmail.com>
Date2022-02-11 13:00 +0100
Subject/etc/adjtime (setting the hardware clock to local time on Debian 11)
Message-ID<DPCKJ-14pU-1@gated-at.bofh.it>
According to

https://wiki.debian.org/DateTime

There should be an /etc/adjtime file to configure the timezone for the
hardware clock. I have no such file in my Debian 11 laptop. May I know
if the file was removed and what was it replaced with?

I just want to set the hardware clock to local time since this machine is shared with Windows and the clock is actually local time.

Thanks in advance, and best regards.

[toc] | [next] | [standalone]


#245220

FromGreg Wooledge <greg@wooledge.org>
Date2022-02-11 13:50 +0100
Message-ID<DPDx7-14VL-5@gated-at.bofh.it>
In reply to#245217
On Fri, Feb 11, 2022 at 12:54:01PM +0100, José Luis González wrote:
> According to
> 
> https://wiki.debian.org/DateTime
> 
> There should be an /etc/adjtime file to configure the timezone for the
> hardware clock.

That's... not how I'd describe that file, but I suppose "telling whether
the HW clock is on UTC or not" is indeed one of its features.

> I have no such file in my Debian 11 laptop. May I know
> if the file was removed and what was it replaced with?

unicorn:~$ ls -l /etc/adjtime 
-rw-r--r-- 1 root root 46 Jan 11  2018 /etc/adjtime
unicorn:~$ cat /etc/adjtime 
0.000000 1515718148 0.000000
1515718148
LOCAL
unicorn:~$ dpkg -S /etc/adjtime
dpkg-query: no path found matching pattern /etc/adjtime
unicorn:~$ grep adjtime /var/lib/dpkg/info/*.postinst
/var/lib/dpkg/info/systemd.postinst:    if [ "$UTC" = "no" ] && [ ! -e /etc/adjtime ]; then
/var/lib/dpkg/info/systemd.postinst:        printf "0.0 0 0.0\n0\nLOCAL\n" > /etc/adjtime

Are you running systemd, or some other init system?

[toc] | [prev] | [next] | [standalone]


#245230

FromGreg Wooledge <greg@wooledge.org>
Date2022-02-11 17:40 +0100
Message-ID<DPH7I-178I-7@gated-at.bofh.it>
In reply to#245220
CC'ing back to the list.

On Fri, Feb 11, 2022 at 03:34:35PM +0100, José Luis González wrote:
> Would creating an /etc/adjtime as done by the postinst script be fine?

As far as I know, yes.  Try it and see.  The worst that can happen is
your clock will be wrong, but that's already the case, right?

[toc] | [prev] | [next] | [standalone]


#245222 — Re: /etc/adjtime (setting the hardware clock to local time on Debian 11)

FromAnssi Saari <as@sci.fi>
Date2022-02-11 14:40 +0100
SubjectRe: /etc/adjtime (setting the hardware clock to local time on Debian 11)
Message-ID<DPEjw-15rE-1@gated-at.bofh.it>
In reply to#245217
José Luis González <bugs.jlg@gmail.com> writes:

> According to
>
> https://wiki.debian.org/DateTime
>
> There should be an /etc/adjtime file to configure the timezone for the
> hardware clock. I have no such file in my Debian 11 laptop. May I know
> if the file was removed and what was it replaced with?

>From what I can tell, it's created by hwclock. If you run hwclock --set
it should be created. Possibly you can also run

timedatectl set-local-rtc 0 

but I don't know if that works if the file doesn't exist.

> I just want to set the hardware clock to local time since this machine
> is shared with Windows and the clock is actually local time.

You might consider telling Windows to use UTC as well. For example here:
https://feldspaten.org/2019/11/03/windows-10-clock-in-utc/

[toc] | [prev] | [next] | [standalone]


#245239 — Re: /etc/adjtime (setting the hardware clock to local time on Debian 11)

FromCindy Sue Causey <butterflybytes@gmail.com>
Date2022-02-11 20:20 +0100
SubjectRe: /etc/adjtime (setting the hardware clock to local time on Debian 11)
Message-ID<DPJCx-18Ke-1@gated-at.bofh.it>
In reply to#245222
On 2/11/22, Anssi Saari <as@sci.fi> wrote:
> José Luis González <bugs.jlg@gmail.com> writes:
>
>> According to
>>
>> https://wiki.debian.org/DateTime
>>
>> There should be an /etc/adjtime file to configure the timezone for the
>> hardware clock. I have no such file in my Debian 11 laptop. May I know
>> if the file was removed and what was it replaced with?
>
> >From what I can tell, it's created by hwclock. If you run hwclock --set
> it should be created. Possibly you can also run
>
> timedatectl set-local-rtc 0
>
> but I don't know if that works if the file doesn't exist.
>
>> I just want to set the hardware clock to local time since this machine
>> is shared with Windows and the clock is actually local time.
>
> You might consider telling Windows to use UTC as well. For example here:
> https://feldspaten.org/2019/11/03/windows-10-clock-in-utc/


I debootstrap** Debian for those times I need a new installation.
These were the instructions I'd been using up until last time (maybe a
year ago):

https://www.debian.org/releases/stretch/amd64/apds03.html.en#idm4468

Basically that says;

=== BEGIN SNIPPET

# editor /etc/adjtime

Populate that with:

0.0 0 0.0

0
UTC

To configure timezone;

# dpkg-reconfigure tzdata

=== END SNIPPET

During debootstrap, the /etc/adjtime file doesn't exist until that
step is run, but it's also a brand new install that hasn't been booted
a first time yet.

That manually created file then works flawlessly for me here, but my
needs are simple. I think the hardware clock is set to UTC, by the
way.

Cindy :)

** N.B. Debootstrap was priceless as a method of installing Linux on
dialup Internet connections.. in case that still helps anyone else.
-- 
Cindy-Sue Causey
Talking Rock, Pickens County, Georgia, USA
* runs with birdseed *

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web