Re: [systemd-devel] hardware clock

2016-07-27 Thread Michal Soltys
On 2016-07-27 19:54, Michał Zegan wrote:
> Hello.
> 
> There is, it seems, a problem with the hardware clock. That is, the
> systemd does not care about it. Neither systemd nor udev rules set the
> system time using the hardware clock.

Strictly speaking, systemd does at bootup what hwclock used to do with
usual hwclock --hctosys or hwclock --systz, but not at shutdown
(anymore, though that can be trivially readded as well). See for details:

https://lists.freedesktop.org/archives/systemd-devel/2011-May/002526.html

> From what I know, if the clock is a cmos rtc, the kernel always sets
> time during bootup. In any other case, it should do this anyway if it is
> configured to do so during compilation, but only when appropriate rtc
> support is compiled into the kernel. So, userspace does not have to.
> The problem is that there are cases when the rtc is not a cmos one, and
> the driver is compiled as a module. This is a specific case because the
> kernel will not restore the time, and systemd does not do this either.
> The thing that restores the time is ntp synchronization and that is not
> related to the hardware clock.

Hmmm, in such case you could maybe use a service similar to what systemd
had in v27 and earlier versions:

[Unit]
DefaultDependencies=no
Before=sysinit.target shutdown.target
Conflicts=shutdown.target
# maybe also some of (depending on what you're planning to do):
Wants=time-sync.target
Before=udev.service time-sync.target
After=systemd-modules-load.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=

And make sure to add remaining dependencies (for example you could load
related rtc modules through systemd-modules-load.service as in example
above - or - use udev with TAG+= / SYSTEMD_WANTS+= ; using static
modules seems to be more sensible - and allows you to order correctly
against udev.service and time-sync.target).


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] hardware clock

2016-07-27 Thread Ranjib Dey
Currently I use hwclock command directly for situations like that (with
dragonboard, pi etc) , it's automated using chef.

On Jul 27, 2016 10:55 AM, "Michał Zegan"  wrote:

> Hello.
>
> There is, it seems, a problem with the hardware clock. That is, the
> systemd does not care about it. Neither systemd nor udev rules set the
> system time using the hardware clock.
> From what I know, if the clock is a cmos rtc, the kernel always sets
> time during bootup. In any other case, it should do this anyway if it is
> configured to do so during compilation, but only when appropriate rtc
> support is compiled into the kernel. So, userspace does not have to.
> The problem is that there are cases when the rtc is not a cmos one, and
> the driver is compiled as a module. This is a specific case because the
> kernel will not restore the time, and systemd does not do this either.
> The thing that restores the time is ntp synchronization and that is not
> related to the hardware clock.
> This issue is visible in case of arm boards with external realtime
> clocks, as those clocks are bought separately and not part of the
> platform. It would be nice if systemd would set the time, or if udev had
> a rule to do this, or both (in case the module was loaded earlier during
> initramfs phase). Or any other solution for that would be nice.
>
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] hardware clock

2016-07-27 Thread Michał Zegan
Hello.

There is, it seems, a problem with the hardware clock. That is, the
systemd does not care about it. Neither systemd nor udev rules set the
system time using the hardware clock.
From what I know, if the clock is a cmos rtc, the kernel always sets
time during bootup. In any other case, it should do this anyway if it is
configured to do so during compilation, but only when appropriate rtc
support is compiled into the kernel. So, userspace does not have to.
The problem is that there are cases when the rtc is not a cmos one, and
the driver is compiled as a module. This is a specific case because the
kernel will not restore the time, and systemd does not do this either.
The thing that restores the time is ntp synchronization and that is not
related to the hardware clock.
This issue is visible in case of arm boards with external realtime
clocks, as those clocks are bought separately and not part of the
platform. It would be nice if systemd would set the time, or if udev had
a rule to do this, or both (in case the module was loaded earlier during
initramfs phase). Or any other solution for that would be nice.



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] ActiveState property with value "inactive"is not being sent out when service is killed by signal

2016-07-27 Thread Pradeepa Kumar
Thanks Adrien.
yes it is same issue.
Could you please let me know how did you resolve this ?
I was browsing through sytemd code and my theory is that by the time
properties changed signal is being prepared to be sent, service has already
gone through mutiple state changes or the unit is unloaded and hence no
property changeg signal is sent out.
As workaround , I am planning to watch on SubState instead of ActiveState
in PropertiesChanged signal and also have ExecStopPost in service file.
I have noticied that, when a service becomes inactive  I always get
SubState=stop-post (when i have ExecStopPost ).

Can anyone please comment if this is correct work-around ?

Thanks


On Wed, Jul 27, 2016 at 2:26 PM, Adrien Besnard 
wrote:

> I may be wrong, but it sounds like the issue I encoutered here:
> https://github.com/systemd/systemd/issues/3390. I also wanted to build a
> service monitoring tool :)
>
> Cheers,
> --
> Adrien BESNARD
>
> 2016-07-26 11:24 GMT+02:00 Pradeepa Kumar :
>
>> Hi
>> ActiveState property with value "inactive"is not being sent out when
>> service is killed by signal
>> I am using 219 version.
>> I logged issue https://github.com/systemd/systemd/issues/3807
>> Thanks
>>
>>
>>
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>
>>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] ActiveState property with value "inactive"is not being sent out when service is killed by signal

2016-07-27 Thread Adrien Besnard
For the moment, I gave up writing a nice script based on DBus's
PropertiesChanged events, and I made a temporary dirty script which poll
the service status. I did not solve that in a good way.
--
Adrien BESNARD

2016-07-27 11:47 GMT+02:00 Pradeepa Kumar :

> Thanks Adrien.
> yes it is same issue.
> Could you please let me know how did you resolve this ?
> I was browsing through sytemd code and my theory is that by the time
> properties changed signal is being prepared to be sent, service has already
> gone through mutiple state changes or the unit is unloaded and hence no
> property changeg signal is sent out.
> As workaround , I am planning to watch on SubState instead of ActiveState
> in PropertiesChanged signal and also have ExecStopPost in service file.
> I have noticied that, when a service becomes inactive  I always get
> SubState=stop-post (when i have ExecStopPost ).
>
> Can anyone please comment if this is correct work-around ?
>
> Thanks
>
>
> On Wed, Jul 27, 2016 at 2:26 PM, Adrien Besnard 
> wrote:
>
>> I may be wrong, but it sounds like the issue I encoutered here:
>> https://github.com/systemd/systemd/issues/3390. I also wanted to build a
>> service monitoring tool :)
>>
>> Cheers,
>> --
>> Adrien BESNARD
>>
>> 2016-07-26 11:24 GMT+02:00 Pradeepa Kumar :
>>
>>> Hi
>>> ActiveState property with value "inactive"is not being sent out when
>>> service is killed by signal
>>> I am using 219 version.
>>> I logged issue https://github.com/systemd/systemd/issues/3807
>>> Thanks
>>>
>>>
>>>
>>> ___
>>> systemd-devel mailing list
>>> systemd-devel@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>>
>>>
>>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] ActiveState property with value "inactive"is not being sent out when service is killed by signal

2016-07-27 Thread Adrien Besnard
I may be wrong, but it sounds like the issue I encoutered here:
https://github.com/systemd/systemd/issues/3390. I also wanted to build a
service monitoring tool :)

Cheers,
--
Adrien BESNARD

2016-07-26 11:24 GMT+02:00 Pradeepa Kumar :

> Hi
> ActiveState property with value "inactive"is not being sent out when
> service is killed by signal
> I am using 219 version.
> I logged issue https://github.com/systemd/systemd/issues/3807
> Thanks
>
>
>
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel