Commit Graph

1828 Commits

Author SHA1 Message Date
Marcus Schäfer
0cbdf2099e
Fix pytest type hint issue
Running on pytest < 7 causes an AttributeError:
module 'pytest' has no attribute 'Config'. Quoting
the type hint argument to be a string and accessing
the elements of pytestconfig via getattr() and a
default value workarounds the issue for older pytest
versions
2026-01-27 12:01:58 +01:00
Marcus Schäfer
40f8da5f5b
Fix platform mock for kis builder unit testing 2026-01-26 14:14:13 +01:00
Marcus Schäfer
b522bae980
Fix s390 unit test
Forgot to mock the architecture properly. This commit fixes it
2026-01-26 13:10:08 +01:00
Neal Gompa (ニール・ゴンパ)
356821cc8c
Merge pull request #2936 from OSInside/dnf4-binary-name
Identify the correct binary for DNF4
2026-01-26 06:07:15 -05:00
Neal Gompa
46b041d112 Identify the correct binary for DNF4
This is pretty much the same solution we used back when we supported
YUM and had to deal with yum vs yum-deprecated.
2026-01-23 10:22:51 -05:00
Marcus Schäfer
186c5bb4fa
Allow to setup the environment blob for grub
Added new <environment> section to the existing <bootloadersettings>
section which allows to specify environment variables for setting
up an environment blob for the selected loader. With this commit
we add support for grub by using grub2-editenv. Other loaders
do not yet have an implementation or does not support environment
blobs. Settings will be ignored for unsupported loaders.
This Fixes #2922

Co-authored-by: Rhys Oxenham <rhys.oxenham@suse.com>
2026-01-22 16:05:21 +01:00
Marcus Schäfer
e797c1136f
Add missing base class method
The BootLoaderInstallBase class was missing the default
implementation for the set_disk_password API
2026-01-22 16:05:21 +01:00
Marcus Schäfer
4a259aaaea
Move OVA support to open-vmdk
Finally this commit drops the use of the VMware ovftool
and moves to the real opensource alternative open-vmdk
This Fixes #2292
2026-01-21 11:45:04 +01:00
Marcus Schäfer
9608445540
Set btrfs_relative_path conditional
The early boot script and also the ISO template should only
set this option if the conditions to set it are met. Conditions
for this option are if btrfs is in use and a default subvolume
and/or a snapper based snapshot is requested by the image
description. This Fixes #2919
2026-01-13 18:04:31 +01:00
Neal Gompa (ニール・ゴンパ)
2fc91ae417
Merge pull request #2697 from davidcassany/adapt_to_latest_snapper
Adapt to latest snapper
2026-01-07 07:48:06 -05:00
Rhys Oxenham
88107398f5
Adding support for import of custom certificates
This commit adds support for providing custom CA certificates
during the build process. It allows a user to specify one ore
more CA file(s) via the new <certificates> section and/or
via the command line. The certificate files will be imported
directly after the image bootstrap has finished (where the
required CA update tools are available), but before any
further packages are retrieved, solving for situations where
the chroot environment needs certificates, e.g. when there's
a proxy server in the build environment.

Co-authored-by: Marcus Schaefer <marcus.schaefer@gmail.com>
2026-01-06 17:01:36 +01:00
David Cassany
9bd8fdcbb9
Refactor snapshots logic in a new SnapshotManager factory
This commit introduces the SnapshotManager factory to abstract Snapper
specific logic into its own class.

It also updates unit tests to reach full coverage. It essentially
adds a new snapper unit tests suite and it refactors the volume manager
tests suite.

Signed-off-by: David Cassany <dcassany@suse.com>
2026-01-05 17:02:17 +01:00
David Cassany
7c7e4a5e85
Use a NamedTuple for chroot bind mounts
Signed-off-by: David Cassany <dcassany@suse.com>
2026-01-05 17:02:17 +01:00
David Cassany
101416bc2e
Adding support for new snapper helpers
This commit makes use of snapper helpers to install a new
system where frist root is already a snapshot. Requires snapper
higher or equal to v0.12.1.

It also keeps old logic for backward compatibility with OSes including
older versions of snapper. The execution path is split based on the
snapper version included within the image being built.

Signed-off-by: David Cassany <dcassany@suse.com>
2026-01-05 17:02:17 +01:00
David Cassany
0873b22a49
Little refactor to group the logic the new snapper helper provides
Signed-off-by: David Cassany <dcassany@suse.com>
2026-01-05 17:02:16 +01:00
David Cassany
a5aeaab586
Adding the ChrootManager class
Chroot manager class can be used to setup
a chroot enviroment including an arbitrary
list of bind mounts. The provided paths to bind
are mounted in the chroot to the same actual root
path they are bound from.

This class is useful to setup a chroot envirment
based on the root-tree created on prepare step.

Signed-off-by: David Cassany <dcassany@suse.com>
2026-01-05 17:02:16 +01:00
Marcus Schäfer
19e3c631e0
Fix initrd outputfile format detection
With dracut-ng the output file format is a configuration
option. The detection mechanics must be extended by also
looking at the combined configuration settings which can
be obtained via the new --printconfig dracut option.
This commit adds the additional check if the used dracut
command supports that option. This Fixes #2918
2026-01-03 21:00:18 +01:00
Marcus Schäfer
8b4d124878
Add support for eficsmpart_id attribute
Allow custom partition number also for the
EFI CSM (legacy BIOS) partition
2026-01-01 01:39:42 +01:00
Marcus Schäfer
7cae923cae
Add support for custom part id attributes
efipart_id, rootpart_id, bootpart_id in <type> and
part_id in <partition>. Allow to specify a custom partition
number instead of the default numbering schema 1-N
2026-01-01 01:39:42 +01:00
Marcus Schäfer
4b31f99ff7
Add support for custom partition ID to Disk
Allow to specify a custom partition ID in the Disk
class interface and API. As of today the new parameter
partition_id in the ptable_entry_type record is not
in use by the current kiwi image description schema.
This change will be a followup to the API change and
needs further conversation upstream first. The code
changes here are based on the work from:

Co-authored-by: Caleb Wolfe <cwolfe651@gmail.com>
Co-authored-by: Caleb Wolfe (Amazon) <xcawolfe@amazon.com>
Assisted-by: Claude Opus 4.5 <noreply@anthropic.com>

This is related to #2917
2025-12-17 16:38:29 +01:00
Marcus Schäfer
13c5a57def
Add support for custom partition ID to Partitioner
Allow to specify a custom partition ID in the Partitioner
class interface and API. The code changes here are based
on the work from:

Co-authored-by: Caleb Wolfe <cwolfe651@gmail.com>
Co-authored-by: Caleb Wolfe (Amazon) <xcawolfe@amazon.com>
Assisted-by: Claude Opus 4.5 <noreply@anthropic.com>

This is related to #2917
2025-12-17 16:38:29 +01:00
Marcus Schäfer
d70a59fb62
Merge pull request #2914 from OSInside/script_hook_root_is_mountpoint
Run disk.sh script hook with / being a mountpoint
2025-12-17 16:38:06 +01:00
Marcus Schäfer
9d21a2c3b3
Set fixed permissions for image root directory
The new root directory (/) for an image build is created
by taking the current system umask into account. However,
if that umask setting is not appropriate for the needs
of the image root directory some hard to debug after
effects can appear on the later run of the image binary.
As such this commit changes the permissions for the root
directory explicitly to the expected value.
This Fixes #2920
2025-12-15 11:08:14 +01:00
Marcus Schäfer
28d902c79b
Fix unit tests when SOURCE_DATE_EPOCH is set
There are some unit tests which failed when the call environment
has SOURCE_DATE_EPOCH set. This commit fixes it. This Fixes #2912
2025-12-07 19:53:55 +01:00
Marcus Schäfer
06ea4731f4
Fixed btrfs mount procedure
If root is not a snapshot and the root volume is
not (/) we forgot to self bind mount the root volume.
This must happen in the volume manager because if
done later it would shadow any other mountpoint
2025-12-05 22:54:27 +01:00
Marcus Schäfer
526a689792
Run disk.sh script hook with / being a mountpoint
Add optional root_is_mountpoint parameter to the _call_script
method. When set the provided root path is turned into a bind
mount such that it appears as / being a mountpoint in the
chrooted call. Apply the argument to the call_disk_script
method such that is becomes effective for the disk.sh
script hook.
2025-12-05 18:26:49 +01:00
Marcus Schäfer
358d5b76bb
Fix time mock when no SOURCE_DATE_EPOCH is present 2025-12-05 12:39:55 +01:00
Marcus Schäfer
1e00766624
Fix unit tests
Missing os.path.getsize mock when called on an non existing file
This is related to Issue #2912
2025-12-05 12:24:12 +01:00
Robert Schneider
845b5270b8 Warn if keymap is unsupported via systemd
Some OS don't support the way systemd is dealing with keymaps (e.g.
Debian, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790955).
If we try to set the keymap using `systemd-firstboot --keymap`, this
will fail, and the error message from `systemd-firstboot` is misleading:
it states that the keymap is not installed.

I couldn't find out how to reliably detect if systemd's keymap
management is supported, so instead, we provide a hint in the error
message if `systemd-firstboot --keymap` fails that the reason could be
that it's unsupported.

Fixes #2904

More generic keymap/systemd error message + dedent

Adds test of warning if keymap setting unsupported

Fix linter complaints about formatting

Run keymap check under chroot

We're interested in the capabilities of the target system, since we also
run `systemd-firstboot --keymap` in there.

Fixup for setup_test after chroot'ing localectl

Remove localectl call

It talks to systemd.

Fix tests for keymap
2025-11-28 16:25:59 +01:00
Marcus Schäfer
9292a84d20
Improve grub console setup
The console attribute in the bootloader section was used to
target both, output and input console setup using a space separator.
However, there can be multiple consoles specified for output
and input consoles and that turns the idea to handle both in
one attribute into a mess. This commit drops the console attribute
and offers two new attributes output_console and input_console which
can define multiple consoles each using space as a separator.
For example:

    <bootloader ... output_console="console serial" input_console="console"/>

This change comes with a schema version bump to v8.4
An automatic XSL transformation template for the old console
attribute into the new output_console and input_console
attributes is also part of this commit.

This Fixes #2886
2025-11-24 17:50:11 +01:00
Marcus Schäfer
cce59eea28
Add support for encryped live images
So far setting the luks= attribute on a live image build had
no impact to the generated ISO image. This commit adds the
encryption capability also for live ISO images. The read-only
part of the rootfs gets encrypted using the provided luks
passphrase. An eventual persistent storage area gets encrypted
at boot time if the rd.live.encrypt kernel cmdline parameters
is passed. encryption/decryption requires to interactively
set/provide passhphrase information at boot time. Please note
due to the read-only restrictions of an ISO image there is no
way to apply the standard re-encryption process as it is
usually performed by kiwi encrypted systems. As such the
specified luks passphrase in the kiwi image descriptions
becomes sensitive information that needs to be protected
2025-11-19 11:20:22 +01:00
Marcus Schäfer
b51594c1fa
Merge pull request #2899 from OSInside/s390_attestation_request_data
Add support for s390 UV-attestation
2025-11-16 20:01:06 +01:00
Marcus Schäfer
146774d2c3
Fix repo type setup when set from cmdline
Using --add-repo/--set-repo options on the commandline
allows to skip the repotype setting by passing in an empty
value. That empty value however caused the type attribute
in a repository section to be set to an empty string which
is not allowed by the schema. Instead an empty type should
lead to no type attribute set at all. This commit fixes it
2025-11-14 14:04:27 +01:00
Marcus Schäfer
497e7ecda9
Add support for s390 UV-attestation
To run pvattest perform an attestation request binary as
well as the corresponding attestation key and the secure
execution header is required. This data should be created
as part of the image build. In this commit we are adding
support for creating the attestation data when building
a secure execution enabled image
2025-11-10 16:29:14 +01:00
Alexandre Vicenzi
f0f116eb19 Support SOURCE_DATE_EPOCH for OCI containers
If SOURCE_DATE_EPOCH is available, use it for the container creation
time and history.
2025-10-01 12:10:08 +02:00
Marcus Schäfer
6218bb8e50
Run grub mkconfig with os-prober disabled
Set GRUB_DISABLE_OS_PROBER=true to the caller environment
such that it gets consumed via /etc/grub.d/30_os-prober
This Fixes #2883
2025-09-10 17:42:23 +02:00
Marcus Schäfer
946e91383e
Update dracut version compat runtime check
Update check_dracut_module_versions_compatible_to_kiwi to match
with new dracut module dirs which have changed due to recommended
dracut module ordering for out-of-tree modules.
2025-09-01 10:22:32 +02:00
Marcus Schäfer
e3994fb078
Fix exclude list for live image builds
When specifying a filesystem attribute for a live image build,
the rootfs gets build directly into this filesystem instead of
being a squashfs wraped ext4 which is the default layout for
compatibility reasons. In this direct filesystem mode the
exclude list was not passed along to the filesystem creation
and causes unwanted metadata to be part of the final image.
This Fixes #2873
2025-08-15 10:02:17 +02:00
Marcus Schäfer
3a9c46433f
Skip kiwi-repart module in install ISOs
In case the kiwi-repart module is explicitly requested in a
dracut.conf file and the image is also configured to build an
install ISO image this leads the install ISO to contain the
kiwi-repart module as well which is unwanted. This commit
explicitly omits the kiwi-repart when creating the initrd
for the install image
2025-08-05 16:03:17 +02:00
Adam Williamson
894459ed61 solver/repository: Handle zstd-compressed metadata files
`_create_solvables` assumes metadata files are gzip-compressed,
but modern Fedora ones are not, they are zstd-compressed.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2025-07-29 16:42:47 -07:00
Marcus Schäfer
9a8818ac8f
Catch potential exceptions from pathlib.Path.mkdir
Creating a directory can fail, we should catch this error
instead of ending up in a stack trace
2025-07-25 12:57:40 +02:00
Marcus Schäfer
261716e401
Do not drop /config.partids
The partition id metadata file is used in the kiwi-repart
module. If a user wants to use the kiwi repart module
permanently, this metadata file needs to stay in the system.
Therefore it should not be automatically deleted by the
cleanup. A disk.sh hook script can be used to force the
deletion of the file though. This is related #2851
2025-07-17 10:37:34 +02:00
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