diff mbox series

rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Message ID 20220815182503.2007534-1-drew@moseleynet.net
State New
Headers show
Series rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device | expand

Commit Message

Drew Moseley Aug. 15, 2022, 6:25 p.m. UTC
From: Drew Moseley <drew@moseleynet.net>

The previous change to remove the dependency on systemd-udev-settle
caused boot delays at least on qemu. It seems that change required
a hwrng device but that's not necessarily available on all platforms.

This changes the "Requires" to a "WantedBy" as modeled after the
version of this file on Ubuntu 20.04.

Signed-off-by: Drew Moseley <drew@moseleynet.net>
---
 meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Drew Moseley Aug. 15, 2022, 6:29 p.m. UTC | #1
Hi Khem,

It looks like you recently removed both the dependency on hwrng and 
systemd-udev-settle.  Do you think this change will be useful?

Claudius, any thoughts here?


Drew



On 8/15/22 2:25 PM, drew.moseley@gmail.com wrote:
> From: Drew Moseley <drew@moseleynet.net>
>
> The previous change to remove the dependency on systemd-udev-settle
> caused boot delays at least on qemu. It seems that change required
> a hwrng device but that's not necessarily available on all platforms.
>
> This changes the "Requires" to a "WantedBy" as modeled after the
> version of this file on Ubuntu 20.04.
>
> Signed-off-by: Drew Moseley <drew@moseleynet.net>
> ---
>   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> index 0f50890dcb..b013d95932 100644
> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>   DefaultDependencies=no
>   After=systemd-udev-settle.service
>   Before=sysinit.target shutdown.target
> -Requires=dev-hwrng.device
> -After=dev-hwrng.device
>   Conflicts=shutdown.target
>   
>   [Service]
> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>   
>   [Install]
>   WantedBy=sysinit.target
> +WantedBy=dev-hwrng.device
Khem Raj Aug. 15, 2022, 6:47 p.m. UTC | #2
On Mon, Aug 15, 2022 at 11:30 AM Drew Moseley <drew.moseley@gmail.com> wrote:
>
> Hi Khem,
>
> It looks like you recently removed both the dependency on hwrng and
> systemd-udev-settle.  Do you think this change will be useful?

Depending on udev-settle certainly seems an overkill so that should go.
the change you have made will now ensure that this service starts when
dev-hwrng device is created
but loses the order of starting the service. So it may still race with
device creation.

>
> Claudius, any thoughts here?
>
>
> Drew
>
>
>
> On 8/15/22 2:25 PM, drew.moseley@gmail.com wrote:
> > From: Drew Moseley <drew@moseleynet.net>
> >
> > The previous change to remove the dependency on systemd-udev-settle
> > caused boot delays at least on qemu. It seems that change required
> > a hwrng device but that's not necessarily available on all platforms.
> >
> > This changes the "Requires" to a "WantedBy" as modeled after the
> > version of this file on Ubuntu 20.04.
> >
> > Signed-off-by: Drew Moseley <drew@moseleynet.net>
> > ---
> >   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > index 0f50890dcb..b013d95932 100644
> > --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
> >   DefaultDependencies=no
> >   After=systemd-udev-settle.service
> >   Before=sysinit.target shutdown.target
> > -Requires=dev-hwrng.device
> > -After=dev-hwrng.device
> >   Conflicts=shutdown.target
> >
> >   [Service]
> > @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
> >
> >   [Install]
> >   WantedBy=sysinit.target
> > +WantedBy=dev-hwrng.device
>
> --
> mailto:drew@moseleynet.net
>
Alexander Kanavin Aug. 18, 2022, 5:12 p.m. UTC | #3
I am definitely seeing a serious regression where qemu images get
stuck for 4 minutes on boot waiting for /dev/hwrng, so if this is
fixing the issue, I'd appreciate getting it in!

Alex

On Mon, 15 Aug 2022 at 20:48, Khem Raj <raj.khem@gmail.com> wrote:
>
> On Mon, Aug 15, 2022 at 11:30 AM Drew Moseley <drew.moseley@gmail.com> wrote:
> >
> > Hi Khem,
> >
> > It looks like you recently removed both the dependency on hwrng and
> > systemd-udev-settle.  Do you think this change will be useful?
>
> Depending on udev-settle certainly seems an overkill so that should go.
> the change you have made will now ensure that this service starts when
> dev-hwrng device is created
> but loses the order of starting the service. So it may still race with
> device creation.
>
> >
> > Claudius, any thoughts here?
> >
> >
> > Drew
> >
> >
> >
> > On 8/15/22 2:25 PM, drew.moseley@gmail.com wrote:
> > > From: Drew Moseley <drew@moseleynet.net>
> > >
> > > The previous change to remove the dependency on systemd-udev-settle
> > > caused boot delays at least on qemu. It seems that change required
> > > a hwrng device but that's not necessarily available on all platforms.
> > >
> > > This changes the "Requires" to a "WantedBy" as modeled after the
> > > version of this file on Ubuntu 20.04.
> > >
> > > Signed-off-by: Drew Moseley <drew@moseleynet.net>
> > > ---
> > >   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
> > >   1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > > index 0f50890dcb..b013d95932 100644
> > > --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > > +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > > @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
> > >   DefaultDependencies=no
> > >   After=systemd-udev-settle.service
> > >   Before=sysinit.target shutdown.target
> > > -Requires=dev-hwrng.device
> > > -After=dev-hwrng.device
> > >   Conflicts=shutdown.target
> > >
> > >   [Service]
> > > @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
> > >
> > >   [Install]
> > >   WantedBy=sysinit.target
> > > +WantedBy=dev-hwrng.device
> >
> > --
> > mailto:drew@moseleynet.net
> >
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#169360): https://lists.openembedded.org/g/openembedded-core/message/169360
> Mute This Topic: https://lists.openembedded.org/mt/93042904/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Claudius Heine Aug. 19, 2022, 9:36 a.m. UTC | #4
Hi Dew.

On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
> From: Drew Moseley <drew@moseleynet.net>
> 
> The previous change to remove the dependency on systemd-udev-settle
> caused boot delays at least on qemu. It seems that change required
> a hwrng device but that's not necessarily available on all platforms.
> 
> This changes the "Requires" to a "WantedBy" as modeled after the
> version of this file on Ubuntu 20.04.
> 
> Signed-off-by: Drew Moseley <drew@moseleynet.net>
> ---
>   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> index 0f50890dcb..b013d95932 100644
> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>   DefaultDependencies=no
>   After=systemd-udev-settle.service
>   Before=sysinit.target shutdown.target
> -Requires=dev-hwrng.device
> -After=dev-hwrng.device
>   Conflicts=shutdown.target
>   
>   [Service]
> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>   
>   [Install]
>   WantedBy=sysinit.target
> +WantedBy=dev-hwrng.device

This looses the order. Have you tried just replacing `Requires` with 
`Wants`. So something like this:


```

Before=sysinit.target shutdown.target
Wants=dev-hwrng.device
After=dev-hwrng.device
Conflicts=shutdown.target

```

If that still would cause the long waiting time on qemu?

I haven't investigated the qemu issue, but maybe qemu just doesn't 
provide a hardware random source? If it doesn't provide a hardware 
random source, then installing rng-tools on there might also not make sense.

Alternatively maybe just adding a start timeout might solve it?

regards,
Claudius
Dragos-Marian Panait Aug. 19, 2022, 12:50 p.m. UTC | #5
Hi Claudius,

On 19.08.2022 12:36, Claudius Heine wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> Hi Dew.
>
> On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
>> From: Drew Moseley <drew@moseleynet.net>
>>
>> The previous change to remove the dependency on systemd-udev-settle
>> caused boot delays at least on qemu. It seems that change required
>> a hwrng device but that's not necessarily available on all platforms.
>>
>> This changes the "Requires" to a "WantedBy" as modeled after the
>> version of this file on Ubuntu 20.04.
>>
>> Signed-off-by: Drew Moseley <drew@moseleynet.net>
>> ---
>>   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git 
>> a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service 
>> b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>> index 0f50890dcb..b013d95932 100644
>> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>>   DefaultDependencies=no
>>   After=systemd-udev-settle.service
>>   Before=sysinit.target shutdown.target
>> -Requires=dev-hwrng.device
>> -After=dev-hwrng.device
>>   Conflicts=shutdown.target
>>
>>   [Service]
>> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>>
>>   [Install]
>>   WantedBy=sysinit.target
>> +WantedBy=dev-hwrng.device
>
> This looses the order. Have you tried just replacing `Requires` with
> `Wants`. So something like this:
>
>
> ```
>
> Before=sysinit.target shutdown.target
> Wants=dev-hwrng.device
> After=dev-hwrng.device
> Conflicts=shutdown.target
>
> ```
>
> If that still would cause the long waiting time on qemu?
>
> I haven't investigated the qemu issue, but maybe qemu just doesn't
> provide a hardware random source? If it doesn't provide a hardware
> random source, then installing rng-tools on there might also not make 
> sense.
> Alternatively maybe just adding a start timeout might solve it?
> regards,
> Claudius


I've tested the patch on a NUC7, results are the same as with qemu:
- increased boot time
- timeout for rng-tools.service
[ TIME ] Timed out waiting for device /dev/hwrng.
[DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.

Regards,
Dragos
Drew Moseley Aug. 19, 2022, 2:34 p.m. UTC | #6
On 8/19/22 8:50 AM, Dragos-Marian Panait wrote:
>
> Hi Claudius,
>
> On 19.08.2022 12:36, Claudius Heine wrote:
>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>
>> Hi Dew.
>>
>> On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
>>> From: Drew Moseley <drew@moseleynet.net>
>>>
>>> The previous change to remove the dependency on systemd-udev-settle
>>> caused boot delays at least on qemu. It seems that change required
>>> a hwrng device but that's not necessarily available on all platforms.
>>>
>>> This changes the "Requires" to a "WantedBy" as modeled after the
>>> version of this file on Ubuntu 20.04.
>>>
>>> Signed-off-by: Drew Moseley <drew@moseleynet.net>
>>> ---
>>>   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git 
>>> a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service 
>>> b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>> index 0f50890dcb..b013d95932 100644
>>> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>>>   DefaultDependencies=no
>>>   After=systemd-udev-settle.service
>>>   Before=sysinit.target shutdown.target
>>> -Requires=dev-hwrng.device
>>> -After=dev-hwrng.device
>>>   Conflicts=shutdown.target
>>>
>>>   [Service]
>>> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>>>
>>>   [Install]
>>>   WantedBy=sysinit.target
>>> +WantedBy=dev-hwrng.device
>>
>> This looses the order. Have you tried just replacing `Requires` with
>> `Wants`. So something like this:
>>
>>
>> ```
>>
>> Before=sysinit.target shutdown.target
>> Wants=dev-hwrng.device
>> After=dev-hwrng.device
>> Conflicts=shutdown.target
>>
>> ```
>>
>> If that still would cause the long waiting time on qemu?
>>
>> I haven't investigated the qemu issue, but maybe qemu just doesn't
>> provide a hardware random source? If it doesn't provide a hardware
>> random source, then installing rng-tools on there might also not make 
>> sense.
>> Alternatively maybe just adding a start timeout might solve it?
>> regards,
>> Claudius
>
>
> I've tested the patch on a NUC7, results are the same as with qemu:
> - increased boot time
> - timeout for rng-tools.service
> [ TIME ] Timed out waiting for device /dev/hwrng.
> [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.
>
> Regards,
> Dragos
>

Interesting. I guess this patch should definitely be ignored and the 
patch from Khem that removes both the dev-hwrng and systemd-udev-settle 
depencies is the right approach. That means that the original problem 
that adding systemd-udev-settle was meant to solve, is no longer solved 
but it seems that the proposed solutions here have adverse effects 
elsewhere.

Simply removing the systemd-udev-settle dependency fixes the issue that 
my customer has that caused me to start investigating here.

Drew
Dragos-Marian Panait Aug. 19, 2022, 3:07 p.m. UTC | #7
On 19.08.2022 17:34, Drew Moseley wrote:
>
> **[Please note: This e-mail is from an EXTERNAL e-mail address]
>
>
> On 8/19/22 8:50 AM, Dragos-Marian Panait wrote:
>>
>> Hi Claudius,
>>
>> On 19.08.2022 12:36, Claudius Heine wrote:
>>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>>
>>> Hi Dew.
>>>
>>> On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
>>>> From: Drew Moseley <drew@moseleynet.net>
>>>>
>>>> The previous change to remove the dependency on systemd-udev-settle
>>>> caused boot delays at least on qemu. It seems that change required
>>>> a hwrng device but that's not necessarily available on all platforms.
>>>>
>>>> This changes the "Requires" to a "WantedBy" as modeled after the
>>>> version of this file on Ubuntu 20.04.
>>>>
>>>> Signed-off-by: Drew Moseley <drew@moseleynet.net>
>>>> ---
>>>> meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>>
>>>> diff --git 
>>>> a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service 
>>>> b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>>> index 0f50890dcb..b013d95932 100644
>>>> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>>> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>>> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>>>>   DefaultDependencies=no
>>>>   After=systemd-udev-settle.service
>>>>   Before=sysinit.target 
>>>> <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$> 
>>>> shutdown.target 
>>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>>
>>>> -Requires=dev-hwrng.device
>>>> -After=dev-hwrng.device
>>>>   Conflicts=shutdown.target 
>>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>>
>>>>
>>>>   [Service]
>>>> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>>>>
>>>>   [Install]
>>>>   WantedBy=sysinit.target 
>>>> <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$> 
>>>>
>>>> +WantedBy=dev-hwrng.device
>>>
>>> This looses the order. Have you tried just replacing `Requires` with
>>> `Wants`. So something like this:
>>>
>>>
>>> ```
>>>
>>> Before=sysinit.target 
>>> <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$> 
>>> shutdown.target 
>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>
>>> Wants=dev-hwrng.device
>>> After=dev-hwrng.device
>>> Conflicts=shutdown.target 
>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>
>>>
>>> ```
>>>
>>> If that still would cause the long waiting time on qemu?
>>>
>>> I haven't investigated the qemu issue, but maybe qemu just doesn't
>>> provide a hardware random source? If it doesn't provide a hardware
>>> random source, then installing rng-tools on there might also not 
>>> make sense.
>>> Alternatively maybe just adding a start timeout might solve it?
>>> regards,
>>> Claudius
>>
>>
>> I've tested the patch on a NUC7, results are the same as with qemu:
>> - increased boot time
>> - timeout for rng-tools.service
>> [ TIME ] Timed out waiting for device /dev/hwrng.
>> [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.
>>
>> Regards,
>> Dragos
>>
>
> Interesting. I guess this patch should definitely be ignored and the 
> patch from Khem that removes both the dev-hwrng and 
> systemd-udev-settle depencies is the right approach. That means that 
> the original problem that adding systemd-udev-settle was meant to 
> solve, is no longer solved but it seems that the proposed solutions 
> here have adverse effects elsewhere.
>
> Simply removing the systemd-udev-settle dependency fixes the issue 
> that my customer has that caused me to start investigating here.
>
> Drew
>
> -- 
> mailto:drew@moseleynet.net
Sorry for the confusion, I did not test any additional patches/changes 
that have been suggested in this email thread.
My test was performed on current Yocto master sources. No additional 
patches.
I just wanted to inform that the boot delay is also observed on real hw, 
not just qemu.
Again, sorry for the confusion.

Dragos
Drew Moseley Aug. 19, 2022, 3:13 p.m. UTC | #8
On 8/19/22 11:07 AM, Dragos-Marian Panait wrote:
>
>
> On 19.08.2022 17:34, Drew Moseley wrote:
>>
>> **[Please note: This e-mail is from an EXTERNAL e-mail address]
>>
>>
>> On 8/19/22 8:50 AM, Dragos-Marian Panait wrote:
>>>
>>> Hi Claudius,
>>>
>>> On 19.08.2022 12:36, Claudius Heine wrote:
>>>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>>>
>>>> Hi Dew.
>>>>
>>>> On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
>>>>> From: Drew Moseley <drew@moseleynet.net>
>>>>>
>>>>> The previous change to remove the dependency on systemd-udev-settle
>>>>> caused boot delays at least on qemu. It seems that change required
>>>>> a hwrng device but that's not necessarily available on all platforms.
>>>>>
>>>>> This changes the "Requires" to a "WantedBy" as modeled after the
>>>>> version of this file on Ubuntu 20.04.
>>>>>
>>>>> Signed-off-by: Drew Moseley <drew@moseleynet.net>
>>>>> ---
>>>>> meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>>>>>   1 file changed, 1 insertion(+), 2 deletions(-)
>>>>>
>>>>> diff --git 
>>>>> a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service 
>>>>> b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>>>> index 0f50890dcb..b013d95932 100644
>>>>> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>>>> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
>>>>> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>>>>>   DefaultDependencies=no
>>>>>   After=systemd-udev-settle.service
>>>>>   Before=sysinit.target 
>>>>> <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$> 
>>>>> shutdown.target 
>>>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>>>
>>>>> -Requires=dev-hwrng.device
>>>>> -After=dev-hwrng.device
>>>>>   Conflicts=shutdown.target 
>>>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>>>
>>>>>
>>>>>   [Service]
>>>>> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>>>>>
>>>>>   [Install]
>>>>>   WantedBy=sysinit.target 
>>>>> <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$> 
>>>>>
>>>>> +WantedBy=dev-hwrng.device
>>>>
>>>> This looses the order. Have you tried just replacing `Requires` with
>>>> `Wants`. So something like this:
>>>>
>>>>
>>>> ```
>>>>
>>>> Before=sysinit.target 
>>>> <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$> 
>>>> shutdown.target 
>>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>>
>>>> Wants=dev-hwrng.device
>>>> After=dev-hwrng.device
>>>> Conflicts=shutdown.target 
>>>> <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$> 
>>>>
>>>>
>>>> ```
>>>>
>>>> If that still would cause the long waiting time on qemu?
>>>>
>>>> I haven't investigated the qemu issue, but maybe qemu just doesn't
>>>> provide a hardware random source? If it doesn't provide a hardware
>>>> random source, then installing rng-tools on there might also not 
>>>> make sense.
>>>> Alternatively maybe just adding a start timeout might solve it?
>>>> regards,
>>>> Claudius
>>>
>>>
>>> I've tested the patch on a NUC7, results are the same as with qemu:
>>> - increased boot time
>>> - timeout for rng-tools.service
>>> [ TIME ] Timed out waiting for device /dev/hwrng.
>>> [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.
>>>
>>> Regards,
>>> Dragos
>>>
>>
>> Interesting. I guess this patch should definitely be ignored and the 
>> patch from Khem that removes both the dev-hwrng and 
>> systemd-udev-settle depencies is the right approach. That means that 
>> the original problem that adding systemd-udev-settle was meant to 
>> solve, is no longer solved but it seems that the proposed solutions 
>> here have adverse effects elsewhere.
>>
>> Simply removing the systemd-udev-settle dependency fixes the issue 
>> that my customer has that caused me to start investigating here.
>>
>> Drew
>>
>> -- 
>> mailto:drew@moseleynet.net
> Sorry for the confusion, I did not test any additional patches/changes 
> that have been suggested in this email thread.
> My test was performed on current Yocto master sources. No additional 
> patches.
> I just wanted to inform that the boot delay is also observed on real 
> hw, not just qemu.
> Again, sorry for the confusion.
>
> Dragos


Sorry for adding to the confusion. My point was intended to be that I am 
fairly certain the recent patch submitted by Khem will resolve the boot 
delay issue you are having as well as the original boot delay caused by 
systemd-udev-settle.

Drew
Alexander Kanavin Aug. 19, 2022, 3:21 p.m. UTC | #9
So which recent patch? Can you link to it please?

Alex


On Fri, 19 Aug 2022 at 17:13, Drew Moseley <drew.moseley@gmail.com> wrote:
>
>
> On 8/19/22 11:07 AM, Dragos-Marian Panait wrote:
>
>
> On 19.08.2022 17:34, Drew Moseley wrote:
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
>
> On 8/19/22 8:50 AM, Dragos-Marian Panait wrote:
>
> Hi Claudius,
>
> On 19.08.2022 12:36, Claudius Heine wrote:
>
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> Hi Dew.
>
> On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
>
> From: Drew Moseley <drew@moseleynet.net>
>
> The previous change to remove the dependency on systemd-udev-settle
> caused boot delays at least on qemu. It seems that change required
> a hwrng device but that's not necessarily available on all platforms.
>
> This changes the "Requires" to a "WantedBy" as modeled after the
> version of this file on Ubuntu 20.04.
>
> Signed-off-by: Drew Moseley <drew@moseleynet.net>
> ---
>   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> index 0f50890dcb..b013d95932 100644
> --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
>   DefaultDependencies=no
>   After=systemd-udev-settle.service
>   Before=sysinit.target shutdown.target
> -Requires=dev-hwrng.device
> -After=dev-hwrng.device
>   Conflicts=shutdown.target
>
>   [Service]
> @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
>
>   [Install]
>   WantedBy=sysinit.target
> +WantedBy=dev-hwrng.device
>
>
> This looses the order. Have you tried just replacing `Requires` with
> `Wants`. So something like this:
>
>
> ```
>
> Before=sysinit.target shutdown.target
> Wants=dev-hwrng.device
> After=dev-hwrng.device
> Conflicts=shutdown.target
>
> ```
>
> If that still would cause the long waiting time on qemu?
>
> I haven't investigated the qemu issue, but maybe qemu just doesn't
> provide a hardware random source? If it doesn't provide a hardware
> random source, then installing rng-tools on there might also not make sense.
> Alternatively maybe just adding a start timeout might solve it?
> regards,
> Claudius
>
>
> I've tested the patch on a NUC7, results are the same as with qemu:
> - increased boot time
> - timeout for rng-tools.service
> [ TIME ] Timed out waiting for device /dev/hwrng.
> [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.
>
> Regards,
> Dragos
>
>
> Interesting. I guess this patch should definitely be ignored and the patch from Khem that removes both the dev-hwrng and systemd-udev-settle depencies is the right approach. That means that the original problem that adding systemd-udev-settle was meant to solve, is no longer solved but it seems that the proposed solutions here have adverse effects elsewhere.
>
> Simply removing the systemd-udev-settle dependency fixes the issue that my customer has that caused me to start investigating here.
>
> Drew
>
> --
> mailto:drew@moseleynet.net
>
> Sorry for the confusion, I did not test any additional patches/changes that have been suggested in this email thread.
> My test was performed on current Yocto master sources. No additional patches.
> I just wanted to inform that the boot delay is also observed on real hw, not just qemu.
> Again, sorry for the confusion.
>
> Dragos
>
>
> Sorry for adding to the confusion. My point was intended to be that I am fairly certain the recent patch submitted by Khem will resolve the boot delay issue you are having as well as the original boot delay caused by systemd-udev-settle.
>
> Drew
>
> --
> mailto:drew@moseleynet.net
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#169634): https://lists.openembedded.org/g/openembedded-core/message/169634
> Mute This Topic: https://lists.openembedded.org/mt/93042904/1686489
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Khem Raj Aug. 19, 2022, 4:24 p.m. UTC | #10
On Fri, Aug 19, 2022 at 8:22 AM Alexander Kanavin
<alex.kanavin@gmail.com> wrote:
>
> So which recent patch? Can you link to it please?
>

https://patchwork.yoctoproject.org/project/oe-core/patch/20220813170156.4040589-1-raj.khem@gmail.com/

but this needs to remove sysinit from target, I have meant to send a
v2 but had no time to do so far.

> Alex
>
>
> On Fri, 19 Aug 2022 at 17:13, Drew Moseley <drew.moseley@gmail.com> wrote:
> >
> >
> > On 8/19/22 11:07 AM, Dragos-Marian Panait wrote:
> >
> >
> > On 19.08.2022 17:34, Drew Moseley wrote:
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> >
> > On 8/19/22 8:50 AM, Dragos-Marian Panait wrote:
> >
> > Hi Claudius,
> >
> > On 19.08.2022 12:36, Claudius Heine wrote:
> >
> > [Please note: This e-mail is from an EXTERNAL e-mail address]
> >
> > Hi Dew.
> >
> > On 2022-08-15 20:25, drew.moseley@gmail.com wrote:
> >
> > From: Drew Moseley <drew@moseleynet.net>
> >
> > The previous change to remove the dependency on systemd-udev-settle
> > caused boot delays at least on qemu. It seems that change required
> > a hwrng device but that's not necessarily available on all platforms.
> >
> > This changes the "Requires" to a "WantedBy" as modeled after the
> > version of this file on Ubuntu 20.04.
> >
> > Signed-off-by: Drew Moseley <drew@moseleynet.net>
> > ---
> >   meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > index 0f50890dcb..b013d95932 100644
> > --- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > +++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
> > @@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon
> >   DefaultDependencies=no
> >   After=systemd-udev-settle.service
> >   Before=sysinit.target shutdown.target
> > -Requires=dev-hwrng.device
> > -After=dev-hwrng.device
> >   Conflicts=shutdown.target
> >
> >   [Service]
> > @@ -32,3 +30,4 @@ SystemCallFilter=@system-service
> >
> >   [Install]
> >   WantedBy=sysinit.target
> > +WantedBy=dev-hwrng.device
> >
> >
> > This looses the order. Have you tried just replacing `Requires` with
> > `Wants`. So something like this:
> >
> >
> > ```
> >
> > Before=sysinit.target shutdown.target
> > Wants=dev-hwrng.device
> > After=dev-hwrng.device
> > Conflicts=shutdown.target
> >
> > ```
> >
> > If that still would cause the long waiting time on qemu?
> >
> > I haven't investigated the qemu issue, but maybe qemu just doesn't
> > provide a hardware random source? If it doesn't provide a hardware
> > random source, then installing rng-tools on there might also not make sense.
> > Alternatively maybe just adding a start timeout might solve it?
> > regards,
> > Claudius
> >
> >
> > I've tested the patch on a NUC7, results are the same as with qemu:
> > - increased boot time
> > - timeout for rng-tools.service
> > [ TIME ] Timed out waiting for device /dev/hwrng.
> > [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.
> >
> > Regards,
> > Dragos
> >
> >
> > Interesting. I guess this patch should definitely be ignored and the patch from Khem that removes both the dev-hwrng and systemd-udev-settle depencies is the right approach. That means that the original problem that adding systemd-udev-settle was meant to solve, is no longer solved but it seems that the proposed solutions here have adverse effects elsewhere.
> >
> > Simply removing the systemd-udev-settle dependency fixes the issue that my customer has that caused me to start investigating here.
> >
> > Drew
> >
> > --
> > mailto:drew@moseleynet.net
> >
> > Sorry for the confusion, I did not test any additional patches/changes that have been suggested in this email thread.
> > My test was performed on current Yocto master sources. No additional patches.
> > I just wanted to inform that the boot delay is also observed on real hw, not just qemu.
> > Again, sorry for the confusion.
> >
> > Dragos
> >
> >
> > Sorry for adding to the confusion. My point was intended to be that I am fairly certain the recent patch submitted by Khem will resolve the boot delay issue you are having as well as the original boot delay caused by systemd-udev-settle.
> >
> > Drew
> >
> > --
> > mailto:drew@moseleynet.net
> >
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#169634): https://lists.openembedded.org/g/openembedded-core/message/169634
> > Mute This Topic: https://lists.openembedded.org/mt/93042904/1686489
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alex.kanavin@gmail.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
diff mbox series

Patch

diff --git a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
index 0f50890dcb..b013d95932 100644
--- a/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
+++ b/meta/recipes-support/rng-tools/rng-tools/rng-tools.service
@@ -3,8 +3,6 @@  Description=Hardware RNG Entropy Gatherer Daemon
 DefaultDependencies=no
 After=systemd-udev-settle.service
 Before=sysinit.target shutdown.target
-Requires=dev-hwrng.device
-After=dev-hwrng.device
 Conflicts=shutdown.target
 
 [Service]
@@ -32,3 +30,4 @@  SystemCallFilter=@system-service
 
 [Install]
 WantedBy=sysinit.target
+WantedBy=dev-hwrng.device