From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Message-ID: Date: Fri, 19 Aug 2022 10:34:30 -0400 MIME-Version: 1.0 Reply-To: drew@moseleynet.net Subject: Re: [OE-core][PATCH] rng-tools: Change "Requires" to "WantedBy" for dev-hwrng.device References: <20220815182503.2007534-1-drew@moseleynet.net> <6d48f3e4-28c9-848d-9b14-cb5f1950c4ca@denx.de> From: "Drew Moseley" In-Reply-To: Content-Type: multipart/alternative; boundary="------------hfuYRLXK20HGoqLo3XLqYIGv" Content-Language: en-US List-id: To: Dragos-Marian Panait , Claudius Heine , openembedded-core@lists.openembedded.org Cc: raj.khem@gmail.com --------------hfuYRLXK20HGoqLo3XLqYIGv Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit 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 >>> >>> 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 >>> --- >>>   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 --------------hfuYRLXK20HGoqLo3XLqYIGv Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 8bit


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
--------------hfuYRLXK20HGoqLo3XLqYIGv--