[v2,3/3] systemd: Minimize udev package size if DISTRO_FEATURES contains systemd

Message ID 20220202073525.3413-3-stefan.herbrechtsmeier-oss@weidmueller.com
State New
Headers show
Series [v2,1/3] cve-check: create directory of CVE_CHECK_MANIFEST before copy | expand

Commit Message

Stefan Herbrechtsmeier Feb. 2, 2022, 7:35 a.m. UTC
From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

Link udev shared with systemd helper to minimize the udev package size
if DISTRO_FEATURES contains systemd.

It is only usefull to link udev static with systemd helper if udev
should be installed without systemd.

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

---

(no changes since v1)

 meta/recipes-core/systemd/systemd_249.7.bb | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Purdie Feb. 6, 2022, 8:10 a.m. UTC | #1
On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Link udev shared with systemd helper to minimize the udev package size
> if DISTRO_FEATURES contains systemd.
> 
> It is only usefull to link udev static with systemd helper if udev
> should be installed without systemd.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> ---
> 
> (no changes since v1)
> 
>  meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>  1 file changed, 1 insertion(+)


This seems to break some of our tests:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127

Presumably it causes extra dependencies to be pulled in causing the file overlap
where there was previously none.

Cheers,

Richard
Richard Purdie Feb. 6, 2022, 9:53 a.m. UTC | #2
On Sun, 2022-02-06 at 08:10 +0000, Richard Purdie via lists.openembedded.org
wrote:
> On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
> > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> > 
> > Link udev shared with systemd helper to minimize the udev package size
> > if DISTRO_FEATURES contains systemd.
> > 
> > It is only usefull to link udev static with systemd helper if udev
> > should be installed without systemd.
> > 
> > Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> > 
> > ---
> > 
> > (no changes since v1)
> > 
> >  meta/recipes-core/systemd/systemd_249.7.bb | 1 +
> >  1 file changed, 1 insertion(+)
> 
> 
> This seems to break some of our tests:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
> https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127
> 
> Presumably it causes extra dependencies to be pulled in causing the file overlap
> where there was previously none.

Thinking a bit more, I think this needs to be:

diff --git a/meta/recipes-core/systemd/systemd_250.3.bb b/meta/recipes-core/systemd/systemd_250.3.bb
index 2b6bfcc2c25..7851c4c16a7 100644
--- a/meta/recipes-core/systemd/systemd_250.3.bb
+++ b/meta/recipes-core/systemd/systemd_250.3.bb
@@ -69,7 +69,7 @@ PACKAGECONFIG ??= " \
     ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'link-udev-shared', '', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
     backlight \
     binfmt \
     gshadow \


which I'll test...

Cheers,

Richard
Stefan Herbrechtsmeier Feb. 6, 2022, 4:39 p.m. UTC | #3
Am 06.02.22 um 09:10 schrieb Richard Purdie:
> On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>
>> Link udev shared with systemd helper to minimize the udev package size
>> if DISTRO_FEATURES contains systemd.
>>
>> It is only usefull to link udev static with systemd helper if udev
>> should be installed without systemd.
>>
>> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>
>> ---
>>
>> (no changes since v1)
>>
>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>   1 file changed, 1 insertion(+)
> 
> 
> This seems to break some of our tests:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
> https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127
> 
> Presumably it causes extra dependencies to be pulled in causing the file overlap
> where there was previously none.

Sorry, I was told sysvinit with systemd isn't a valid use case anymore.

Would it be okay to enable it only if sysvinit isn't in distro?

Otherwise reject the change because it is impossible to know if a 
dependency between udev and systemd is okay or not.

Regads
   Stefan
Stefan Herbrechtsmeier Feb. 6, 2022, 4:43 p.m. UTC | #4
Am 06.02.22 um 10:53 schrieb Richard Purdie:
> On Sun, 2022-02-06 at 08:10 +0000, Richard Purdie via lists.openembedded.org
> wrote:
>> On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> Link udev shared with systemd helper to minimize the udev package size
>>> if DISTRO_FEATURES contains systemd.
>>>
>>> It is only usefull to link udev static with systemd helper if udev
>>> should be installed without systemd.
>>>
>>> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> ---
>>>
>>> (no changes since v1)
>>>
>>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>>   1 file changed, 1 insertion(+)
>>
>>
>> This seems to break some of our tests:
>>
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127
>>
>> Presumably it causes extra dependencies to be pulled in causing the file overlap
>> where there was previously none.
> 
> Thinking a bit more, I think this needs to be:
> 
> diff --git a/meta/recipes-core/systemd/systemd_250.3.bb b/meta/recipes-core/systemd/systemd_250.3.bb
> index 2b6bfcc2c25..7851c4c16a7 100644
> --- a/meta/recipes-core/systemd/systemd_250.3.bb
> +++ b/meta/recipes-core/systemd/systemd_250.3.bb
> @@ -69,7 +69,7 @@ PACKAGECONFIG ??= " \
>       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
>       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
>       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
> -    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'link-udev-shared', '', d)} \
> +    ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 'link-udev-shared', d)} \
>       backlight \
>       binfmt \
>       gshadow \
> 
> 
> which I'll test...

Maybe the systemd naming for the option is sub optimal. The 
link-udev-shared option create a dependency between udev and systemd 
package. It links udev against the libsystemd-shared library. Without it 
udev is linked statically against this library. The option should only 
be enabled if udev is always used together with systemd.

Regards
   Stefan
Stefan Herbrechtsmeier Feb. 6, 2022, 4:54 p.m. UTC | #5
Am 06.02.22 um 17:43 schrieb Stefan Herbrechtsmeier:
> Am 06.02.22 um 10:53 schrieb Richard Purdie:
>> On Sun, 2022-02-06 at 08:10 +0000, Richard Purdie via 
>> lists.openembedded.org
>> wrote:
>>> On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
>>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>>
>>>> Link udev shared with systemd helper to minimize the udev package size
>>>> if DISTRO_FEATURES contains systemd.
>>>>
>>>> It is only usefull to link udev static with systemd helper if udev
>>>> should be installed without systemd.
>>>>
>>>> Signed-off-by: Stefan Herbrechtsmeier 
>>>> <stefan.herbrechtsmeier@weidmueller.com>
>>>>
>>>> ---
>>>>
>>>> (no changes since v1)
>>>>
>>>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>
>>>
>>> This seems to break some of our tests:
>>>
>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
>>> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127
>>>
>>> Presumably it causes extra dependencies to be pulled in causing the 
>>> file overlap
>>> where there was previously none.
>>
>> Thinking a bit more, I think this needs to be:
>>
>> diff --git a/meta/recipes-core/systemd/systemd_250.3.bb 
>> b/meta/recipes-core/systemd/systemd_250.3.bb
>> index 2b6bfcc2c25..7851c4c16a7 100644
>> --- a/meta/recipes-core/systemd/systemd_250.3.bb
>> +++ b/meta/recipes-core/systemd/systemd_250.3.bb
>> @@ -69,7 +69,7 @@ PACKAGECONFIG ??= " \
>>       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig 
>> pam selinux smack usrmerge polkit seccomp', d)} \
>>       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
>>       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', 
>> d)} \
>> -    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 
>> 'link-udev-shared', '', d)} \
>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '', 
>> 'link-udev-shared', d)} \
>>       backlight \
>>       binfmt \
>>       gshadow \
>>
>>
>> which I'll test...
> 
> Maybe the systemd naming for the option is sub optimal. The 
> link-udev-shared option create a dependency between udev and systemd 
> package. It links udev against the libsystemd-shared library. Without it 
> udev is linked statically against this library. The option should only 
> be enabled if udev is always used together with systemd.

Sorry, I should read the patch careful.

I we can assume that udev from systemd is only used with sysvinit or 
systemd, this is okay.

Regards
   Stefan
Mark Hatle Feb. 6, 2022, 5:23 p.m. UTC | #6
I just noticed this.  It might make sense to link udev static when BOTH systemd 
and sysvinit are enabled.  (A single package set, multiple images with different 
init managers.)

Not sure though how that works in Honister, just something I noticed with this 
commit.  (And yes, I do use a distro with BOTH sysvinit and systemd enabled for 
a single package set.)

--Mark

On 2/6/22 2:10 AM, Richard Purdie wrote:
> On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>
>> Link udev shared with systemd helper to minimize the udev package size
>> if DISTRO_FEATURES contains systemd.
>>
>> It is only usefull to link udev static with systemd helper if udev
>> should be installed without systemd.
>>
>> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>
>> ---
>>
>> (no changes since v1)
>>
>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>   1 file changed, 1 insertion(+)
> 
> 
> This seems to break some of our tests:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
> https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127
> 
> Presumably it causes extra dependencies to be pulled in causing the file overlap
> where there was previously none.
> 
> Cheers,
> 
> Richard
> 
> 
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#161392): https://lists.openembedded.org/g/openembedded-core/message/161392
> Mute This Topic: https://lists.openembedded.org/mt/88853822/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Mark Hatle Feb. 6, 2022, 5:26 p.m. UTC | #7
On 2/6/22 10:39 AM, Stefan Herbrechtsmeier wrote:
> Am 06.02.22 um 09:10 schrieb Richard Purdie:
>> On Wed, 2022-02-02 at 08:35 +0100, Stefan Herbrechtsmeier wrote:
>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> Link udev shared with systemd helper to minimize the udev package size
>>> if DISTRO_FEATURES contains systemd.
>>>
>>> It is only usefull to link udev static with systemd helper if udev
>>> should be installed without systemd.
>>>
>>> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> ---
>>>
>>> (no changes since v1)
>>>
>>>    meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>>    1 file changed, 1 insertion(+)
>>
>>
>> This seems to break some of our tests:
>>
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/4708
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/79/builds/3121
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/80/builds/3085
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/86/builds/3089
>> https://autobuilder.yoctoproject.org/typhoon/#/builders/87/builds/3127
>>
>> Presumably it causes extra dependencies to be pulled in causing the file overlap
>> where there was previously none.
> 
> Sorry, I was told sysvinit with systemd isn't a valid use case anymore.

It definitely works in Honister (I'm actively using it.)

We produce a single package set, then allow for multiple image recipes to select 
which init manager to use.  This simplifies the eSDK, sstate-cache and binary 
package feed -- while still giving the end user the ability to switch.

(And there is a HUGE difference in image size between sysvinit and systemd.)

--Mark

> Would it be okay to enable it only if sysvinit isn't in distro?
> 
> Otherwise reject the change because it is impossible to know if a
> dependency between udev and systemd is okay or not.
> 
> Regads
>     Stefan
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#161402): https://lists.openembedded.org/g/openembedded-core/message/161402
> Mute This Topic: https://lists.openembedded.org/mt/88853822/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Alexander Kanavin Feb. 6, 2022, 5:31 p.m. UTC | #8
On Sun, 6 Feb 2022 at 18:27, Mark Hatle <mark.hatle@kernel.crashing.org>
wrote:

> It definitely works in Honister (I'm actively using it.)
>
> We produce a single package set, then allow for multiple image recipes to
> select
> which init manager to use.  This simplifies the eSDK, sstate-cache and
> binary
> package feed -- while still giving the end user the ability to switch.
>

Selection of init manager is a distro setting, it can be used by component
recipes to make decisions, and overriding it from images is neither tested
nor supported.

Alex
Richard Purdie Feb. 6, 2022, 5:35 p.m. UTC | #9
On Sun, 2022-02-06 at 18:31 +0100, Alexander Kanavin wrote:
> On Sun, 6 Feb 2022 at 18:27, Mark Hatle <mark.hatle@kernel.crashing.org>
> wrote:
> > It definitely works in Honister (I'm actively using it.)
> > 
> > We produce a single package set, then allow for multiple image recipes to
> > select 
> > which init manager to use.  This simplifies the eSDK, sstate-cache and
> > binary 
> > package feed -- while still giving the end user the ability to switch.
> > 
> 
> 
> Selection of init manager is a distro setting, it can be used by component
> recipes to make decisions, and overriding it from images is neither tested nor
> supported.

There is a hybrid where you can enable sysvinit and systemd at the same time and
use them in different situations. We do test that and it is that test which
showed issues on the autobuilder with this patch.

It isn't as easy as pick and chose either in a given image but handy for
initramfs and some other uses.

Cheers,

Richard
Alexander Kanavin Feb. 6, 2022, 5:43 p.m. UTC | #10
On Sun, 6 Feb 2022 at 18:35, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> > Selection of init manager is a distro setting, it can be used by
> component
> > recipes to make decisions, and overriding it from images is neither
> tested nor
> > supported.
>
> There is a hybrid where you can enable sysvinit and systemd at the same
> time and
> use them in different situations. We do test that and it is that test which
> showed issues on the autobuilder with this patch.
>
> It isn't as easy as pick and chose either in a given image but handy for
> initramfs and some other uses.
>

I believe what we test is this:
https://git.yoctoproject.org/yocto-autobuilder-helper/tree/config.json#n1034

It only enables both systemd and sysvinit distro features, but does not
redefine init managers on the image level - it remains systemd everywhere
as explicitly set in the test (with ability to load legacy sysvinit scripts
added to it).

Hybrid initramfs case should be helped by the recent multiconfig patch:

    kernel.bbclass: Allow initramfs to be built from a separate multiconfig

Alex
Mark Hatle Feb. 6, 2022, 7:05 p.m. UTC | #11
On 2/6/22 11:35 AM, Richard Purdie wrote:
> On Sun, 2022-02-06 at 18:31 +0100, Alexander Kanavin wrote:
>> On Sun, 6 Feb 2022 at 18:27, Mark Hatle <mark.hatle@kernel.crashing.org>
>> wrote:
>>> It definitely works in Honister (I'm actively using it.)
>>>
>>> We produce a single package set, then allow for multiple image recipes to
>>> select
>>> which init manager to use.  This simplifies the eSDK, sstate-cache and
>>> binary
>>> package feed -- while still giving the end user the ability to switch.
>>>
>>
>>
>> Selection of init manager is a distro setting, it can be used by component
>> recipes to make decisions, and overriding it from images is neither tested nor
>> supported.
> 
> There is a hybrid where you can enable sysvinit and systemd at the same time and
> use them in different situations. We do test that and it is that test which
> showed issues on the autobuilder with this patch.
> 
> It isn't as easy as pick and chose either in a given image but handy for
> initramfs and some other uses.

I've got the following in my distro:

# Create packages that support both systemd and sysvinit
# but only on arm/arm64 systems, microblaze is sysvinit only
DISTRO_FEATURES_BACKFILL_CONSIDERED:remove:arm = "sysvinit systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED:remove:aarch64 = "sysvinit systemd"
DISTRO_FEATURES_BACKFILL:append:arm = " systemd"
DISTRO_FEATURES_BACKFILL:append:aarch64 = " systemd”

INIT_MANAGER_DEFAULT = "systemd"
INIT_MANAGER_DEFAULT:microblaze = "sysvinit"
INIT_MANAGER_DEFAULT:zynq = "sysvinit"

INIT_MANAGER ?= "${INIT_MANAGER_DEFAULT}"

Then a few configurations change the INIT_MANAGER, and (almost) all of the 
sstate is re-usable and things don't need to be re-built.

The issue I have, microblaze if the filesystem is over about 80mb it doesn't fit 
into memory.  On Arm, some devices are memory limited the same way microblaze 
is, while some have full access to flash storage and thus can use systemd.  And 
on aarch64 - most defined (but not all) have flash storage.

This is all about sstate-cache re-use (time to build the image) and ability to 
have a SINGLE binary distribution that supports the image size requirements of 
the user.

--Mark

> Cheers,
> 
> Richard
> 
> 
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#161408): https://lists.openembedded.org/g/openembedded-core/message/161408
> Mute This Topic: https://lists.openembedded.org/mt/88853822/3616948
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mark.hatle@kernel.crashing.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Stefan Herbrechtsmeier Feb. 7, 2022, 12:12 p.m. UTC | #12
Am 06.02.2022 um 20:05 schrieb Mark Hatle:
> On 2/6/22 11:35 AM, Richard Purdie wrote:
>> On Sun, 2022-02-06 at 18:31 +0100, Alexander Kanavin wrote:
>>> On Sun, 6 Feb 2022 at 18:27, Mark Hatle <mark.hatle@kernel.crashing.org>
>>> wrote:
>>>> It definitely works in Honister (I'm actively using it.)
>>>>
>>>> We produce a single package set, then allow for multiple image 
>>>> recipes to
>>>> select
>>>> which init manager to use.  This simplifies the eSDK, sstate-cache and
>>>> binary
>>>> package feed -- while still giving the end user the ability to switch.
>>>>
>>>
>>>
>>> Selection of init manager is a distro setting, it can be used by 
>>> component
>>> recipes to make decisions, and overriding it from images is neither 
>>> tested nor
>>> supported.
>>
>> There is a hybrid where you can enable sysvinit and systemd at the 
>> same time and
>> use them in different situations. We do test that and it is that test 
>> which
>> showed issues on the autobuilder with this patch.
>>
>> It isn't as easy as pick and chose either in a given image but handy for
>> initramfs and some other uses.
> 
> I've got the following in my distro:
> 
> # Create packages that support both systemd and sysvinit
> # but only on arm/arm64 systems, microblaze is sysvinit only
> DISTRO_FEATURES_BACKFILL_CONSIDERED:remove:arm = "sysvinit systemd"
> DISTRO_FEATURES_BACKFILL_CONSIDERED:remove:aarch64 = "sysvinit systemd"
> DISTRO_FEATURES_BACKFILL:append:arm = " systemd"
> DISTRO_FEATURES_BACKFILL:append:aarch64 = " systemd”
> 
> INIT_MANAGER_DEFAULT = "systemd"
> INIT_MANAGER_DEFAULT:microblaze = "sysvinit"
> INIT_MANAGER_DEFAULT:zynq = "sysvinit"
> 
> INIT_MANAGER ?= "${INIT_MANAGER_DEFAULT}"
> 
> Then a few configurations change the INIT_MANAGER, and (almost) all of 
> the sstate is re-usable and things don't need to be re-built.
> 
> The issue I have, microblaze if the filesystem is over about 80mb it 
> doesn't fit into memory.  On Arm, some devices are memory limited the 
> same way microblaze is, while some have full access to flash storage and 
> thus can use systemd.  And on aarch64 - most defined (but not all) have 
> flash storage.
> 
> This is all about sstate-cache re-use (time to build the image) and 
> ability to have a SINGLE binary distribution that supports the image 
> size requirements of the user.

After the change from Richard the optimization will only take place if 
DISTRO_FEATURES doesn't contain sysvinit and you will get the 
independent systemd and udev packages for all your platforms.

Regards
   Stefan
Yu, Mingli Feb. 22, 2022, 9:20 a.m. UTC | #13
Hi,

On 2/2/22 3:35 PM, Stefan Herbrechtsmeier wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> Link udev shared with systemd helper to minimize the udev package size
> if DISTRO_FEATURES contains systemd.
> 
> It is only usefull to link udev static with systemd helper if udev
> should be installed without systemd.
> 
> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> 
> ---
> 
> (no changes since v1)
> 
>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/meta/recipes-core/systemd/systemd_249.7.bb b/meta/recipes-core/systemd/systemd_249.7.bb
> index 739f3aae86..431781e6c7 100644
> --- a/meta/recipes-core/systemd/systemd_249.7.bb
> +++ b/meta/recipes-core/systemd/systemd_249.7.bb
> @@ -66,6 +66,7 @@ PACKAGECONFIG ??= " \
>       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
>       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
>       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
> +    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'link-udev-shared', '', d)} \

After this change, the iso image failed to boot with below error:
Cannot find rootfs.img file in /run/media/*, dropping to a shell

And more detailed about the error as the attached.

Steps to reproduce:
1, update conf/local.conf to use systemd as the default init manager
DISTRO_FEATURES:append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
KERNEL_FEATURES:append = " cfg/systemd.scc"

2, bitbake core-image-minimal

3, runqemu qemux86-64  core-image-minimal  iso


Thanks,

>       backlight \
>       binfmt \
>       gshadow \
> --
> 2.30.2
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#161182): https://lists.openembedded.org/g/openembedded-core/message/161182
> Mute This Topic: https://lists.openembedded.org/mt/88853822/3618448
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [mingli.yu@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Stefan Herbrechtsmeier Feb. 22, 2022, 1:26 p.m. UTC | #14
Hi,

Am 22.02.2022 um 10:20 schrieb Yu, Mingli:
> Hi,
> 
> On 2/2/22 3:35 PM, Stefan Herbrechtsmeier wrote:
>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>
>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>
>> Link udev shared with systemd helper to minimize the udev package size
>> if DISTRO_FEATURES contains systemd.
>>
>> It is only usefull to link udev static with systemd helper if udev
>> should be installed without systemd.
>>
>> Signed-off-by: Stefan Herbrechtsmeier 
>> <stefan.herbrechtsmeier@weidmueller.com>
>>
>> ---
>>
>> (no changes since v1)
>>
>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta/recipes-core/systemd/systemd_249.7.bb 
>> b/meta/recipes-core/systemd/systemd_249.7.bb
>> index 739f3aae86..431781e6c7 100644
>> --- a/meta/recipes-core/systemd/systemd_249.7.bb
>> +++ b/meta/recipes-core/systemd/systemd_249.7.bb
>> @@ -66,6 +66,7 @@ PACKAGECONFIG ??= " \
>>       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig 
>> pam selinux smack usrmerge polkit seccomp', d)} \
>>       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
>>       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', 
>> d)} \
>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 
>> 'link-udev-shared', '', d)} \
> 
> After this change, the iso image failed to boot with below error:
> Cannot find rootfs.img file in /run/media/*, dropping to a shell
> 
> And more detailed about the error as the attached.
> 
> Steps to reproduce:
> 1, update conf/local.conf to use systemd as the default init manager
> DISTRO_FEATURES:append = " systemd"
> DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
> VIRTUAL-RUNTIME_init_manager = "systemd"
> VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
> KERNEL_FEATURES:append = " cfg/systemd.scc"
You have to set the INIT_MANAGER variable instead or set the 
VIRTUAL-RUNTIME_dev_manager variable to systemd.

> 2, bitbake core-image-minimal
> 
> 3, runqemu qemux86-64  core-image-minimal  iso

A revert of the commit solve your problem?

Regards
   Stefan
Yu, Mingli Feb. 23, 2022, 1:49 a.m. UTC | #15
On 2/22/22 9:26 PM, Stefan Herbrechtsmeier wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> Hi,
> 
> Am 22.02.2022 um 10:20 schrieb Yu, Mingli:
>> Hi,
>>
>> On 2/2/22 3:35 PM, Stefan Herbrechtsmeier wrote:
>>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>>
>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> Link udev shared with systemd helper to minimize the udev package size
>>> if DISTRO_FEATURES contains systemd.
>>>
>>> It is only usefull to link udev static with systemd helper if udev
>>> should be installed without systemd.
>>>
>>> Signed-off-by: Stefan Herbrechtsmeier
>>> <stefan.herbrechtsmeier@weidmueller.com>
>>>
>>> ---
>>>
>>> (no changes since v1)
>>>
>>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/meta/recipes-core/systemd/systemd_249.7.bb
>>> b/meta/recipes-core/systemd/systemd_249.7.bb
>>> index 739f3aae86..431781e6c7 100644
>>> --- a/meta/recipes-core/systemd/systemd_249.7.bb
>>> +++ b/meta/recipes-core/systemd/systemd_249.7.bb
>>> @@ -66,6 +66,7 @@ PACKAGECONFIG ??= " \
>>>       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig
>>> pam selinux smack usrmerge polkit seccomp', d)} \
>>>       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', 
>>> d)} \
>>>       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '',
>>> d)} \
>>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
>>> 'link-udev-shared', '', d)} \
>>
>> After this change, the iso image failed to boot with below error:
>> Cannot find rootfs.img file in /run/media/*, dropping to a shell
>>
>> And more detailed about the error as the attached.
>>
>> Steps to reproduce:
>> 1, update conf/local.conf to use systemd as the default init manager
>> DISTRO_FEATURES:append = " systemd"
>> DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
>> VIRTUAL-RUNTIME_init_manager = "systemd"
>> VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
>> KERNEL_FEATURES:append = " cfg/systemd.scc"
> You have to set the INIT_MANAGER variable instead or set the
> VIRTUAL-RUNTIME_dev_manager variable to systemd.
> 
>> 2, bitbake core-image-minimal
>>
>> 3, runqemu qemux86-64  core-image-minimal  iso
> 
> A revert of the commit solve your problem?

Yes, the issue is gone after revert the commit.

Thanks,

> 
> Regards
>    Stefan
Stefan Herbrechtsmeier Feb. 23, 2022, 8:13 a.m. UTC | #16
Hi,

Am 23.02.2022 um 02:49 schrieb Yu, Mingli:
> 
> 
> On 2/22/22 9:26 PM, Stefan Herbrechtsmeier wrote:
>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>
>> Hi,
>>
>> Am 22.02.2022 um 10:20 schrieb Yu, Mingli:
>>> Hi,
>>>
>>> On 2/2/22 3:35 PM, Stefan Herbrechtsmeier wrote:
>>>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>>>
>>>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
>>>>
>>>> Link udev shared with systemd helper to minimize the udev package size
>>>> if DISTRO_FEATURES contains systemd.
>>>>
>>>> It is only usefull to link udev static with systemd helper if udev
>>>> should be installed without systemd.
>>>>
>>>> Signed-off-by: Stefan Herbrechtsmeier
>>>> <stefan.herbrechtsmeier@weidmueller.com>
>>>>
>>>> ---
>>>>
>>>> (no changes since v1)
>>>>
>>>>   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/meta/recipes-core/systemd/systemd_249.7.bb
>>>> b/meta/recipes-core/systemd/systemd_249.7.bb
>>>> index 739f3aae86..431781e6c7 100644
>>>> --- a/meta/recipes-core/systemd/systemd_249.7.bb
>>>> +++ b/meta/recipes-core/systemd/systemd_249.7.bb
>>>> @@ -66,6 +66,7 @@ PACKAGECONFIG ??= " \
>>>>       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig
>>>> pam selinux smack usrmerge polkit seccomp', d)} \
>>>>       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', 
>>>> d)} \
>>>>       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '',
>>>> d)} \
>>>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
>>>> 'link-udev-shared', '', d)} \
>>>
>>> After this change, the iso image failed to boot with below error:
>>> Cannot find rootfs.img file in /run/media/*, dropping to a shell
>>>
>>> And more detailed about the error as the attached.
>>>
>>> Steps to reproduce:
>>> 1, update conf/local.conf to use systemd as the default init manager
>>> DISTRO_FEATURES:append = " systemd"
>>> DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
>>> VIRTUAL-RUNTIME_init_manager = "systemd"
>>> VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
>>> KERNEL_FEATURES:append = " cfg/systemd.scc"
>> You have to set the INIT_MANAGER variable instead or set the
>> VIRTUAL-RUNTIME_dev_manager variable to systemd.
>>
>>> 2, bitbake core-image-minimal
>>>
>>> 3, runqemu qemux86-64  core-image-minimal  iso
>>
>> A revert of the commit solve your problem?
> 
> Yes, the issue is gone after revert the commit.

It looks like a loot of packages have a direct runtime dependency to 
udev and after this patch udev have a runtime dependency to systemd. We 
could revert this patch or move libsystemd-shared.so to its own package 
to remove the dependency to systemd itself.

Regards
   Stefan
Richard Purdie Feb. 23, 2022, 12:39 p.m. UTC | #17
On Wed, 2022-02-23 at 09:13 +0100, Stefan Herbrechtsmeier wrote:
> Hi,
> 
> Am 23.02.2022 um 02:49 schrieb Yu, Mingli:
> > 
> > 
> > On 2/22/22 9:26 PM, Stefan Herbrechtsmeier wrote:
> > > [Please note: This e-mail is from an EXTERNAL e-mail address]
> > > 
> > > Hi,
> > > 
> > > Am 22.02.2022 um 10:20 schrieb Yu, Mingli:
> > > > Hi,
> > > > 
> > > > On 2/2/22 3:35 PM, Stefan Herbrechtsmeier wrote:
> > > > > [Please note: This e-mail is from an EXTERNAL e-mail address]
> > > > > 
> > > > > From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
> > > > > 
> > > > > Link udev shared with systemd helper to minimize the udev package size
> > > > > if DISTRO_FEATURES contains systemd.
> > > > > 
> > > > > It is only usefull to link udev static with systemd helper if udev
> > > > > should be installed without systemd.
> > > > > 
> > > > > Signed-off-by: Stefan Herbrechtsmeier
> > > > > <stefan.herbrechtsmeier@weidmueller.com>
> > > > > 
> > > > > ---
> > > > > 
> > > > > (no changes since v1)
> > > > > 
> > > > >   meta/recipes-core/systemd/systemd_249.7.bb | 1 +
> > > > >   1 file changed, 1 insertion(+)
> > > > > 
> > > > > diff --git a/meta/recipes-core/systemd/systemd_249.7.bb
> > > > > b/meta/recipes-core/systemd/systemd_249.7.bb
> > > > > index 739f3aae86..431781e6c7 100644
> > > > > --- a/meta/recipes-core/systemd/systemd_249.7.bb
> > > > > +++ b/meta/recipes-core/systemd/systemd_249.7.bb
> > > > > @@ -66,6 +66,7 @@ PACKAGECONFIG ??= " \
> > > > >       ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig
> > > > > pam selinux smack usrmerge polkit seccomp', d)} \
> > > > >       ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', 
> > > > > d)} \
> > > > >       ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '',
> > > > > d)} \
> > > > > +    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
> > > > > 'link-udev-shared', '', d)} \
> > > > 
> > > > After this change, the iso image failed to boot with below error:
> > > > Cannot find rootfs.img file in /run/media/*, dropping to a shell
> > > > 
> > > > And more detailed about the error as the attached.
> > > > 
> > > > Steps to reproduce:
> > > > 1, update conf/local.conf to use systemd as the default init manager
> > > > DISTRO_FEATURES:append = " systemd"
> > > > DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
> > > > VIRTUAL-RUNTIME_init_manager = "systemd"
> > > > VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
> > > > KERNEL_FEATURES:append = " cfg/systemd.scc"
> > > You have to set the INIT_MANAGER variable instead or set the
> > > VIRTUAL-RUNTIME_dev_manager variable to systemd.
> > > 
> > > > 2, bitbake core-image-minimal
> > > > 
> > > > 3, runqemu qemux86-64  core-image-minimal  iso
> > > 
> > > A revert of the commit solve your problem?
> > 
> > Yes, the issue is gone after revert the commit.
> 
> It looks like a loot of packages have a direct runtime dependency to 
> udev and after this patch udev have a runtime dependency to systemd. We 
> could revert this patch or move libsystemd-shared.so to its own package 
> to remove the dependency to systemd itself.

A separate package for it would seem like a good option and could smplify the
original issues we saw enabling this too?

Cheers,

Richard
Stefan Herbrechtsmeier Feb. 23, 2022, 1:17 p.m. UTC | #18
Am 23.02.2022 um 13:39 schrieb Richard Purdie:
> On Wed, 2022-02-23 at 09:13 +0100, Stefan Herbrechtsmeier wrote:
>> Am 23.02.2022 um 02:49 schrieb Yu, Mingli:
>>> On 2/22/22 9:26 PM, Stefan Herbrechtsmeier wrote:
>>>> [Please note: This e-mail is from an EXTERNAL e-mail address]
>>>> Am 22.02.2022 um 10:20 schrieb Yu, Mingli:
>>>>> On 2/2/22 3:35 PM, Stefan Herbrechtsmeier wrote:
>>>>>> Link udev shared with systemd helper to minimize the udev package size
>>>>>> if DISTRO_FEATURES contains systemd.
>>>>>>
>>>>>> It is only usefull to link udev static with systemd helper if udev
>>>>>> should be installed without systemd.
>>>>>>
>>>>>> Signed-off-by: Stefan Herbrechtsmeier
>>>>>> <stefan.herbrechtsmeier@weidmueller.com>
>>>>>>
>>>>>> ---
>>>>>>
>>>>>> (no changes since v1)
>>>>>>
>>>>>>    meta/recipes-core/systemd/systemd_249.7.bb | 1 +
>>>>>>    1 file changed, 1 insertion(+)
>>>>>>
>>>>>> diff --git a/meta/recipes-core/systemd/systemd_249.7.bb
>>>>>> b/meta/recipes-core/systemd/systemd_249.7.bb
>>>>>> index 739f3aae86..431781e6c7 100644
>>>>>> --- a/meta/recipes-core/systemd/systemd_249.7.bb
>>>>>> +++ b/meta/recipes-core/systemd/systemd_249.7.bb
>>>>>> @@ -66,6 +66,7 @@ PACKAGECONFIG ??= " \
>>>>>>        ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig
>>>>>> pam selinux smack usrmerge polkit seccomp', d)} \
>>>>>>        ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '',
>>>>>> d)} \
>>>>>>        ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '',
>>>>>> d)} \
>>>>>> +    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd',
>>>>>> 'link-udev-shared', '', d)} \
>>>>>
>>>>> After this change, the iso image failed to boot with below error:
>>>>> Cannot find rootfs.img file in /run/media/*, dropping to a shell
>>>>>
>>>>> And more detailed about the error as the attached.
>>>>>
>>>>> Steps to reproduce:
>>>>> 1, update conf/local.conf to use systemd as the default init manager
>>>>> DISTRO_FEATURES:append = " systemd"
>>>>> DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
>>>>> VIRTUAL-RUNTIME_init_manager = "systemd"
>>>>> VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
>>>>> KERNEL_FEATURES:append = " cfg/systemd.scc"
>>>> You have to set the INIT_MANAGER variable instead or set the
>>>> VIRTUAL-RUNTIME_dev_manager variable to systemd.
>>>>
>>>>> 2, bitbake core-image-minimal
>>>>>
>>>>> 3, runqemu qemux86-64  core-image-minimal  iso
>>>>
>>>> A revert of the commit solve your problem?
>>>
>>> Yes, the issue is gone after revert the commit.
>>
>> It looks like a loot of packages have a direct runtime dependency to
>> udev and after this patch udev have a runtime dependency to systemd. We
>> could revert this patch or move libsystemd-shared.so to its own package
>> to remove the dependency to systemd itself.
> 
> A separate package for it would seem like a good option and could smplify the
> original issues we saw enabling this too?

I think so but it will increase the size of the udev package because of 
the size and dependencies of libsystemd-shared if you use udev without 
systemd.

If we create a extra package udev, systemctl, networkd, timesyncd and 
boot could be used without systemd package.

Regards
   Stefan

Patch

diff --git a/meta/recipes-core/systemd/systemd_249.7.bb b/meta/recipes-core/systemd/systemd_249.7.bb
index 739f3aae86..431781e6c7 100644
--- a/meta/recipes-core/systemd/systemd_249.7.bb
+++ b/meta/recipes-core/systemd/systemd_249.7.bb
@@ -66,6 +66,7 @@  PACKAGECONFIG ??= " \
     ${@bb.utils.filter('DISTRO_FEATURES', 'acl audit efi ldconfig pam selinux smack usrmerge polkit seccomp', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'wifi', 'rfkill', '', d)} \
     ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'xkbcommon', '', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'link-udev-shared', '', d)} \
     backlight \
     binfmt \
     gshadow \