Skip to contentSkip to conversation

rng-tools: add systemd-udev-settle wants to service

PATCH In review Claudius Heine 6 participants 29 messages Sep 17, 2021 – Aug 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rng-tools: add systemd-udev-settle wants to service

rngd needs to start after systemd-udev-settle in order for the kernel modules of the random source hardware to be loaded before it is started.

However, since the rngd.service does not require or want systemd-udev-settle.service it might not be scheduled for start and the After=systemd-udev-settle.service there has no effect.

Adding Wants=systemd-udev-settle.service provides a weak requirement to it, so that the rngd is started after it, if possible.

---

Hi,

this is a fix, which should probably be backported to the maintained releases.

regards,
Claudius

 meta/recipes-support/rng-tools/rng-tools/rngd.service | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-support/rng-tools/rng-tools/rngd.service +1 -0
index 0559b97991..568686e80e 100644
@@ -3,6 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
 DefaultDependencies=no
 After=systemd-udev-settle.service
 Before=sysinit.target shutdown.target
+Wants=systemd-udev-settle.service
 Conflicts=shutdown.target
 
 [Service]
Signature · 1 line
2.33.0
#1 lore raw

Is this the correct approach? Even the systemd-udev-settle.service man pages recommends not using its service. Were the kernel modules really not loaded when rngd started? Or is the original problem just a matter of waiting for sufficient entropy?

Quoted 52 lines · Claudius Heine

rngd needs to start after systemd-udev-settle in order for the kernel modules of the random source hardware to be loaded before it is started.

However, since the rngd.service does not require or want systemd-udev-settle.service it might not be scheduled for start and the After=systemd-udev-settle.service there has no effect.

Adding Wants=systemd-udev-settle.service provides a weak requirement to it, so that the rngd is started after it, if possible.

---

Hi,

this is a fix, which should probably be backported to the maintained releases.

regards,
Claudius

 meta/recipes-support/rng-tools/rng-tools/rngd.service | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-support/rng-tools/rng-tools/rngd.service +1 -1
index 0559b97991..568686e80e 100644
@@ -3,6 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
 DefaultDependencies=no
 After=systemd-udev-settle.service
 Before=sysinit.target shutdown.target
+Wants=systemd-udev-settle.service
 Conflicts=shutdown.target
 
 [Service]
--

2.33.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#156129):
https://lists.openembedded.org/g/openembedded-core/message/156129
Mute This Topic: https://lists.openembedded.org/mt/85671578/4454381
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Kyle,

Quoted 1 line · Kyle Russell

Is this the correct approach?  Even the systemd-udev-settle.service man pages recommends not using its service.  Were the kernel modules really not loaded when rngd started?  Or is the original problem just a matter of waiting for sufficient entropy?

IIRC, the rngd could not find any random source device node (/dev/hwrng in that case), so the service failed to start.

The patch you are commenting on only adds Wants weak dependency to make sure systemd-udev-settle.service is pulled in to the job queue, the After ordering rule was already there.

So changing this service file to be triggered by a udev event or maybe wrap it in a script, which makes sure the right modules are loaded and device nodes are available, could be an improvement, but it would be out of scope of this patch IMO.

regards,
Claudius

Quoted 59 lines · On Fri, Sep 17, 2021 at 4:08 AM Claudius Heine <[email protected]…

rngd needs to start after systemd-udev-settle in order for the kernel modules of the random source hardware to be loaded before it is started.

However, since the rngd.service does not require or want systemd-udev-settle.service it might not be scheduled for start and the After=systemd-udev-settle.service there has no effect.

Adding Wants=systemd-udev-settle.service provides a weak requirement to it, so that the rngd is started after it, if possible.

Signed-off-by Claudius Heine <[email protected] <mailto:[email protected]>>

---

Hi,

this is a fix, which should probably be backported to the maintained releases.

regards,
Claudius

 meta/recipes-support/rng-tools/rng-tools/rngd.service | 1 + 1 file changed, 1 insertion(+)

diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd.service b/meta/recipes-support/rng-tools/rng-tools/rngd.service index 0559b97991..568686e80e 100644
--- a/meta/recipes-support/rng-tools/rng-tools/rngd.service +++ b/meta/recipes-support/rng-tools/rng-tools/rngd.service @@ -3,6 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
 DefaultDependencies=no After=systemd-udev-settle.service Before=sysinit.target shutdown.target
+Wants=systemd-udev-settle.service
 Conflicts=shutdown.target

 [Service]
--
2.33.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#156129):
https://lists.openembedded.org/g/openembedded-core/message/156129
<https://lists.openembedded.org/g/openembedded-core/message/156129>
Mute This Topic: https://lists.openembedded.org/mt/85671578/4454381
<https://lists.openembedded.org/mt/85671578/4454381>
Group Owner: [email protected] <mailto:openembedded-core%[email protected]> Unsubscribe:
https://lists.openembedded.org/g/openembedded-core/unsub
<https://lists.openembedded.org/g/openembedded-core/unsub>
[[email protected] <mailto:[email protected]>]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw

Thanks, Claudius.

Quoted 11 lines · Claudius Heine

Hi Kyle,

Quoted 4 lines · Kyle Russell

Is this the correct approach? Even the systemd-udev-settle.service man pages recommends not using its service. Were the kernel modules really not loaded when rngd started? Or is the original problem just a matter of waiting for sufficient entropy?

IIRC, the rngd could not find any random source device node (/dev/hwrng in that case), so the service failed to start.

If /dev/hwrng didn't exist, this feels like the original problem was a misconfigured
kernel or module that wasn't being loaded properly.

Quoted 4 lines

The patch you are commenting on only adds Wants weak dependency to make sure systemd-udev-settle.service is pulled in to the job queue, the After ordering rule was already there.

Correct. Just because an After exists does not mean the service gets pulled into
the job queue, so prior to this change no other service was causing the deprecated
systemd-udev-settle.service to be run during boot. But now, every device including
openssh (which has a default PACKAGECONFIG option for rng-tools) now depends on this deprecated service, which may cause unexpected boot delays.

Quoted 5 lines

So changing this service file to be triggered by a udev event or maybe wrap it in a script, which makes sure the right modules are loaded and device nodes are available, could be an improvement, but it would be out of scope of this patch IMO.

I'm more curious whether this change should be reverted from upstream. It seems
like a drop-in file could have been applied to your distro instead of adding a dependency
on a deprecated service for all openssh users.

Kyle

Quoted 64 lines
Quoted 5 lines

On Fri, Sep 17, 2021 at 4:08 AM Claudius Heine <[email protected] <mailto:[email protected]>> wrote:

rngd needs to start after systemd-udev-settle in order for the

kernel

Quoted 1 line

modules of the random source hardware to be loaded before it is

started.

Quoted 6 lines

However, since the rngd.service does not require or want systemd-udev-settle.service it might not be scheduled for start and the After=systemd-udev-settle.service there has no effect.

Adding Wants=systemd-udev-settle.service provides a weak

requirement

Quoted 48 lines
    to it, so that the `rngd` is started after it, if possible.

    Signed-off-by: Claudius Heine <[email protected] <mailto:[email protected]>>
    ---

    Hi,

    this is a fix, which should probably be backported to the maintained
    releases.

    regards,
    Claudius

      meta/recipes-support/rng-tools/rng-tools/rngd.service | 1 +
      1 file changed, 1 insertion(+)

    diff --git a/meta/recipes-support/rng-tools/rng-tools/rngd.service
    b/meta/recipes-support/rng-tools/rng-tools/rngd.service
    index 0559b97991..568686e80e 100644
    --- a/meta/recipes-support/rng-tools/rng-tools/rngd.service
    +++ b/meta/recipes-support/rng-tools/rng-tools/rngd.service
    @@ -3,6 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
      DefaultDependencies=no
      After=systemd-udev-settle.service
      Before=sysinit.target shutdown.target
    +Wants=systemd-udev-settle.service
      Conflicts=shutdown.target

      [Service]
    --
    2.33.0


    -=-=-=-=-=-=-=-=-=-=-=-
    Links: You receive all messages sent to this group.
    View/Reply Online (#156129):
    https://lists.openembedded.org/g/openembedded-core/message/156129
    <https://lists.openembedded.org/g/openembedded-core/message/156129>
    Mute This Topic: https://lists.openembedded.org/mt/85671578/4454381
    <https://lists.openembedded.org/mt/85671578/4454381>
    Group Owner: [email protected]
    <mailto:openembedded-core%[email protected]>
    Unsubscribe:
    https://lists.openembedded.org/g/openembedded-core/unsub
    <https://lists.openembedded.org/g/openembedded-core/unsub>
    [[email protected] <mailto:[email protected]>]
    -=-=-=-=-=-=-=-=-=-=-=-
#4 lore raw
Quoted 15 lines · Kyle Russell

Thanks, Claudius.

On Wed, Feb 2, 2022 at 8:08 AM Claudius Heine <[email protected] <mailto:[email protected]>> wrote:

Hi Kyle,

On 2022-02-02 13:38, Kyle Russell wrote:
> Is this the correct approach?  Even the
systemd-udev-settle.service man
> pages recommends not using its service.  Were the kernel modules
really
> not loaded when rngd started?  Or is the original problem just a
matter
> of waiting for sufficient entropy?

Quoted 6 lines

IIRC, the rngd could not find any random source device node (/dev/hwrng in that case), so the service failed to start.

If /dev/hwrng didn't exist, this feels like the original problem was a misconfigured kernel or module that wasn't being loaded properly.

Yes, however it is a timing issue. The module was loaded properly at bootup, however at the time rngd was started the module was not loaded yet and thus the service fails to start. If it would be delayed until the module is loaded everything would be fine.

It does not happen if the module is compiled into the kernel or if a initramfs is used which loads the module (I think). I our case it happend with the caam module as an external module loaded on boot from the real root file system.

Quoted 18 lines

The patch you are commenting on only adds Wants weak dependency to make sure systemd-udev-settle.service is pulled in to the job queue, the After ordering rule was already there.

Correct.  Just because an After exists does not mean the service gets pulled into the job queue, so prior to this change no other service was causing the deprecated systemd-udev-settle.service to be run during boot.  But now, every device including openssh (which has a default PACKAGECONFIG option for rng-tools) now depends on this deprecated service, which may cause unexpected boot delays.

So changing this service file to be triggered by a udev event or maybe wrap it in a script, which makes sure the right modules are loaded and device nodes are available, could be an improvement, but it would be out
of scope of this patch IMO.

Quoted 3 lines

I'm more curious whether this change should be reverted from upstream. It seems like a drop-in file could have been applied to your distro instead of adding a dependency on a deprecated service for all openssh users.

This patch just adds a missing entry into the service file. If you have solved the described issue in some way and can revert this patch and remove the Wants=systemd-udev-settle.service then you can also remove the After=systemd-udev-settle.service at the same time and at that point you can just remove both of those entries directly in the patch that solved the timing issue.

I agree that systemd-udev-settle.service should probably not be used anymore, however that file already used it in a non-functional way and all this patch did was make it fulfill its intended function.

In retrospect I probably should have tried to find a way to remove the usage of systemd-udev-settle.service completely, when I looked into the issue, however all this patch in essence does is revive dead code, which was already in place.

Also I think at that time I couldn't find a more precise instrument in systemds massive toolbox to delay the start of rngd and services that should be started in succession until the just the hardware random generator device is ready and After=systemd-udev-settle.service was already there. I guess some ExecStartPre= script which delays the start until the conditions are met could be implemented, but that seems a bit hackish.

regards,
Claudius

#5 lore raw

Thanks, Claudius. I really appreciate your responses. I'm not trying to be pedantic. Since I don't have your test setup, I was just trying to make sure I understood the context of the problem as I figure out how to deal with issues this is causing in our setup.

I was also hoping one of the recipe maintainers of either systemd or rng-tools would comment on systemd-udev-settle.

I'll take a look at the caam module to see if I can understand how it works.

Quoted 94 lines · Claudius Heine
Quoted 16 lines · Kyle Russell

Thanks, Claudius.

On Wed, Feb 2, 2022 at 8:08 AM Claudius Heine <[email protected] <mailto:[email protected]>> wrote:

Hi Kyle,

On 2022-02-02 13:38, Kyle Russell wrote:
> Is this the correct approach? Even the
systemd-udev-settle.service man
> pages recommends not using its service. Were the kernel modules
really
> not loaded when rngd started? Or is the original problem just a
matter
> of waiting for sufficient entropy?

Quoted 1 line

IIRC, the rngd could not find any random source device node

(/dev/hwrng

Quoted 6 lines

in that case), so the service failed to start.

If /dev/hwrng didn't exist, this feels like the original problem was a misconfigured
kernel or module that wasn't being loaded properly.

Yes, however it is a timing issue. The module was loaded properly at bootup, however at the time rngd was started the module was not loaded yet and thus the service fails to start. If it would be delayed until the module is loaded everything would be fine.

It does not happen if the module is compiled into the kernel or if a initramfs is used which loads the module (I think). I our case it happend with the caam module as an external module loaded on boot from the real root file system.

Quoted 2 lines

The patch you are commenting on only adds Wants weak dependency to make sure systemd-udev-settle.service is pulled in to the job

queue,

Quoted 10 lines

the After ordering rule was already there.

Correct. Just because an After exists does not mean the service gets pulled into
the job queue, so prior to this change no other service was causing the deprecated
systemd-udev-settle.service to be run during boot. But now, every device including
openssh (which has a default PACKAGECONFIG option for rng-tools) now

depends

Quoted 3 lines

on this deprecated service, which may cause unexpected boot delays.

So changing this service file to be triggered by a udev event or

maybe

Quoted 1 line

wrap it in a script, which makes sure the right modules are loaded

and

Quoted 10 lines

device nodes are available, could be an improvement, but it would be out
of scope of this patch IMO.

I'm more curious whether this change should be reverted from upstream. It seems
like a drop-in file could have been applied to your distro instead of adding a dependency
on a deprecated service for all openssh users.

This patch just adds a missing entry into the service file. If you have solved the described issue in some way and can revert this patch and remove the Wants=systemd-udev-settle.service then you can also remove the After=systemd-udev-settle.service at the same time and at that point you can just remove both of those entries directly in the patch that solved the timing issue.

I agree that systemd-udev-settle.service should probably not be used anymore, however that file already used it in a non-functional way and all this patch did was make it fulfill its intended function.

In retrospect I probably should have tried to find a way to remove the usage of systemd-udev-settle.service completely, when I looked into the issue, however all this patch in essence does is revive dead code, which was already in place.

Also I think at that time I couldn't find a more precise instrument in systemds massive toolbox to delay the start of rngd and services that should be started in succession until the just the hardware random generator device is ready and After=systemd-udev-settle.service was already there. I guess some ExecStartPre= script which delays the start until the conditions are met could be implemented, but that seems a bit hackish.

regards,
Claudius

#6 lore raw
Quoted 118 lines · Kyle Russell

Thanks, Claudius.  I really appreciate your responses.  I'm not trying to be pedantic.  Since I don't have your test setup, I was just trying to make sure I understood the context of the problem as I figure out how to deal with issues this is causing in our setup.

I was also hoping one of the recipe maintainers of either systemd or rng-tools would comment on systemd-udev-settle.

I'll take a look at the caam module to see if I can understand how it works.

On Thu, Feb 3, 2022 at 3:35 AM Claudius Heine <[email protected]> wrote:

On 2022-02-02 17:26, Kyle Russell wrote:
> Thanks, Claudius.
>
> On Wed, Feb 2, 2022 at 8:08 AM Claudius Heine <[email protected] > <mailto:[email protected]>> wrote:
>
>     Hi Kyle,
>
>     On 2022-02-02 13:38, Kyle Russell wrote:
>      > Is this the correct approach?  Even the
>     systemd-udev-settle.service man
>      > pages recommends not using its service.  Were the kernel modules
>     really
>      > not loaded when rngd started?  Or is the original problem just a
>     matter
>      > of waiting for sufficient entropy?
>
>     IIRC, the rngd could not find any random source device node (/dev/hwrng
>     in that case), so the service failed to start.
>
>
> If /dev/hwrng didn't exist, this feels like the original problem was a
> misconfigured
> kernel or module that wasn't being loaded properly.

Yes, however it is a timing issue. The module was loaded properly at bootup, however at the time rngd was started the module was not loaded
yet and thus the service fails to start. If it would be delayed until the module is loaded everything would be fine.

It does not happen if the module is compiled into the kernel or if a initramfs is used which loads the module (I think). I our case it happend with the caam module as an external module loaded on boot from
the real root file system.

>     The patch you are commenting on only adds Wants weak dependency to
>     make sure systemd-udev-settle.service is pulled in to the job queue,
>     the After ordering rule was already there.
>
>
> Correct.  Just because an After exists does not mean the service gets
> pulled into
> the job queue, so prior to this change no other service was causing the
> deprecated
> systemd-udev-settle.service to be run during boot.  But now, every > device including
> openssh (which has a default PACKAGECONFIG option for rng-tools) now depends
> on this deprecated service, which may cause unexpected boot delays. >
>     So changing this service file to be triggered by a udev event or maybe
>     wrap it in a script, which makes sure the right modules are loaded and
>     device nodes are available, could be an improvement, but it would be
>     out
>     of scope of this patch IMO.
>
>
> I'm more curious whether this change should be reverted from upstream.
> It seems
> like a drop-in file could have been applied to your distro instead of
> adding a dependency
> on a deprecated service for all openssh users.

This patch just adds a missing entry into the service file. If you have
solved the described issue in some way and can revert this patch and remove the Wants=systemd-udev-settle.service then you can also remove
the After=systemd-udev-settle.service at the same time and at that point you can just remove both of those entries directly in the patch that solved the timing issue.

I agree that systemd-udev-settle.service should probably not be used
anymore, however that file already used it in a non-functional way and
all this patch did was make it fulfill its intended function.

In retrospect I probably should have tried to find a way to remove the
usage of systemd-udev-settle.service completely, when I looked into the issue, however all this patch in essence does is revive dead code,
which was already in place.

Also I think at that time I couldn't find a more precise instrument in
systemds massive toolbox to delay the start of rngd and services that should be started in succession until the just the hardware random generator device is ready and After=systemd-udev-settle.service was already there. I guess some ExecStartPre= script which delays the start until the conditions are met could be implemented, but that seems
a bit hackish.

Quoted 3 lines

regards,
Claudius

We are getting report from our users that adding this "Wants" causes extremely slow boots on systems where it did not happen before this change. Has anyone looked further into this and whether this change is truly necessary?

We have it reverted locally to work around the specific issue but I wonder if there is a deeper issue here.

Drew

Signature · 1 line
mailto:[email protected]
#7 lore raw
Quoted 120 lines · Drew Moseley
Quoted 118 lines · Kyle Russell

Thanks, Claudius.  I really appreciate your responses.  I'm not trying to be pedantic.  Since I don't have your test setup, I was just trying to make sure I understood the context of the problem as I figure out how to deal with issues this is causing in our setup.

I was also hoping one of the recipe maintainers of either systemd or rng-tools would comment on systemd-udev-settle.

I'll take a look at the caam module to see if I can understand how it works.

On Thu, Feb 3, 2022 at 3:35 AM Claudius Heine <[email protected]> wrote:

On 2022-02-02 17:26, Kyle Russell wrote:
> Thanks, Claudius.
>
> On Wed, Feb 2, 2022 at 8:08 AM Claudius Heine <[email protected] > <mailto:[email protected]>> wrote:
>
>     Hi Kyle,
>
>     On 2022-02-02 13:38, Kyle Russell wrote:
>      > Is this the correct approach?  Even the
>     systemd-udev-settle.service man
>      > pages recommends not using its service.  Were the kernel modules
>     really
>      > not loaded when rngd started?  Or is the original problem just a
>     matter
>      > of waiting for sufficient entropy?
>
>     IIRC, the rngd could not find any random source device node (/dev/hwrng
>     in that case), so the service failed to start.
>
>
> If /dev/hwrng didn't exist, this feels like the original problem was a
> misconfigured
> kernel or module that wasn't being loaded properly.

Yes, however it is a timing issue. The module was loaded properly at bootup, however at the time rngd was started the module was not loaded
yet and thus the service fails to start. If it would be delayed until the module is loaded everything would be fine.

It does not happen if the module is compiled into the kernel or if a initramfs is used which loads the module (I think). I our case it happend with the caam module as an external module loaded on boot from
the real root file system.

>     The patch you are commenting on only adds Wants weak dependency to
>     make sure systemd-udev-settle.service is pulled in to the job queue,
>     the After ordering rule was already there.
>
>
> Correct.  Just because an After exists does not mean the service gets
> pulled into
> the job queue, so prior to this change no other service was causing the
> deprecated
> systemd-udev-settle.service to be run during boot.  But now, every > device including
> openssh (which has a default PACKAGECONFIG option for rng-tools) now depends
> on this deprecated service, which may cause unexpected boot delays. >
>     So changing this service file to be triggered by a udev event or maybe
>     wrap it in a script, which makes sure the right modules are loaded and
>     device nodes are available, could be an improvement, but it would be
>     out
>     of scope of this patch IMO.
>
>
> I'm more curious whether this change should be reverted from upstream.
> It seems
> like a drop-in file could have been applied to your distro instead of
> adding a dependency
> on a deprecated service for all openssh users.

This patch just adds a missing entry into the service file. If you have
solved the described issue in some way and can revert this patch and remove the Wants=systemd-udev-settle.service then you can also remove
the After=systemd-udev-settle.service at the same time and at that point you can just remove both of those entries directly in the patch that solved the timing issue.

I agree that systemd-udev-settle.service should probably not be used
anymore, however that file already used it in a non-functional way and
all this patch did was make it fulfill its intended function.

In retrospect I probably should have tried to find a way to remove the
usage of systemd-udev-settle.service completely, when I looked into the issue, however all this patch in essence does is revive dead code,
which was already in place.

Also I think at that time I couldn't find a more precise instrument in
systemds massive toolbox to delay the start of rngd and services that should be started in succession until the just the hardware random generator device is ready and After=systemd-udev-settle.service was already there. I guess some ExecStartPre= script which delays the start until the conditions are met could be implemented, but that seems
a bit hackish.

Quoted 7 lines
Quoted 3 lines

regards,
Claudius

We are getting report from our users that adding this "Wants" causes extremely slow boots on systems where it did not happen before this change. Has anyone looked further into this and whether this change is truly necessary?

We have it reverted locally to work around the specific issue but I wonder if there is a deeper issue here.

It seems the issue was that module load was racing with rngd in that case perhaps adding After=systemd-modules-load.service
might have been another choice to solve it. Using systemd-udev-settle.service is a bit heavy handed as it will wait for full h/w discovery which could vary from system to system.

Quoted 10 lines

Drew

Signature · 1 line
mailto:[email protected]
#8 lore raw

So should I submit a patch with that change? I don't know how to reproduce the original issue so I won't have any way to prove if this is a viable fix.

Drew

#9 lore raw
Quoted 3 lines · Drew Moseley

So should I submit a patch with that change? I don't know how to reproduce the original issue so I won't have any way to prove if this is a viable fix.

Does this fix the problem you see ? if it does then perhaps Claudius can help trying it for the original issue and help validate further.

Quoted 9 lines

Drew
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#168425): https://lists.openembedded.org/g/openembedded-core/message/168425
Mute This Topic: https://lists.openembedded.org/mt/85671578/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#10 lore raw
In reply to Khem Raj

Hi Khem,

Quoted 127 lines · Khem Raj
Quoted 124 lines · Drew Moseley
Quoted 121 lines · Kyle Russell

Thanks, Claudius.  I really appreciate your responses.  I'm not trying to be pedantic.  Since I don't have your test setup, I was just trying to make sure I understood the context of the problem as I figure out how to deal with issues this is causing in our setup.

I was also hoping one of the recipe maintainers of either systemd or rng-tools would comment on systemd-udev-settle.

I'll take a look at the caam module to see if I can understand how it works.

On Thu, Feb 3, 2022 at 3:35 AM Claudius Heine <[email protected]> wrote:

    On 2022-02-02 17:26, Kyle Russell wrote:
    > Thanks, Claudius.
    >
    > On Wed, Feb 2, 2022 at 8:08 AM Claudius Heine <[email protected] > <mailto:[email protected]>> wrote:
    >
    >     Hi Kyle,
    >
    >     On 2022-02-02 13:38, Kyle Russell wrote:
    >      > Is this the correct approach?  Even the
    >     systemd-udev-settle.service man
    >      > pages recommends not using its service.  Were the kernel modules
    >     really
    >      > not loaded when rngd started?  Or is the original problem just a
    >     matter
    >      > of waiting for sufficient entropy?
    >
    >     IIRC, the rngd could not find any random source device node (/dev/hwrng
    >     in that case), so the service failed to start.
    >
    >
    > If /dev/hwrng didn't exist, this feels like the original problem was a
    > misconfigured
    > kernel or module that wasn't being loaded properly.

    Yes, however it is a timing issue. The module was loaded properly at bootup, however at the time rngd was started the module was not loaded
    yet and thus the service fails to start. If it would be delayed until the module is loaded everything would be fine.

    It does not happen if the module is compiled into the kernel or if a initramfs is used which loads the module (I think). I our case it happend with the caam module as an external module loaded on boot from
    the real root file system.

    >     The patch you are commenting on only adds Wants weak dependency to
    >     make sure systemd-udev-settle.service is pulled in to the job queue,
    >     the After ordering rule was already there.
    >
    >
    > Correct.  Just because an After exists does not mean the service gets
    > pulled into
    > the job queue, so prior to this change no other service was causing the
    > deprecated
    > systemd-udev-settle.service to be run during boot.  But now, every > device including
    > openssh (which has a default PACKAGECONFIG option for rng-tools) now depends
    > on this deprecated service, which may cause unexpected boot delays. >
    >     So changing this service file to be triggered by a udev event or maybe
    >     wrap it in a script, which makes sure the right modules are loaded and
    >     device nodes are available, could be an improvement, but it would be
    >     out
    >     of scope of this patch IMO.
    >
    >
    > I'm more curious whether this change should be reverted from upstream.
    > It seems
    > like a drop-in file could have been applied to your distro instead of
    > adding a dependency
    > on a deprecated service for all openssh users.

    This patch just adds a missing entry into the service file. If you have
    solved the described issue in some way and can revert this patch and remove the Wants=systemd-udev-settle.service then you can also remove
    the After=systemd-udev-settle.service at the same time and at that point you can just remove both of those entries directly in the patch that solved the timing issue.

    I agree that systemd-udev-settle.service should probably not be used
    anymore, however that file already used it in a non-functional way and
    all this patch did was make it fulfill its intended function.

    In retrospect I probably should have tried to find a way to remove the
    usage of systemd-udev-settle.service completely, when I looked into the issue, however all this patch in essence does is revive dead code,
    which was already in place.

    Also I think at that time I couldn't find a more precise instrument in
    systemds massive toolbox to delay the start of rngd and services that should be started in succession until the just the hardware random generator device is ready and After=systemd-udev-settle.service was already there. I guess some ExecStartPre= script which delays the start until the conditions are met could be implemented, but that seems
    a bit hackish.

    regards,
    Claudius

Quoted 6 lines
Quoted 3 lines

We are getting report from our users that adding this "Wants" causes extremely slow boots on systems where it did not happen before this change. Has anyone looked further into this and whether this change is truly necessary?

We have it reverted locally to work around the specific issue but I wonder if there is a deeper issue here.

It seems the issue was that module load was racing with rngd in that case perhaps adding After=systemd-modules-load.service
might have been another choice to solve it. Using systemd-udev-settle.service is a bit heavy handed as it will wait for full h/w discovery which could vary from system to system.

Maybe systemd-modules-load.service could be enough in many cases, however it has to be made sure that the device node /dev/hwrng is created before the service is started. Just making sure that the modules are loaded might not be enough...

As I described the best, albeit a bit hackish solutions, would be a ExecStartPre script that delays the service until the system is ready for rngd.

It is a bit difficult for me to test this now, since I no longer have access to exactly that hardware, but I will try to review all patches and comment on it if I find any potential issues.

regards,
Claudius

#11 lore raw

PATCH 1/1 rng-tools: Replace obsolete "wants systemd-udev-settle"

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time. Replace that with "after systemd-modules-load" to allow the random source hardware to be loaded in the proper sequence.

Before this change:

Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) = 2min 17.262s multi-user.target reached after 2min 8.153s in userspace

After this change:

Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
 meta/recipes-support/rng-tools/rng-tools/rngd.service | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +1 -1
index 568686e80e..e818cfcf78 100644
@@ -3,7 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
 DefaultDependencies=no
 After=systemd-udev-settle.service
 Before=sysinit.target shutdown.target
-Wants=systemd-udev-settle.service
+After=systemd-modules-load.service
 Conflicts=shutdown.target
 
 [Service]
Signature · 1 line
2.37.1
#12 lore raw

Re: [OE-core][PATCH] rng-tools: Replace obsolete "wants systemd-udev-settle"

Quoted 27 lines · On 7/26/22 9:17 AM, [email protected] wrote:

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time. Replace that with "after systemd-modules-load" to allow the random source hardware to be loaded in the proper sequence.

Before this change:

Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) = 2min 17.262s multi-user.target reached after 2min 8.153s in userspace

After this change:

Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
  meta/recipes-support/rng-tools/rng-tools/rngd.service | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +0 -0
index 568686e80e..e818cfcf78 100644

meta/recipes-support/rng-tools/rng-tools/rngd.service Description=Hardware RNG Entropy Gatherer Daemon · line 9

Quoted 8 lines
meta/recipes-support/rng-tools/rng-tools/rngd.service +1 -1
@@ -3,7 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target
-Wants=systemd-udev-settle.service
+After=systemd-modules-load.service
  Conflicts=shutdown.target
 
  [Service]

Hi Khem, Claudius,

Any thoughts on this change? Obviously I cannot verify if the original hardware combination issue is resolved and unfortunately it sounds like you cannot either but I'm using this successfully to work around the delayed boots I was seeing here.

Drew

Signature · 1 line
mailto:[email protected]
#13 lore raw

Re: [OE-core][PATCH] rng-tools: Replace obsolete "wants systemd-udev-settle"

Hi Drew,

Quoted 40 lines · Drew Moseley
Quoted 32 lines · On 7/26/22 9:17 AM, [email protected] wrote:

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time.  Replace that with "after systemd-modules-load" to allow the random source hardware to be loaded in the proper sequence.

Before this change:

    Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) = 2min 17.262s multi-user.target reached after 2min 8.153s in userspace

After this change:

    Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
  meta/recipes-support/rng-tools/rng-tools/rngd.service | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +0 -0
index 568686e80e..e818cfcf78 100644
@@ -3,7 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon

  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target

meta/recipes-support/rng-tools/rng-tools/rngd.service +1 -1
-Wants=systemd-udev-settle.service
+After=systemd-modules-load.service
Quoted 2 lines

  Conflicts=shutdown.target
  [Service]

Hi Khem, Claudius,

Quoted 1 line

Any thoughts on this change? Obviously I cannot verify if the original hardware combination issue is resolved and unfortunately it sounds like you cannot either but I'm using this successfully to work around the delayed boots I was seeing here.

Well as I said, systemd-modules-load.service just waits until all statically configured modules are loaded, however not until the /dev/hwrng device node is available. systemd-udev-settle.service waits until all udev rules are applied, and that means it includes loading of all dynamically loaded modules as well as executing code that creates symlinks, etc.

Instead of waiting for modules to be loaded, that might be unrelated or waiting for all (mostly unrelated) udev rules to be settled, I think waiting directly for the /dev/hwrng device node might be more explicit and specific.

regards,
Claudius

#14 lore raw

Re: [OE-core][PATCH] rng-tools: Replace obsolete "wants systemd-udev-settle"

Quoted 57 lines · Claudius Heine

Hi Drew,

Quoted 42 lines · Drew Moseley
Quoted 29 lines · On 7/26/22 9:17 AM, [email protected] wrote:

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time. Replace that with "after systemd-modules-load" to allow the random source hardware to be loaded in the proper sequence.

Before this change:

    Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) =

2min 17.262s
multi-user.target reached after 2min 8.153s in userspace

After this change:

Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
  meta/recipes-support/rng-tools/rng-tools/rngd.service | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +0 -0
index 568686e80e..e818cfcf78 100644

meta/recipes-support/rng-tools/rng-tools/rngd.service Description=Hardware RNG Entropy Gatherer Daemon · line 8

Quoted 7 lines
meta/recipes-support/rng-tools/rng-tools/rngd.service +1 -1
@@ -3,7 +3,7 @@ Description=Hardware RNG Entropy Gatherer Daemon
  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target
-Wants=systemd-udev-settle.service
+After=systemd-modules-load.service
  Conflicts=shutdown.target
  [Service]

Hi Khem, Claudius,

Quoted 4 lines

Any thoughts on this change? Obviously I cannot verify if the original hardware combination issue is resolved and unfortunately it sounds like you cannot either but I'm using this successfully to work around the delayed boots I was seeing here.

Well as I said, systemd-modules-load.service just waits until all statically configured modules are loaded, however not until the /dev/hwrng device node is available. systemd-udev-settle.service waits until all udev rules are applied, and that means it includes loading of all dynamically loaded modules as well as executing code that creates symlinks, etc.

Quoted 5 lines

Instead of waiting for modules to be loaded, that might be unrelated or waiting for all (mostly unrelated) udev rules to be settled, I think waiting directly for the /dev/hwrng device node might be more explicit and specific.

Yeah something more surgical and pointed

Requires=dev-hwrng.device
After=dev-hwrng.device

Might be worth trying

Quoted 3 lines

regards,
Claudius

#15 lore raw

PATCH v2 1/1 rng-tools: Replace obsolete "wants systemd-udev-settle"

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time. Replace that with a specific wait for the random source hardware device to be loaded.

Before this change:

Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) = 2min 17.262s multi-user.target reached after 2min 8.153s in userspace

After this change:

Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
 meta/recipes-support/rng-tools/rng-tools/rngd.service | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +2 -1
index 568686e80e..0f50890dcb 100644
@@ -3,7 +3,8 @@ Description=Hardware RNG Entropy Gatherer Daemon
 DefaultDependencies=no
 After=systemd-udev-settle.service
 Before=sysinit.target shutdown.target
-Wants=systemd-udev-settle.service
+Requires=dev-hwrng.device
+After=dev-hwrng.device
 Conflicts=shutdown.target
 
 [Service]
Signature · 1 line
2.37.1
#16 lore raw

Re: [OE-core][PATCH v2] rng-tools: Replace obsolete "wants systemd-udev-settle"

It seems that this change introduced a boot delay for qemux86-64 + systemd build.

Steps:

git clone git://git.yoctoproject.org/poky
. poky/oe-init-build-env

add to conf/local.conf:

DISTRO_FEATURES:remove = " sysvinit"
DISTRO_FEATURES:append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = ""

bitbake core-image-full-cmdline

Cause of boot delay:
[ TIME ] Timed out waiting for device /dev/hwrng. [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.

Regards,
Dragos

Quoted 49 lines · Drew Moseley

[Please note: This e-mail is from an EXTERNAL e-mail address]

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time. Replace that with a specific wait for the random source hardware device to be loaded.

Before this change:

Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) = 2min 17.262s multi-user.target reached after 2min 8.153s in userspace

After this change:

Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
  meta/recipes-support/rng-tools/rng-tools/rngd.service | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +2 -2
index 568686e80e..0f50890dcb 100644
@@ -3,7 +3,8 @@ Description=Hardware RNG Entropy Gatherer Daemon
  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target
-Wants=systemd-udev-settle.service
+Requires=dev-hwrng.device
+After=dev-hwrng.device
  Conflicts=shutdown.target
 
  [Service]
--

2.37.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#168859): https://lists.openembedded.org/g/openembedded-core/message/168859
Mute This Topic: https://lists.openembedded.org/mt/92815243/6328324
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#17 lore raw

Re: [OE-core][PATCH v2] rng-tools: Replace obsolete "wants systemd-udev-settle"

Well dang. Any other suggestions on how to resolve the original issue without breaking others things?

Drew

Quoted 67 lines · Dragos-Marian Panait

It seems that this change introduced a boot delay for qemux86-64 + systemd build.

Steps:

git clone git://git.yoctoproject.org/poky
. poky/oe-init-build-env

add to conf/local.conf:

DISTRO_FEATURES:remove = " sysvinit"
DISTRO_FEATURES:append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = ""

bitbake core-image-full-cmdline

Cause of boot delay:
[ TIME ] Timed out waiting for device /dev/hwrng. [DEPEND] Dependency failed for Hard…e RNG Entropy Gatherer Daemon.

Regards,
Dragos

Quoted 43 lines · Drew Moseley

[Please note: This e-mail is from an EXTERNAL e-mail address]

From: Drew Moseley <[email protected]>

The systemd-udev-settle service is listed as obsolete and does in some cases result in a significant boot time.  Replace that with a specific wait for the random source hardware device to be loaded.

Before this change:

    Startup finished in 4.025s (kernel) + 2min 13.236s (userspace) = 2min 17.262s multi-user.target reached after 2min 8.153s in userspace

After this change:

    Startup finished in 3.956s (kernel) + 13.294s (userspace) = 17.250s multi-user.target reached after 9.522s in userspace

---
  meta/recipes-support/rng-tools/rng-tools/rngd.service | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-support/rng-tools/rng-tools/rngd.service +0 -0
index 568686e80e..0f50890dcb 100644
@@ -3,7 +3,8 @@ Description=Hardware RNG Entropy Gatherer Daemon

  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target

meta/recipes-support/rng-tools/rng-tools/rngd.service +2 -1
-Wants=systemd-udev-settle.service
+Requires=dev-hwrng.device
+After=dev-hwrng.device

  Conflicts=shutdown.target

  [Service]

Signature · 1 line
2.37.1
Signature · 1 line
mailto:[email protected]
#18 lore raw

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

From: Drew Moseley <[email protected]>

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.

---
 meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -2
index 0f50890dcb..b013d95932 100644
@@ -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
Signature · 1 line
2.37.2
#19 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

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

Quoted 32 lines · On 8/15/22 2:25 PM, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -2
index 0f50890dcb..b013d95932 100644
@@ -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
Signature · 1 line
mailto:[email protected]
#20 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Quoted 5 lines · Drew Moseley

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.

Quoted 45 lines

Claudius, any thoughts here?

Drew

Quoted 28 lines · On 8/15/22 2:25 PM, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
index 0f50890dcb..b013d95932 100644
@@ -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]

meta/recipes-support/rng-tools/rng-tools/rng-tools.service SystemCallFilter=@system-service · line 33

Quoted 4 lines
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -0
@@ -32,3 +30,4 @@ SystemCallFilter=@system-service
 
  [Install]
  WantedBy=sysinit.target
+WantedBy=dev-hwrng.device

--
mailto:[email protected]

#21 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

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

Quoted 68 lines · Khem Raj
Quoted 5 lines · Drew Moseley

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.

Quoted 38 lines

Claudius, any thoughts here?

Drew

Quoted 29 lines · On 8/15/22 2:25 PM, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
index 0f50890dcb..b013d95932 100644
@@ -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
 
Quoted 7 lines

meta/recipes-support/rng-tools/rng-tools/rng-tools.service SystemCallFilter=@system-service · line 33

Quoted 3 lines
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -0
  [Install]
  WantedBy=sysinit.target
+WantedBy=dev-hwrng.device

--
mailto:[email protected]

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#22 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

In reply to [email protected]

Hi Dew.

Quoted 28 lines · On 2022-08-15 20:25, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
index 0f50890dcb..b013d95932 100644
@@ -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]

meta/recipes-support/rng-tools/rng-tools/rng-tools.service SystemCallFilter=@system-service · line 33

Quoted 4 lines
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -0
@@ -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

#23 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Hi Claudius,

Quoted 51 lines · Claudius Heine

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hi Dew.

Quoted 29 lines · On 2022-08-15 20:25, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
index 0f50890dcb..b013d95932 100644
@@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon

  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
-Requires=dev-hwrng.device
-After=dev-hwrng.device

  Conflicts=shutdown.target

  [Service]

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
@@ -32,3 +30,4 @@ SystemCallFilter=@system-service
 
Quoted 3 lines

  [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

```
Quoted 8 lines

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

#24 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Quoted 65 lines · Dragos-Marian Panait

Hi Claudius,

Quoted 51 lines · Claudius Heine

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hi Dew.

Quoted 29 lines · On 2022-08-15 20:25, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
index 0f50890dcb..b013d95932 100644
@@ -3,8 +3,6 @@ Description=Hardware RNG Entropy Gatherer Daemon

  DefaultDependencies=no
  After=systemd-udev-settle.service
  Before=sysinit.target shutdown.target

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
-Requires=dev-hwrng.device
-After=dev-hwrng.device

  Conflicts=shutdown.target

  [Service]

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
@@ -32,3 +30,4 @@ SystemCallFilter=@system-service
 
Quoted 3 lines

  [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

```
Quoted 8 lines

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

Quoted 9 lines

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

Signature · 1 line
mailto:[email protected]
#25 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Quoted 85 lines · Drew Moseley

**[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 70 lines · Dragos-Marian Panait

Hi Claudius,

Quoted 56 lines · Claudius Heine

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hi Dew.

Quoted 34 lines · On 2022-08-15 20:25, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
index 0f50890dcb..b013d95932 100644
@@ -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$>

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
-Requires=dev-hwrng.device
-After=dev-hwrng.device

  Conflicts=shutdown.target <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$>

  [Service]

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
@@ -32,3 +30,4 @@ SystemCallFilter=@system-service
 

  [Install]
  WantedBy=sysinit.target <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$>

Quoted 1 line

+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$> 


```
Quoted 8 lines

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

Quoted 9 lines

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

Quoted 8 lines

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

Signature · 1 line
mailto:[email protected]

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

#26 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Quoted 94 lines · Dragos-Marian Panait
Quoted 91 lines · Drew Moseley

**[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 70 lines · Dragos-Marian Panait

Hi Claudius,

Quoted 56 lines · Claudius Heine

[Please note: This e-mail is from an EXTERNAL e-mail address]

Hi Dew.

Quoted 34 lines · On 2022-08-15 20:25, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
index 0f50890dcb..b013d95932 100644
@@ -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$>

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -2
-Requires=dev-hwrng.device
-After=dev-hwrng.device

  Conflicts=shutdown.target <https://urldefense.com/v3/__http://shutdown.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhfig0Hzw$>

  [Service]

meta/recipes-support/rng-tools/rng-tools/rng-tools.service +0 -0
@@ -32,3 +30,4 @@ SystemCallFilter=@system-service
 

  [Install]
  WantedBy=sysinit.target <https://urldefense.com/v3/__http://sysinit.target__;!!AjveYdw8EvQ!bMQ5MfvZXWSzWjMLcLKDiM6wYi4-aF2QLE3CUcAKrFyEDpC2HxgAIFZGkwbGAHCJ81Fwt4gLnBeDKIdmEXOhOUu8G5A$>

Quoted 1 line

+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$> 


```
Quoted 8 lines

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

Quoted 9 lines

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

Quoted 8 lines
Quoted 2 lines
Signature · 1 line
mailto:[email protected]

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

Signature · 1 line
mailto:[email protected]
#27 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

So which recent patch? Can you link to it please?

Alex

Quoted 122 lines · Drew Moseley

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, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -2
index 0f50890dcb..b013d95932 100644
@@ -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:[email protected]

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:[email protected]

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#28 lore raw

Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device

Quoted 3 lines · Alexander Kanavin

So which recent patch? Can you link to it please?

https://patchwork.yoctoproject.org/project/oe-core/patch/[email protected]/

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

Quoted 126 lines

Alex

Quoted 122 lines · Drew Moseley

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, [email protected] wrote:

From: Drew Moseley <[email protected]>

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.

---
  meta/recipes-support/rng-tools/rng-tools/rng-tools.service | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
meta/recipes-support/rng-tools/rng-tools/rng-tools.service +1 -2
index 0f50890dcb..b013d95932 100644
@@ -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:[email protected]

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:[email protected]

-=-=-=-=-=-=-=-=-=-=-=-
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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-