Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Krix Rosinski
Hello all,

Thank you very much for the suggestion, we are going to set this up and
test. I'll report back once we have the solution tested.

Kind regards,
Krzysztof


On Wed, 23 Mar 2022 at 13:37, Miroslav Lichvar  wrote:

> On Wed, Mar 23, 2022 at 03:25:57PM +0300, Andrei Borzenkov wrote:
> > Yes, but without proper systemd dependencies other (timer) units will
> > not wait for it to happen. systemd-timesyncd.service has these
> > dependencies, while chronyd.service not, even if you use -s option.
>
> Good point. So, if you add -s to the chronyd options, you should also
> add {Wants,Before}=time-set.target to the service file.
>
> --
> Miroslav Lichvar
>
>
> --
> To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
> with "unsubscribe" in the subject.
> For help email chrony-users-requ...@chrony.tuxfamily.org
> with "help" in the subject.
> Trouble?  Email listmas...@chrony.tuxfamily.org.
>
>


Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Miroslav Lichvar
On Wed, Mar 23, 2022 at 03:25:57PM +0300, Andrei Borzenkov wrote:
> Yes, but without proper systemd dependencies other (timer) units will
> not wait for it to happen. systemd-timesyncd.service has these
> dependencies, while chronyd.service not, even if you use -s option.

Good point. So, if you add -s to the chronyd options, you should also
add {Wants,Before}=time-set.target to the service file.

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Andrei Borzenkov
On Wed, Mar 23, 2022 at 3:22 PM Miroslav Lichvar  wrote:
>
> On Wed, Mar 23, 2022 at 03:15:21PM +0300, Andrei Borzenkov wrote:
> > And systemd-timesyncd.target will pull in time-set.target:
> >
> > Wants=time-set.target
> > Before=time-set.target
>
> An important thing to note is that timesyncd just restores the time
> from a file for the time-set target to be reached. It does not wait
> for the clock to be set by NTP.
>
> The same thing can be done with the chronyd -s option (when there is
> no RTC).
>


Yes, but without proper systemd dependencies other (timer) units will
not wait for it to happen. systemd-timesyncd.service has these
dependencies, while chronyd.service not, even if you use -s option.

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Miroslav Lichvar
On Wed, Mar 23, 2022 at 03:15:21PM +0300, Andrei Borzenkov wrote:
> And systemd-timesyncd.target will pull in time-set.target:
> 
> Wants=time-set.target
> Before=time-set.target

An important thing to note is that timesyncd just restores the time
from a file for the time-set target to be reached. It does not wait
for the clock to be set by NTP.

The same thing can be done with the chronyd -s option (when there is
no RTC).

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Andrei Borzenkov
On Wed, Mar 23, 2022 at 2:28 PM Krix Rosinski  wrote:
>
> Hello all, thank you for the speedy reply!
>
> @Laura, yes we disable systemd-timesyncd completely and enable chrony instead.
>
> @Kevin, I may ask a separate question there, I thought this will be a common 
> issue for chrony users though.
>
> @Miroslav, timer below, we don't have an RTC, we haven't enabled chrony-wait 
> service yet but we will check if it helps here.
>
> [Unit]
> Description=Daily Timer One Per Day
>
> [Timer]
> OnCalendar=*-*-* 02:10:00
>

Reading systemd.timer man page:

Timer units with at least one OnCalendar= directive acquire a pair of
additional After= [Default] dependencies on time-set.target and
time-sync.target, in order to avoid being started before the system
clock has been correctly set.

And systemd-timesyncd.target will pull in time-set.target:

Wants=time-set.target
Before=time-set.target

chrony-wait.service is also ordered before time-sync.target, so using
it should be equivalent to systemd-timesyncd.service.

> [Install]
> WantedBy=timers.target
>
>
> On Wed, 23 Mar 2022 at 12:18, Miroslav Lichvar  wrote:
>>
>> On Wed, Mar 23, 2022 at 12:09:32PM +0100, Krix Rosinski wrote:
>> > Hello,
>> >
>> > We are trying to set up chrony instead of systemd-timesyncd service,
>> > everything works perfectly except for the systemd timers which fires
>> > straight away when chrony updates time. It seems that systemd-timesyncd
>> > does somethings to temporarily stop timers for time update, and this
>> > doesn't work out of the box with chrony.
>>
>> Can you post an example of the timer which triggers?
>>
>> Does the machine have an RTC?
>>
>> Does it happen when you enable the chrony-wait service?
>>
>> --
>> Miroslav Lichvar
>>
>>
>> --
>> To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
>> with "unsubscribe" in the subject.
>> For help email chrony-users-requ...@chrony.tuxfamily.org
>> with "help" in the subject.
>> Trouble?  Email listmas...@chrony.tuxfamily.org.
>>

-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Krix Rosinski
Hello all, thank you for the speedy reply!

@Laura, yes we disable systemd-timesyncd completely and enable chrony
instead.

@Kevin, I may ask a separate question there, I thought this will be a
common issue for chrony users though.

@Miroslav, timer below, we don't have an RTC, we haven't enabled
chrony-wait service yet but we will check if it helps here.

[Unit]
Description=Daily Timer One Per Day

[Timer]
OnCalendar=*-*-* 02:10:00

[Install]
WantedBy=timers.target


On Wed, 23 Mar 2022 at 12:18, Miroslav Lichvar  wrote:

> On Wed, Mar 23, 2022 at 12:09:32PM +0100, Krix Rosinski wrote:
> > Hello,
> >
> > We are trying to set up chrony instead of systemd-timesyncd service,
> > everything works perfectly except for the systemd timers which fires
> > straight away when chrony updates time. It seems that systemd-timesyncd
> > does somethings to temporarily stop timers for time update, and this
> > doesn't work out of the box with chrony.
>
> Can you post an example of the timer which triggers?
>
> Does the machine have an RTC?
>
> Does it happen when you enable the chrony-wait service?
>
> --
> Miroslav Lichvar
>
>
> --
> To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
> with "unsubscribe" in the subject.
> For help email chrony-users-requ...@chrony.tuxfamily.org
> with "help" in the subject.
> Trouble?  Email listmas...@chrony.tuxfamily.org.
>
>


Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Miroslav Lichvar
On Wed, Mar 23, 2022 at 12:09:32PM +0100, Krix Rosinski wrote:
> Hello,
> 
> We are trying to set up chrony instead of systemd-timesyncd service,
> everything works perfectly except for the systemd timers which fires
> straight away when chrony updates time. It seems that systemd-timesyncd
> does somethings to temporarily stop timers for time update, and this
> doesn't work out of the box with chrony.

Can you post an example of the timer which triggers?

Does the machine have an RTC?

Does it happen when you enable the chrony-wait service?

-- 
Miroslav Lichvar


-- 
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org 
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org 
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.



Re: [chrony-users] Systemd timers and chrony

2022-03-23 Thread Kevin P. Fleming
There's a good chance you'll get a more useful answer on the
systemd-devel list, as the systemd developers can tell you what
systemd-timesyncd is doing in that situation.

On Wed, Mar 23, 2022 at 7:10 AM Krix Rosinski  wrote:
>
> Hello,
>
> We are trying to set up chrony instead of systemd-timesyncd service, 
> everything works perfectly except for the systemd timers which fires straight 
> away when chrony updates time. It seems that systemd-timesyncd does 
> somethings to temporarily stop timers for time update, and this doesn't work 
> out of the box with chrony.
>
> Is there a standard way to fix this problem, please?
>
> This is quite a problem for our system, we don't have time backup and we have 
> timer to reboot system each day. Once we enable chrony the system reboots in 
> a loop due to time synchronisation.
>
> Kind regards,
> Krzysztof
>

--
To unsubscribe email chrony-users-requ...@chrony.tuxfamily.org
with "unsubscribe" in the subject.
For help email chrony-users-requ...@chrony.tuxfamily.org
with "help" in the subject.
Trouble?  Email listmas...@chrony.tuxfamily.org.