Commit Graph

153 Commits

Author SHA1 Message Date
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
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
f67a728147
Merge pull request #2691 from glaubitz/loongarch64
Add support for loongarch64
2025-05-06 16:12:31 +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
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
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
Marcus Schäfer
8223834da8
Lookup CHRP loader instead of using a static name
On ppc the CHRP loader name can vary between distributions.
This commit adds a search method to lookup different ELF
loader names. In addition an integration test image for
Fedora was added. This Fixes #2741
2025-02-28 11:52:08 +01:00
Marcus Schäfer
d0e58643c5
Fix grub mkimage call for the ppc platform
The list of modules used to create a grub platform image for
ppc was the same list as used for the x86 bios platform.
This commit fixes this and also cleans up the inconsistency
and misleading names used for creating platform specific
output. This Fixes #2738
2025-02-25 11:51:49 +01:00
Marcus Schäfer
5e8fd3e3b2
Make sure copy actions does not drop context
Use shutil.copy2 to copy files preserving their
attributes in the grub BootLoader space.
This Fixes #2709
2025-01-30 22:10:39 +01:00
Marcus Schäfer
2edcfed120
Rename btrfs_root_is_snapshot
Rename btrfs_root_is_snapshot to btrfs_root_is_snapper_snapshot.
This happens in preparation for the changes suggested in #2697
where we want to get rid of snapper specific btrfs code which
will be available in snapper natively soon. To make sure a btrfs
layout specific to snapper(and SUSE), the implicitly used attribute
named btrfs_root_is_snapshot now becomes explicit and its new
name will indicate that snapper sits behind it. Along with the
rename a XSLT stylesheet to automatically convert the old name
into the new name for schema v8.3 will be performed.
2025-01-13 10:22:55 +01:00
Marcus Schäfer
d2062872e0
Fix genprotimg for s390 builds
A recent change on genprotimg now forbids to use --cert in
combination with --no-verify, even though this was allowed
before.
2024-12-31 13:02:55 +01:00
Marcus Schäfer
5b22e2589c
Fixed unit test 2024-12-09 11:04:03 +01:00
John Paul Adrian Glaubitz
1d02e1661c Add support for loongarch64
This Fixes #2684
2024-12-02 18:24:00 +01:00
Marcus Schäfer
b922d8ba2d
Added IBM Secure Execution support on s390
IBM SEL(Secure Execution for Linux) is supported for s390
KVM guests. SEL images used to start a confidential computing
protected guest contain an encrypted boot image which encapsulates
the kernel the initrd and the bootparams. The encrypted Image is
provided by the KVM/hypervisor to the Embedded zFirmware of the
system (the ultravisor device). The decryption keys are hardware
based and each system has an individual keypool unique to that
system. The root filesystem is LUKS encrypted with a random key
produced by kiwi at build time and kept inside of the initrd which
exists only inside of the encrypted boot image and the encrypted
rootfs to allow kernel updates. The commit to support secure
execution also comes with an integration test that provides
profiled image builds to target SUSE's LinuxONE as well
as IBM Cloud systems.
2024-11-21 10:24:04 +01:00
Marcus Schäfer
43bb97c621
Fixed zipl caller environment
zipl gets confused with an active sysfs mount inside
the root tree at call time of zipl. This commit
umounts the /sys bind mount in the image tree prior
calling zipl
2024-10-31 23:33:45 +01:00
Michal Suchanek
473657e82a Fix ppc64 chrp bootinfo generation 2024-09-10 11:29:05 +02:00
Steffen Winterfeldt
d3d0cce94a
Fix boot support for ISO media on ppc64
add CHRP boot support for ppc64 and add xorriso option to avoid
file name reduction to MS-DOS compatible 8.3 format
2024-09-05 12:39:17 +02:00
Marcus Schäfer
4f4e410523
Fix handling of zipl.conf in plain zipl bootloader
When using the plain zipl bootloader kiwi created a /etc/zipl.conf
file. However, this file was only useful during image build as it
points to a loop target device and geometry but does not represent
a proper config file to be used in the running system. In addition
the different distributors provides their own version and layout
of the zipl.conf to be used inside of the system and with their
respective tools. Thus this commit changes the way how kiwi operates
in a way that the zipl.conf used in the initial image only exists
during the image build process. An eventual present /etc/zipl.conf
will not be touched by kiwi. This Fixes #2597
2024-08-09 12:07:48 +02:00
Marcus Schäfer
78238a993c
Add <file> directive to incorporate custom files
Usually custom files are managed by placing them as overlay
files or archives. However, overlay files must be structured
inside of a root/ subdirectory and archive files are binary
data. It is therefore not straight forward to just reference
one or more files as source files to the image description
to be placed into the image. This commit adds a new <file>
element which allows to do this. This Fixes #1953
2024-07-17 18:16:23 +02:00
Marcus Schäfer
8a6aed12ae
Add new eficsm type attribute
Allow to produce EFI/UEFI images without hybrid CSM
capabilities. This Fixes #2407
2024-07-11 21:40:19 +02:00
Marcus Schäfer
319e78a707
Fixed selinux labels for boot files
When kiwi calls the bootloader config and installation modules
several files gets created as unlabeled_t because the labeling
happened earlier. This commit ensures that setfiles gets called
after BootLoaderConfig and/or BootLoaderInstall has done its
job. This Fixes #2568
2024-06-17 18:24:44 +02:00
Marcus Schäfer
6d99c8b923
Better error handling on grub vendor dir lookup
The strings command is used to lookup the in-efi binary encoded
vendor path. However, if the strings or bash command is not availabe
on the build host, the command silently failed and moved into the
standard (non vendored) EFI boot path. This can lead to a broken
boot for those distros and image targets which requires a vendor
directory and should lead to an error message instead of a
successful image build. This Fixes #2565
2024-06-10 10:36:59 +02:00
Steffen Winterfeldt
db80b2d20a
Fix set_disk_password to be effective
Since commit 8aa517eb7 it is necessary to call
_mount_device_and_volumes() prior making any modifications
to boot files. In addition handle potential errors
from the grub.cfg modification better.
2024-05-03 14:19:41 +02:00
Neal Gompa
155d969d77 kiwi/bootloader: restore backward compatibility for grub2 with bls
The change to introduce the bls parameter broke backward compatibility
with all existing kiwi descriptions for distributions that default to BLS.

This fixes that by allowing the unset state to be equivalent to enabling it.

Fixes: 8a8190098c
2024-05-02 06:23:31 -04:00
Alberto Planas
8a8190098c
Add 'bls' parameter for the bootloader 2024-04-26 15:22:28 +02:00
Marcus Schäfer
3ac0ff72b8
Followup fix for use of /boot/zipl
The mounting of /boot/zipl is also only required if the
bootloader is set to grub2_s390x_emu
2024-03-13 09:33:30 +01:00
Marcus Schäfer
ae497f2504
Lookup distro provided BLS entries for zipl
Check if there is already an entry file name produced by the
distribution logic/policy. If we can find an already present
entry name, prefer this name over the kiwi naming policy
2024-03-12 15:37:16 +01:00
Marcus Schäfer
583f3385df
Add support for BLS zipl
Add support for <bootloader name="zipl" .../> to support BLS
based zipl configuration. This Fixes #2481
2024-03-10 11:28:21 +01:00
Marcus Schäfer
b072cfdc7c
Set default output console to gfxterm for grub
If no console setting is done in the image description for grub
the default output console is set to: gfxterm and the default
input console is set to: console. This Fixes bsc#1219074
2024-02-28 10:42:17 +01:00
Alexandre Detiste
fb69627ad3
Use unittest.mock from core python everywhere
mock was an independent module that has been merged into the Python standard library.
2024-02-18 22:15:30 +01:00
Marcus Schäfer
8c6ac25804
Fixed use of custom bootloader
In case no bootloader implementation by kiwi should be
used, users can specify the bootloader="custom" attribute.
Instead of skipping the bootloader stage in the builders
it is better to consistently create an instance of bootloader
but raise if a method of the bootloader interface is called
for which the custom bootloader has no implementation. This
commit adds the consistency bits.
2024-02-12 13:04:29 +01:00
Marcus Schäfer
8aa517eb77
Remove destructor from BootLoaderInstallGrub2
With MountManager as context manager the BootLoaderInstallGrub2
class doesn't need a destructor anymore. This is related
to Issue #2412
2024-02-06 10:28:18 +01:00
Marcus Schäfer
09e4758609
Move Disk to context manager
Change the Disk class to be a context manager.
All code using Disk was updated to the following
with statement:

    with Disk(...) as disk:
        disk.some_member()

This is related to Issue #2412
2024-01-31 15:04:10 +01:00
Dan Čermák
34934b2f8f
Convert BootLoaderConfigBase into an abstract base class 2024-01-29 14:07:41 +01:00
Dan Čermák
f906704ea5
Convert BootLoaderConfig to free function
The class serves really no purpose except for creating another
namespace. This function now allows us to have more stricter type checking.
2024-01-29 13:56:51 +01:00
Marcus Schäfer
54f92d2a9f
Drop support for syslinux/isolinux
SYSLINUX has been abandoned for several years now, and it does not
even work with modern versions of the filesystems supported in kiwi.
This commit drops it and Fixes #2433
2024-01-26 21:25:37 +01:00
Marcus Schäfer
d209a57910
Move BootLoaderConfig to context manager
Change the BootLoaderConfig class to be a context manager.
All code using BootLoaderConfig was updated to the following
with statement:

    with BootLoaderConfig.new(...) as bootloader_config:
        bootloader_config.some_member()

This is related to Issue #2412
2024-01-23 15:11:21 +01:00
Marcus Schäfer
d9e9a3820b
Follow up fix for drop of hybrid boot snippets
The following is left over code from the drop of the hybrid
boot templates.
2024-01-16 15:50:45 +01:00
Neal Gompa (ニール・ゴンパ)
5ee55aeaf3
Merge pull request #2424 from OSInside/drop-grub2-linuxefi
Drop hybrid boot snippets from the GRUB 2 configuration template
2024-01-16 08:03:30 -05:00
Neal Gompa
a638884192 Drop hybrid boot snippets from the GRUB 2 configuration template
Sometime between GRUB 2.04 and GRUB 2.06, it became no longer
necessary to use "linuxefi"+"initrdefi" for UEFI boot. The
standard "linux"+"initrd" stanzas work for both legacy BIOS boot
and modern UEFI boot.

Some distributions no longer support "linuxefi"+"initrdefi" at all
anymore, so let's just use "linux"+"initrd" for everything now.
2024-01-16 04:37:16 -05:00
Marcus Schäfer
8551ebca7a
Don't create default entry for sd-boot loader.conf 2024-01-15 17:57:51 +01:00
Marcus Schäfer
bddf25559d
Compat entry name for kernel-install in sd-boot
systemd-boot tools like kernel-install expect a certain
entry naming policy. This commit adapts kiwi to adapt to
this policy. The name for the default entry is constructed
out of the ID information from /etc/os-release followed
by the name of the kernel as it is represented by the
directory name in /lib/modules/... This Fixes #2417
2024-01-13 23:25:41 +01:00
Marcus Schäfer
c6d8235fa6
Fixed grub terminal setup
The grub terminal setup is divided into the setting for the output
and the input console. For both settings different parameters exists.
So far kiwi did not differentiate between the two parts of the
console setup and that could lead to a wrong setting if only one
value is provided in kiwi's console= attribute which lead to the
grub setting, GRUB_TERMINAL=value. If value is set to e.g gfxterm
grub takes this for both input and output and it's obviously
wrong for the input. To make this less error prune the kiwi code
changes with this commit to set GRUB_TERMINAL_INPUT and
GRUB_TERMINAL_OUTPUT rather than GRUB_TERMINAL and also runs sanity
checks on the provided values if they are applicable. The information
for setting up the console in the schema stays untouched though.
That's because it's used for all bootloaders and also because grub
supports multiple values for the console in/out setting in one
GRUB_TERMINAL variable even though kiwi does no longer use it.
To make this clear for the users also the documentation for the
console attribute setup has been updated. If we want to wish two
distinct attributes for input and output console settings a schema
change and also differentiation between bootloaders is needed and
that I only see for the kiwi-10 branch if at all. This Fixes #2419
2024-01-08 18:02:27 +01:00
Marcus Schäfer
7f64e7aadb
Fix mbrid setup for read-only systems
On filesystems without a UUID (e.g squashfs) the fallback boot id
setup should apply if neither UUID nor MBR ID is present. This
is a followup fix for Issue #2391
2023-11-10 13:05:48 +01:00
Neal Gompa (ニール・ゴンパ)
909667290b
Merge pull request #2390 from OSInside/systemd_iso_support
Add support for ISO boot via systemd-boot
2023-11-08 10:24:48 -05:00
Marcus Schäfer
194414c5a9
Fixed grub mbrid file search
To identify the root device for ISO images (live and install media)
that boots via grub2, kiwi uses a grub2 --file search. The searched
file was named /boot/mbrid, however this is not a unique name and
could be found on other devices of the system as well. To connect
the search to the correct media this commit changes the search to
an ID based method which is unique to the image build process.
This Fixes #2389
2023-11-08 15:25:29 +01:00
Marcus Schäfer
872678ea14
Don't use kernel-install
kernel-install does a lot more then making the kernel available
to the ESP. It calls dracut, it creates loader entries and all
that is unexpected and also breaks the boot because the way
dracut is called in the image build case where host != target
leads to broken results. This commit refactors the systemd-boot
support in kiwi to prevent the use of kernel-install
2023-11-08 12:47:32 +01:00
Marcus Schäfer
d6d57ea95b
Add support for ISO boot via systemd-boot
Create proper EFI FAT image via bootctl to be used as
alt loader in xorriso. This allows to boot the ISO
via EFI e.g kvm -bios /usr/share/qemu/ovmf-x86_64.bin -cdrom file.iso
Please note, hybrid boot is done via grub's hybrid MBR and
as systemd-boot does not provide one, hybrid boot is out
of scope yet. This Fixes #2281
2023-11-07 17:41:51 +01:00