Commit Graph

1786 Commits

Author SHA1 Message Date
Marcus Schäfer
5061f907c1
Fix check_target_dir_on_unsupported_filesystem
Find the first existing path in the target path and
check the filesystem capabilities for this path.
This Fixes #2858
2025-07-15 12:12:39 +02:00
Andrea Bolognani
612c5840f1 defaults: Add patterns for shim/grub2 on riscv64
A recent commit changed the way these are looked up and
accidentally broke image building on riscv64, with

  KiwiBootLoaderGrubSecureBootError: Signed grub2 efi loader not found

now being raised for kiwi recipes that worked just fine
before that moment.

Fixes: 197572378c
Thanks: David Abdurachmanov <davidlt@rivosinc.com>
Thanks: Marcus Schäfer <marcus.schaefer@gmail.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2025-07-15 10:13:45 +02:00
Marcus Schäfer
f9fb77e93e
Add global option --setenv
Allow to set environment variables in the caller environment
via the commandline, e.g --setenv SOURCE_DATE_EPOCH=42
2025-07-08 16:37:38 +02:00
Marcus Schäfer
8038ccfbef
Seed filesystem UUIDs with SOURCE_DATE_EPOCH
For reproducible builds the calculation of the filesystem UUID
should be persistent with each rebuild of the image. To achieve
this the UUID is calculated using the SOURCE_DATE_EPOCH from
the environment plus a char-number representation of the filesystem
label name as random seed. In kiwi every filesystem is created
with a label, thus only in case there is no SOURCE_DATE_EPOCH
available we continue to create the UUID as random data.
This Fixes #2761
2025-07-08 16:37:38 +02:00
Marcus Schäfer
d3283644aa
Add label attribute for <partition> section
Allow to specify a filesystem label as part of a <partition>
definition. So far the label was set by the name of the
partition. With the new label attribute, a filesystem label
different from the partition name can be set. This commit
also updates/fixes the documentation in this regard.
2025-07-08 16:37:38 +02:00
Bernhard M. Wiedemann
66a0a4c3d5 Make mbr-id deterministic
Log the value of SDE so it is available to review,
even if the build system does not tell about it.

Update the tests to cover the new code-path.

Co-Authored-By: Marcus Schäfer <marcus.schaefer@gmail.com>
2025-07-02 08:49:43 +02:00
Bernhard M. Wiedemann
4640c183ea Ensure dracut initrd is reproducible
This helps a bit with issue #2358

Add reproducible flag for UKI too

Update tests accordingly

Co-Authored-By: Marcus Schäfer <marcus.schaefer@gmail.com>
2025-07-01 11:31:16 +02:00
Marcus Schäfer
272245b490
Fix shim lookup for arm on SUSE
Add missing search path for shim binary on arm based SUSE
systems. Also update the tumbleweed/test-image-live-disk
integration test for arm to build with secure boot enabled
to actually test a secure boot enabled ISO build.
This Fixes #2842
2025-06-27 11:08:44 +02:00
Dan Čermák
5372049c29
Add container_import template test 2025-06-25 16:03:09 +02:00
Dan Čermák
01ef41f3b1
Add support for container-snap as a container-image engine
With this commit, we can now pre-load images using container-snap directly
during the kiwi image build
2025-06-25 16:03:08 +02:00
Marcus Schäfer
7794a2fb72
Merge pull request #2838 from OSInside/fix_root_reference_in_snapshot_root
Fix mount system for root_is_snapper_snapshot
2025-06-25 10:35:45 +02:00
Marcus Schäfer
deda49c05a
Fix mount system for root_is_snapper_snapshot
If root is a snapper snapshot we have to tell the
chroot a proper root mount point which can be achieved
by a bind mount pointing to itself. This Fixes
bsc#1244668
2025-06-24 17:05:51 +02:00
Marcus Schäfer
24bef17f0e
Fix logging of stderr data in command calls
The stderr data was presented as one blob without line
breaks. Hard to read and smells like a bug. This commit
fixes the output to become readable
2025-06-24 15:30:49 +02:00
Marcus Schäfer
197572378c
Allow multiple EFI arch binaries/modules
Allow to lookup and included EFI binaries/modules for
multiple architectures. For testing the integration
test in rawhide/test-image-live-disk has been adapted
accordingly to install 32bit and 64bit EFI binaries.
This Fixes #2822
2025-06-23 10:30:57 +02:00
Alejandro Perez
b57dbd2d9a
Add driver configuration support for dracut initrd
Add driver configuration support for dracut initrd

Add support for specifying kernel drivers to be included or omitted
in the dracut initrd configuration. This extends the existing dracut
configuration capabilities like in the following example

<initrd action="add">
    <dracut driver="erofs"/>
</initrd>
2025-06-16 12:12:06 +02:00
Marcus Schäfer
cdd8277523
Fixed rootfs size calculation with spare part
In case a spare_part setup is combined with the root_clone feature,
the size calculation for the rootfs did not take the cloning into
account and lead to the wrong value. In addition when requesting
the spare part to be last and no size information was given, the
partition was not created at all. This commit fixes both defects
and Fixes #2831
2025-06-10 11:48:14 +02:00
Marcus Schäfer
33df475d0f
Allow /boot to be a btrfs subvolume
In a btrfs based design, allow to put /boot as subvolume.
This required a small fix in the mount order in a way that
boot/efi gets mounted after the subvolume mounts are done.
The respective integration test has been updated to test
this functionality. This Fixes #2824
2025-06-03 12:34:59 +02:00
Marcus Schäfer
266430ad4d
Fix static type argument int vs. str 2025-06-02 13:51:05 +02:00
Marcus Schäfer
14c5143973
Cleanup build metadata
Make sure the final image rootfs does not contain unneeded
metadata files used during build time. The respective cleanup
call is performed after the root sync and after all initrd/boot
processing has been done. This is because up to that point it's
still possible that the information is required. This means
when building images with a read-only rootfs, it might not be
possible that the metadata can be deleted due to a chicken&egg
situation. Furthermore the cleanup is applied to the disk
builder only as other builders do not really suffer from
this data and for the container builder the metadata can
also be used for the stackbuild feature when building images
derived from containers. This Fixes #2668
2025-05-26 16:14:17 +02:00
Marcus Schäfer
54454d1b8f
Add UKI support for the grub bootloader
In addition to systemd_boot also add support for UKI creation
when grub is used. This includes the creation of a UKI image
via dracut in the same way as it's done for systemd_boot.
In addition an earlyboot grub script chainloads the UKI and
bypasses any written grub configuration. In Theory this should
also allow to use the shim loader for chainloading an UKI.
However I haven't done testing in this direction and I also
expect security issues with this approach because loading
any non signed data by shim is not expected to work. A new
profile named grub_uki_verity_erofs has been added to the
integration test that experiments with UKIs
2025-05-19 19:21:56 +02:00
Marcus Schäfer
b3181f177b
Add support for <initrd> section as part of <type>
Extend scope and content of the <initrd> section to be allowed
as part of the <type> section. This allows to specify custom
call options and modules for the dracut tool. In particular
this commit implementes support for passing the uefi option
to dracut to enable building an UKI EFI binary as follows:

<initrd action="setup">
    <dracut uefi="true"/>
</initrd>

This Fixes #2809 and Fixes #2408
2025-05-19 11:55:36 +02:00
Marcus Schäfer
6be96e0321
Apply security context on writable root only
Make sure to perform setfiles only on a writable target. In case
of a read-only root it is expected that the security context set
by kiwi in an earlier stage is complete. As there is no way to
modify data when root is read-only, there is also no way to change
the security context of any file such that we skip setfiles
in this case. Should there be a read-only system that has writable
partitions such as /boot and their content changes while the rest
of the root system is read-only it is in the responsibility of
the author of the image description to call setfiles only on
the affected and still writable files via a custom disk.sh
script. Along with the fix the respective integration test was
modified to enable selinux such that this change is actually
integration tested. This Fixes #2805
2025-05-15 09:45:14 +02:00
Marcus Schäfer
cdd3ba3445
Added check_target_dir_on_unsupported_filesystem
Add runtime check to make sure the selected target directory
for the image and/or the image rootfs lives on a filesystem
that provides all required features like extended permissions,
ACLs or xattrs.
2025-05-14 11:15:04 +02:00
Marcus Schäfer
a2f4ca00d3
Add support for new tarball-based WSL format
With the new image="wsl" type one can build a WSL container
image that uses the new tarball format. This Fixes #2678
2025-05-12 16:22:01 +02:00
Marcus Schäfer
69dafcdd3c
Fixed access issue to etc/kernel for sdboot
In case of an overlayroot setup we have to make sure
that etc/kernel is writable. This is done by a bind
mount of the ESP
2025-05-08 22:07:04 +02:00
Marcus Schäfer
bea1223d50
Allow initrd updates on read-only devices
Move initrd to ESP for boot loaders that reads data
from there
2025-05-08 22:07:04 +02:00
Marcus Schäfer
4238293513
Switch to dracut-kiwi-verity
So far no luck with the systemd verity generator. This
commit adds the parsing of /etc/veritytab in the existing
kiwi-verity dracut module and uses it in the overlayroot
integration test.
2025-05-08 22:07:04 +02:00
Marcus Schäfer
1753b85e12
Add support for selecting the overlay read-only fs
Add new overlayroot_readonly_filesystem attribute which allows
to select for either squashfs or erofs as the read-only filesystem
in an OEM overlay disk setup.
2025-05-08 22:07:04 +02:00
Marcus Schäfer
d5a4715a71
Fixed root setup for verity overlay disk
When building an image with overlayroot set to true and
activated verity data, the root= parameter must be
set to root=overlay:MAPPER=verityroot instead of the standard
overlay:PARTUUID mapping.
2025-05-08 22:07:04 +02:00
Marcus Schäfer
a9ce5324f9
Make sure the verity record has a superblock 2025-05-08 22:07:04 +02:00
Marcus Schäfer
d086c50adf
Drop distro specific runtime check
The check_efi_mode_for_disk_overlay_correctly_setup exists because
shim-install does not work on read-only devices. However, shim-install
is a SUSE only tool that runs a SUSE specific secure boot setup.
For other secure boot processes this runtime check is not useful.
As runtime checks aims to be generally useful, this one gets
dropped.
2025-05-08 22:07:04 +02:00
Marcus Schäfer
f67a728147
Merge pull request #2691 from glaubitz/loongarch64
Add support for loongarch64
2025-05-06 16:12:31 +02:00
Marcus Schäfer
e9c1568904
Fix root clone size setup
If the root_clone attribute is specified without providing a
fixed size for the system, kiwi estimates the size needed for
the root part and assigns the rest to the clone. This leads to
different partition sizes for the root clones. As per definition
of a clone the expectation is that the size is the same, this
commit changes the behavior such that the calculated size for
the system is applied to the origin root and all its clones.
As a consequence this can leave unpartitioned space free in
the image. This Fixes #2463
2025-05-06 09:25:06 +02:00
Marcus Schäfer
43ea22c9fd
Fix reencryption master key passphrase
Make sure to use the correct passphrase for the master
key such that it can be decrypted with the same credentials
as before. The credentials reset is a subsequent task
after reencryption.
2025-05-02 21:28:53 +02:00
Neal Gompa (ニール・ゴンパ)
34130b8ffa
Merge pull request #2797 from OSInside/support_gpt_on_s390
Add support for GPT targettype on s390
2025-04-30 06:52:10 -04:00
Marcus Schäfer
2c9409f765
Fixed default bls value setup
Fixed get_build_type_bootloader_bls behavior in case the bls
attribute is not set. In this case get_bls() returns a None value
which was returned. However in this case the attribute value
should not be taken into account and the method defined default
value for bls should be returned. This Fixes #2542
2025-04-30 12:47:59 +02:00
Marcus Schäfer
2111bb567d
Add support for GPT targettype on s390
Allow to build s390 images using GPT instead of the old DOS
partition table. zipl has added support to read from GPT.
This Fixes #2694
2025-04-30 12:34:27 +02:00
Marcus Schäfer
7bf437956d
Add --no-compress option to bundler
Allow to skip the compression for bundle files marked
to become compressed. This Fixes #2736
2025-04-30 12:12:51 +02:00
Neal Gompa (ニール・ゴンパ)
5f368bd8ea
Merge pull request #2792 from OSInside/fix_use_disk_password_for_random_keys
Fix setup of use_disk_password for random secret
2025-04-28 05:45:08 -04:00
Marcus Schäfer
944998b239
Fix setup of use_disk_password for random secret
When using luks="random" in combination with use_disk_password="true"
the resulting cryptomount call in grub is wrong. This commit fixes it
2025-04-28 10:04:08 +02:00
Neal Gompa
76dedc5532 Drop copying GRUB2 modules to /boot with Secure Boot UEFI images
Copying the modules creates a situation where future updates
applied to a running system can cause GRUB to crash due to mixed
modules and GRUB EFI binaries.

It is not needed anyway since GRUB EFI binaries for Secure Boot have
all modules compiled into the binaries.

Fixes: https://github.com/OSInside/kiwi/issues/2790
2025-04-27 17:14:23 -04:00
Marcus Schäfer
d4324cebff
Fix overlayroot builds for EFI path
make sure to keep boot/efi mountpoint directories
in the read-only area as they can't be created later
2025-04-27 19:14:19 +02:00
Marcus Schäfer
82622eff68
Fixed mount of image system for volume managers
The ImageSystem.mount() method implemented its own handling
for mounting the volumes of a volume manager based system.
First and foremost this duplicates code that already exists
in the respective VolumeManager implementation and second
the code behaved wrong in case of btrfs when there is no
default subvolume configured
2025-04-27 16:46:14 +02:00
Marcus Schäfer
37dc3d85ff
Handle grub fix functions less strict
If called on full read-only systems, log the information
that the files can't be modified but do not fail. On
such systems the expectation is that no fix code must
be applied and as such the fix function can be considered
an optional step.
2025-04-27 16:36:56 +02:00
Marcus Schäfer
f80b9df5a1
Fixed root setup for encrypted overlay disk
When building an image with overlayroot set to true and
activated luks encryption, the root= parameter must be
set to root=overlay:MAPPER=luks instead of the standard
overlay:PARTUUID mapping. This Fixes #2776
2025-04-25 14:22:41 +02:00
Marcus Schäfer
cf5f01a8be
Update LOADER_TYPE setup for grub
If the bootloader attribute: bls is set to true, make sure
the LOADER_TYPE changes to grub2-bls. This is related to
Issue #2773
2025-04-24 12:50:11 +02:00
Marcus Schäfer
67ab6b3a2d
Fix key slot selection for luks reencrypt
Depending on the type setup for a luks encrypted image, there
might be one or two key slots available. When kiwi is requested
to perform the reencryption process at least one key-slot and
the proper keyfile/passphrase must be provided. This commit
stores the information about the key-slot number for which
a decryption information exists in the initrd. In addition to
the code change also the corresponding integration test image
was updated.
2025-04-22 14:53:39 +02:00
Neal Gompa (ニール・ゴンパ)
bd6d1b471d
Merge pull request #2778 from OSInside/efifatfileimage-filter
Add support for filtering out files from the ESP image for GRUB
2025-04-16 16:04:01 -04:00
Neal Gompa
22190cfb74 Add support for filtering out files from the ESP image for GRUB
Prior to this change, KIWI blindly synced the ESP directory into the
embedded ESP image. Depending on the distribution and packages included
for the created image, this can have undesirable side-effects.

For image builds that need some more fine-grained control over the
creation of the embedded ESP image (particularly for ISO images),
this change introduces the ability to inject an exclusion list
similar to what is used to filter out files for the root filesystem.

Fixes: https://github.com/OSInside/kiwi/issues/2008
Fixes: https://github.com/OSInside/kiwi/issues/2777
2025-04-16 15:59:30 -04:00
Neal Gompa
cdd0b28531 Fix bundle extension for container types
When building result files that use container types like oci or docker,
kiwi creates them as archive tarballs with an extension prefix to
indicate the special nature of the archive. However, the bundler
code does not retain the prefix, which results in the wrong file
extension for these archives.

This change adds exceptions for these types and refactors the
exception handling to unify it with the Vagrant image filename
handling, which operates similarly.

Fixes: https://github.com/OSInside/kiwi/issues/2628
2025-04-13 12:12:22 -04:00