Hi,
> Not sure if this is a bug or working as intended 😅
Whenever I get this question I answer with; It's working as intended :-))
> And I was building with a two-step command:
>
> kiwi-ng --type oem --profile=MyProfile system build --description .
> --target-dir build-oem
>
> kiwi-ng --type iso --profile=MyProfile system create --root
> build-oem/build/image-root --target-dir build-iso
>
> The idea being to produce both outputs without doing the (quite lengthy
> in my case) prepare step over again. Unfortunately (and perhaps not
> surprising in hindsight), this resulted in the iso image being
> unbootable because it hadn't actually installed the dracut-kiwi-live
> package -- but also didn't show any errors that it was missing. This
> confused me for a while.
This is correct if you run "system build" you run in fact
system prepare + system create. Both steps are done with type set to oem
and profile set to MyProfile. The produced root tree from that prepare
step is tight to "oem+MyProfile"
Any step you take now from this state that does not create the same
"oem+MyProfile" can work but doesn't have to.
The reason why you don't get an error message here is because your
second "system create" call just uses the given --root tree as it
is. kiwi has no code that looks at this tree and checks if it is
suitable to be used for the "system create" task. We could spent
some effort to do sanity checks as there is some metadata in the
tree that would allow for some checks but I doubt we could prevent
any imaginable error condition.
So yes this burden is put on the user side
> I guess I was expecting that since both types were named in the same
> profile without further conditions (in the XML) then it would have
> included the packages for both when generating the rootfs even if a
> specific type was named for the create sub-step -- but clearly it
> thought differently.
Nope, if you are using type specific packages sections e.g
'<packages type="iso">' those are tightly coupled to the image
type that you are building. A root tree produced for one type
is actually only valid for this type and for nothing else
> It looks like what I *should* have been doing was to run it as a
> three-step command instead:
>
> kiwi-ng --profile=MyProfile system prepare --description . --root
> build/image-root
Yes if you prepare the tree without a type specification first then
kiwi takes all types defined in the image description into account
and installs all packages for the defined types
> kiwi-ng --type oem --profile=MyProfile system create --root
> build/image-root --target-dir build-oem
> kiwi-ng --type iso --profile=MyProfile system create --root
> build/image-root --target-dir build-iso
>
> Which does install both sets of packages and then creates the images,
> which is why I don't think it's a bug per se -- but perhaps the runtime
> checks could detect this case too?
I agree it could be considered unexpected behavior too, because
you explicitly expressed I want package A for type iso and package B for
type oem, why do I get both now. A runtime check could have warned
you about this situation, correct.
> Side note: it does seem a bit awkward at the moment to produce multiple
> outputs; perhaps --type for system build could accept multiple values
> like --profile does, and allow building to the same target dir? Though
> maybe that's tricky.
It's tricky because the way you described the image requires sort of a
rollback of the tree when building for type A and for type B. kiwi does
not support that. If you are keen on filesystem technologies you could
consider a workflow that does the following:
* create btrfs snapshot for image build A
kiwi-ng system build --type ... --profile ...into-snapshot
* create btrfs snapshot for image build B
kiwi-ng system build --type ... --profile ...into-snapshot
bring up snapshot A
kiwi-ng system build ... --allow-existing-root
bring up snapshot B
kiwi-ng system build ... --allow-existing-root
That way you can manage multiple versions of your root tree and
rebuild your image by re-using the correct tree. The root tree data diff
is managed by btrfs in an effective way.
> Another side note: is there a way to do separate prepare/create steps
> like this with boxbuild? It didn't seem so from the docs. (Though I
> can't actually get boxbuild working atm for reasons discussed elsewhere
> anyway. I'd like to get it working because I think kiwi is leaving
> dangling processes on my host.)
What do you mean by separate ? separate --target-dirs yes. parallel
builds should be possible too. If kiwi leaves dangling processes on
your host that would be really a bad thing and we should debug why
-------------------------------------------------------
Marcus Schäfer Brunnenweg 18
Tel:
+49 7562 905437 D-88260 Argenbühl
Germany
-------------------------------------------------------