[systemd-devel] Cannot find a way to get time read from RTC during boot

Kevin P. Fleming kevin at km6g.us
Fri Mar 13 00:42:39 UTC 2020


Indeed, I landed there later after my reply. I'm disappointed that it
was never resolved, but I did add a service unit which works
perfectly.

---------

[Unit]
Description=Set system clock from hardware clock
After=systemd-modules-load.service

[Service]
Type=oneshot
ExecStart=/sbin/hwclock --hctosys --utc

[Install]
WantedBy=basic.target

On Thu, Mar 12, 2020 at 7:26 PM Dave Howorth <systemd at howorth.org.uk> wrote:
>
> On Thu, 12 Mar 2020 17:35:16 -0400
> "Kevin P. Fleming" <kevin at km6g.us> wrote:
> > Thanks, I agree. I could some up with something which ran timedatectl
> > to set the system time from the RTC, but the hwclock tool is already
> > there for that purpose.
> >
> > I'll need to investigate why this script exits without making any
> > changes when systemd is running; either the authors expected some part
> > of systemd to read the RTC, or they expect some other service/tool to
> > do it.
> >
> > On Thu, Mar 12, 2020 at 2:02 PM Mike Gilbert <floppym at gentoo.org>
> > wrote:
> > >
> > > On Thu, Mar 12, 2020 at 7:13 AM Kevin P. Fleming <kevin at km6g.us>
> > > wrote:
> > > > Prior to systemd, with the 'hwclock' package installed, a udev
> > > > rule would trigger reading of the RTC and setting the system
> > > > clock when /dev/rtc0 appeared. With systemd running, the script
> > > > run by that udev rule is suppressed, it doesn't do anything.
> > > >
> > > > With a system using solely systemd-provided services, what's the
> > > > proper mechanism to get the time read from an RTC whose driver is
> > > > loaded by systemd-modules-load.service?
> > >
> > > Your use case is likely not covered by "systemd-provided" services.
> > >
> > > I think your best bet would be to "un-supress" that hwclock udev
> > > rule.
>
> I'm not sure but you might be interested to read
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=855203
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel


More information about the systemd-devel mailing list