[systemd-devel] date/time set to epoch when using readonly rootfs

Belisko Marek marek.belisko at gmail.com
Fri Oct 23 08:37:47 UTC 2020


On Thu, Oct 22, 2020 at 12:57 PM Lennart Poettering
<lennart at poettering.net> wrote:
>
> On Do, 22.10.20 11:53, Belisko Marek (marek.belisko at gmail.com) wrote:
>
> > > Hmm? this service has nothing to do with epoch/clock setting. It's
> > > used for systems that have a "reboot-for-update" mode.
> >
> > Sorry I mixed up things. Can you pls guide where can I find code which
> > set date/time from timestamp? Thanks
>
> This is the stuff PID 1 calls during earliest boot:
>
> https://github.com/systemd/systemd/blob/master/src/shared/clock-util.c#L147
Thanks a lot. I found an issue. The build system set config flag
-time-epoch=0 (reason was to avoid performing fsck on every boot when
inavlid date/time is detected for boards which don't have rtc [0])
and this resulted in date 1.1.1970.

[0] - https://github.com/mendersoftware/meta-mender/commit/8d204ccc4ce2edfca3b9774b18319c3acbf83f95#diff-3606aa70640de5538229dd6bcdb6a1c11aa7b243fc505de8134d85b8a25bc444

Thanks,

marek
>
> (But note that the support for checking /usr/lib/clock-epoch is a
> recent addition so far only available in git master.)
>
> This is the stuff systemd-timesyncd does when initializing:
>
> https://github.com/systemd/systemd/blob/master/src/timesync/timesyncd.c#L27
>
> Lennart
>
> --
> Lennart Poettering, Berlin



-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com


More information about the systemd-devel mailing list