Skip to content

testsuite : mkosi conf: default-initrd override main image initrd #39309

@val4oss

Description

@val4oss

systemd version the issue has been seen with

258

Used distribution

openSUSE Tumbleweed

Linux kernel version used

6.17.0-2-default

CPU architectures issue was seen on

x86_64

Component

tests

Expected behaviour you didn't see

No response

Unexpected behaviour you saw

description

Some tests failed due to some extra files missing from the image.raw initrd generated by the mkosi configuration. Indeed, for the example of the TEST-08-INITRD, it tries to mountpoint /run/initrd-mount-target, but the service in charge of creating it, initrd-run-mount, isn't part of the initrd:

localhost:~ # lsinitrd tests/build/mkosi.output/initrd | grep "initrd-run-mount"
localhost:~ # 

And this service is included by the ExtraTree options from mkosi/mkosi.images/initrd/mkosi.extra.

Why it is not included ?

mkosi build a "Image:default-initrd" that will be the same output's name from the image one "Image:initrd". Both, generate initrd into mkosi.output/initrd.cpio.zst.
Because now Image:default-initrd is built after the Image:initrd one in the mkosi process, it overrides our initrd that contain extra files.

Why it happens now ?

From the mkosi project commit: systemd/mkosi@10ccb0b
the default-initrd isn't anymore in dependencies of all sub-image, so it is build later in the process. I was able to get that from the command mkosi summarize

Solution ?

I am not sure what would be the correct fix. If the "default-initrd", from mkosi directly, would need to named his initrd otherwise that "initrd", like "default-initrd". But for now, to run all tests, my workaround is to change the name of the Image: Initrd by "image-initrd". And add this one with Initrds: configuration key from the mkosi.image configuration, as followed:

    sed -i "/\[Build\]/i\[Output\]\nOutput=image-initrd\nFormat=cpio\n"\
        "${TESTS_DIR}/mkosi/mkosi.images/initrd/mkosi.conf"
    sed -i "s|Initrds=.*|Initrds=${MKOSI_OUTPUT_D}/image-initrd|"\
        "${TESTS_DIR}/mkosi/mkosi.conf"

In this end, the main image contains both initrds: (output from mkosi summarize)

                            Initrds: /home/valentin/workspace/systemd-testsuite/tests/build/mkosi.output/image-initrd
                                     /home/valentin/workspace/systemd-testsuite/tests/build/mkosi.output/initrd

And TESTS are working well.

NB

I don't know if it can interfere with the issue I have been faced, but I have changed the mkosi.local.conf to keep control of all build, cache, output directories as follow:

[Build]
BuildDirectory=/home/valentin/workspace/systemd-testsuite/tests/build/mkosi.builddir
CacheDirectory=/home/valentin/workspace/systemd-testsuite/tests/build/mkosi.cache
Environment=NO_BUILD=1

[Output]
OutputDirectory=/home/valentin/workspace/systemd-testsuite/tests/build/mkosi.output

FMU, this should not interfere with the initrd build.

Steps to reproduce the problem

Run the systemd testsuite in openSUSE Tumbleweed with the last version of mkosi.

Additional program output to the terminal or log subsystem illustrating the issue

[    8.738077] TEST-08-INITRD.sh[568]: + mountpoint /run/initrd-mount-target

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Programming errors, that need preferential fixingtests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions