Commit Graph

110 Commits

Author SHA1 Message Date
Marcus Schäfer
28d9f45ca6 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
2026-03-12 22:33:50 +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
Marcus Schäfer
f268a4037b
Added unit test for testing grub prefix
Cover the condition if an extra boot partition is used
2023-09-22 10:39:44 +02:00
Leif Liddy
4f04832e40
use os.path.join to create path
os.path.join to create the path for the early_boot.write functions
this will prevent paths from containing double slashes //
2023-09-06 15:19:32 +02:00
Marcus Schäfer
1e4687f84d
Fix double grub entries in hybrid ISO images
As consequence of using the "source" grub command instead
of the "configfile" command to load the grub config we now
see double loading of the same file on ISO media. The reason
here is that kiwi ISO media is always hybrid which means it
embeds an MBR into the ISO for which the "source" command now
can read the same file through two different device paths.
This does not happen with the "configfile" grub command.
Thus this patch uses "configfile" if we produce an ISO image
and "source" for all other image types. The commit also fixes
the custom grub template used for ISO images in a way that
we only set the "serial" command if there is a serial
configuration provided along with the image description.
2023-08-09 16:07:34 +02:00
Neal Gompa
60d7b1f718
Merge pull request #2324 from OSInside/btrfs_no_hardcoded_toplevel_volume
Evaluate the @root volume name also for btrfs
2023-07-31 11:27:00 -04:00
slowpeek
97ac758de8 Use 'source' instead of 'configfile' in generated grub.cfg
Details are outlined in issue #2320
2023-07-27 18:09:36 +03:00
Marcus Schäfer
dd110f63a4
Make sure btrfs root volume is used when needed
With the possibility to switch off setting the default volume
an issue at other parts in the kiwi code which mounted the
btrfs based system were uncovered. Without any default volume
set it's required to transport the root volume if different
from / and pass the respective subvol= option to the mount.
This commit fixes it at the places where kiwi trusted btrfs
to have a correct default volume set
2023-07-27 16:18:48 +02:00
Marcus Schäfer
f97b47e8fb
Fix fallback secure boot setup
Don't copy the same file. This case happens when rebuilding
an image using --allow-existing-root when the fallback setup
has done its job already in the first run
2023-07-26 09:21:09 +02:00
Marcus Schäfer
f223e61344
Cleanup condition for SECURE_BOOT=yes|no
The statement serves the purpose for an if/else construction
to become a better read. In addition delete the probably
left-over print statement from the test
2023-07-24 16:02:23 +02:00
Jesus Bermudez Velazquez
cfb4c8edea
Add SECURE_BOOT no when the firmware is efi
This Fixes bsc#1211102
2023-07-18 17:29:11 +01:00
Marcus Schäfer
7ac14458af Refactor the luks_device class data transport
Also add missing unit tests
2023-07-05 12:30:38 +02:00
Neal Gompa
6db103f3e6
Merge pull request #2283 from OSInside/fix_fedora_iso_efi_boot
Fixed Fedora prebuild EFI binary lookup
2023-06-14 04:38:04 -04:00
Marcus Schäfer
6fc837f216
Revert "Add zstd and xzio to grub image"
This reverts commit af8c702db0.
The grub modules does not exist in all grub installations.
A different implementation is required
2023-04-24 23:17:48 +02:00
Marcus Schäfer
6c4820d460
Fixed Fedora prebuild EFI binary lookup
When creating CentOS/Fedora live media, kiwi does not install the
right signed grub2 EFI binary. This was caused by kiwi not being
aware of the gcdx64.efi(x86_64), gcdaa64.efi(aarch64) binaries
for CD/ISO boot. This Fixes #2270
2023-04-18 20:33:29 +02:00
Marcus Schäfer
af8c702db0
Add zstd and xzio to grub image
If kiwi builds its own grub image, make sure the compression
algorithms zstd and xz are supported
2023-04-13 18:12:16 +02:00
Marcus Schäfer
0a35e64810
Merge pull request #2266 from OSInside/fix_grub_setup_for_squashfs_boot
Support EFI boot from squashfs
2023-03-30 17:49:12 +02:00
Marcus Schäfer
9ee42b837c
Merge pull request #2257 from OSInside/fix_arch_linux_install_iso_test
Fix Arch Linux EFI install ISO integration test
2023-03-28 10:03:38 +02:00
Marcus Schäfer
bfa31d5e68
Support EFI boot from squashfs
grub supports reading from squashfs. If no extra bootloader
installation is required this allows to boot from a squashfs
rootfs without extra boot partition. The prebuilt grub images
usually does not contain the squash4 module which is the
reason why kiwi creates the EFI module itself if the system
is fully immutable. Please note; the grub configuration
must be provided manually as part of the image description
in this case because grub-mkconfig at the time it has to be
called has no write permissions anymore.
2023-03-25 14:26:10 +01:00
Marcus Schäfer
9448b08bc0
Allow custom template evaluation for install ISO
So far only Live ISO images allowed for custom template usage
2023-03-14 16:54:28 +01:00
Marcus Schäfer
c131e2977f
Fixed kernel parameters for overlayroot setup
The device selection for the read-only and read-write devices
in an overlayroot setup was implicitly done in the kiwi-overlay
dracut module by reading the root= information. This is a
concept which barely works and should be refactored in a way
that the root= information always points to the root device
and that an eventually existing write location is explicitly
provided via the existing rd.root.overlay.write parameter
which is allowed to be overwritten for providing an alternative
write location. Making this information consistent and explicit
on the kernel commandline simplifies the dracut code to
consume this information correctly. This Fixes #2251
2023-03-08 13:51:02 +01:00
Robert Schweikert
ef35bef97b
Support new bootloadersettings section
Allow to specify an optional <bootloadersettings> element
inside of the <bootloader> section. The information is used to
specify custom arguments for the tools called in a bootloader
setup procedure, e.g shim-install, grub-install or grub-mkconfig.
kiwi does not judge on the given parameters and if the provided
data is effectively used depends on the individual bootloader
implementation. In this commit the data will be effectively
handled if bootloader="grub2" is configured. More precisely
the custom additions to support SUSE's TPM model with grub2
can be configured as follows:

<bootloadersettings>
    <shimoption name="--suse-enable-tpm"/>
    <installoption name="--suse-enable-tpm"/>
    <configoption name="--set-trusted-boot"/>
</bootloadersettings>

This Fixes #2224
2023-02-22 23:27:19 +01:00
Marcus Schäfer
58fe99e72d
Fix unit test run for BLS spec base class
Do not really call blkid as used in get_boot_cmdline
2022-12-09 21:30:03 +01:00
Marcus Schäfer
a344c540dc
Increase scope of kernel lookup
So far kiwi was looking up kernels only on /boot. Including
other bootloaders it's no longer required that the kernel
packages of the distributions provides the kernel in /boot
Thus kiwi's lookup needs to be extended to other places
which is done by this commit.
2022-11-15 09:04:57 +01:00
Neal Gompa (ニール・ゴンパ)
17ac2065b8
Merge pull request #2065 from OSInside/systemd_bootloader_spec_interface
Systemd bootloader spec interface
2022-11-12 16:51:48 -05:00
Marcus Schäfer
0e1957e580
Add GRUB_DEFAULT=saved if not set
If there is no GRUB_DEFAULT setting in etc/default/grub
we add GRUB_DEFAULT=saved as the default setting.
This Fixes #2198
2022-11-12 21:53:14 +01:00
Marcus Schäfer
fe478de901
Added API for BLS and systemd-boot support
Bootloaders implementing the Boot Loader Spec (BLS) are not
directly compatible with the original Bootloader Class design
in kiwi. Because of that an interface class which translates
the original API into calls following BLS was added. This allows
us to keep the implementations in the Builder classes and the
public BootLoader interface untouched. In addition to the BLS
API an implementation to support the systemd-boot loader is
part of this commit too.

An example type definition to use systemd-boot with an EFI
disk image type looks like the following:

    <type image="oem" filesystem="xfs" firmware="efi" bootloader="systemd_boot" efipartsize="200"/>

The implementation uses bootctl and kernel-install tools
provided from systemd and expects a proper integration
of systemd-boot by the distribution maintainers

This Fixes #1935
2022-11-12 17:39:22 +01:00
gmoro
0aa69bdfc3 Fix mocking of grub2-install (fix #2124)
/bin/true was being used from the host machine instead of
the chroot
2022-11-09 15:36:01 +00:00
Marcus Schäfer
39898171b0
Be less strict in boot link to itself
As part of the grub setup a link named 'boot' inside of
/boot is created pointing to itself 'boot -> .'. The reason
is to allow the bootloader config to find its files referenced as
/boot/something independently if /boot is placed into an extra
partition. However if an extra boot partition is used and a
filesystem which does not support symlinks, e.g fat, that
symlink creation should not lead to an error in the image build
process as it is considered an optional safe link and not a
mandatory pre-requisite
2022-04-10 15:25:37 +02:00
Marcus Schäfer
81cae1bae4
Fix test_setup_default_grub_empty_kernelcmdline
The unit test exists to check that GRUB_CMDLINE_LINUX_DEFAULT
is not set depending on the provided cmdline. The test exists
for reasons explained in Issue #1650
2022-04-06 08:46:21 +02:00
Robert Schweikert
deec054cae
Preserve LABEL setting (#2108)
Preserve the LABEL= setting when the grub config file is re-generated.
the GRUB_ENABLE_LINUX_LABEL setting does not exists upstream and
not in any SUSE distribution. Set the grub setting such that LABEL
is preserved on SUSE distros. (bsc#1197616)
2022-04-05 17:22:31 +02:00
Marcus Schäfer
7e3d031b07
Fix grub defaults for PARTUUID use
Make sure to set GRUB_DISABLE_LINUX_PARTUUID to false
when using by-partuuid
2022-03-23 09:47:23 +01:00
Marcus Schäfer
8902f1ccb2
Support mount by PARTUUID
In addition to by-label and by-uuid also support mounting
by PARTUUID. Please note kiwi also makes sure that the grub
generated config file uses the root=PARTUUID= notation and it's
not clear if grub-mkconfig will persist making use of it.
Nevertheless there are also systems which uses different
methods to boot and it makes sense to support partuuid
mappings as well
2022-03-23 09:47:22 +01:00
Marcus Schäfer
9c9250ebc4
Support nose and xunit style tests
The modifications in this commit allows the unit tests
to run on both, pytest 6.x (nose test layout) and the new
pytest 7.x (xunit test layout). This Fixes #2072 in a
much nicer way. Thanks much to @smarlowucf
2022-02-26 20:26:18 +01:00
Marcus Schäfer
1f869e7ca8
Revert "Unit test adaptions to pytest v7"
This reverts commit 0dc2e803e0.
The pytest interface from version v6 to v7 has received
changes which requires the tests to be adapted to work for
either the old or the new interface. As there are still many
distributions which uses v6 as the standard we decided to
revert back the adaptions done to support v7 and create
a version requirement to v6 in .virtualenv.dev-requirements.txt
This Fixes #2072
2022-02-26 20:19:42 +01:00
Marcus Schäfer
0dc2e803e0
Fixed unit tests
The pytest interface setup() method call has changed
in a way that an additional parameter is passed to
the method which leads to a python error at invocation
time if the setup method does not define it.
2022-02-07 21:27:39 +01:00
Fabian Vogt
daad876b6b Don't include the ESP in the ISO9660 partition as well (#1750)
Previously the image for the ESP was created inside the source directory
for the ISO9660 filesystem, so it ended up there as well as a separate
partition. Fix that by creating it as a temporary file instead.
2022-01-24 15:58:17 +01:00
Marcus Schäfer
97e4455028
Fixed grub loader/entries setup
If called in non standard environments like an OBS worker
the grub tooling does not work correctly and produces invalid
results. For these cases kiwi provides a collection of fix_
methods to change the produced results. This commit covers
the invalid path in loader/entries/*.conf files pointing to
the kernel and the initrd as they exist in the image-root
directory. This results for example in settings like:

    linux /usr/src/packages/KIWI-oem/build/image-root/boot/vmlinuz-5.14.0-43.el9.x86_64

when it should be:

    linux /boot/vmlinuz-5.14.0-43.el9.x86_64

This Fixes #2038
2022-01-21 16:19:40 +01:00
2c277aecd5
Merge pull request #2029 from Vogtinator/no-uefi-modules
Don't copy GRUB modules for EFI with secure boot enabled
2022-01-21 06:14:27 -05:00
Matt Coleman
201d46e78f Add support for custom GRUB templates
This allows the user to specify a template file to customize
the bootloader menu. This only applies to oem and iso image
types: other image types use the grub mkconfig toolchain.

This resolves Issue #1970

Co-authored-by: Marcus Schäfer <marcus.schaefer@gmail.com>
2022-01-18 16:52:58 -05:00
Fabian Vogt
e1c3290dc6 Fix booting GRUB submenu entries with hybrid images (linux/linuxefi)
Variables assigned with "set" are not visible in submenus for some reason.
Export $linux and $initrd, so that they also work in submenu entries.

Fixes bsc#1192523
2022-01-14 09:40:10 +01:00
Fabian Vogt
c72ab38755 Don't copy GRUB modules for EFI with secure boot enabled
When booting grub.efi with secure boot enabled, modules can't be loaded
and thus the grub.efi image needs to be complete. Save some space in live
images by not copying them into the ISO filesystem.

Fixes part of #1750
2022-01-13 15:41:31 +01:00
Marcus Schäfer
3d1a5b9b53
Merge pull request #1939 from OSInside/fix_grub_linux_default_setup
Fixed GRUB_CMDLINE_LINUX_DEFAULT setup regression
2021-10-07 09:51:49 +02:00
Marcus Schäfer
7ca20f398a
Fixed creation of loopback config
If an extra boot partition is in use the creation of the config
file for the loopback boot feature was using the wrong path.
This commit fixes it and also introduces integration checks
which builds in this condition
2021-10-06 12:44:10 +02:00
Marcus Schäfer
e297a0f2a2
Fixed GRUB_CMDLINE_LINUX_DEFAULT setup regression
The value for GRUB_CMDLINE_LINUX_DEFAULT should only be
changed if custom kernelcmdline values are provided. In
case there are none kiwi should not change this value.
The test to check for this condition is based on the
result cmdline reduced by the root setting. However the
default cmdline setting in kiwi appends 'rw' in addition
to the root device information. This means the default
kernelcmdline is never empty and therefore the grub
setting GRUB_CMDLINE_LINUX_DEFAULT="rw" is always set.
This commit fixes the conditional change by making sure
the default cmdline only consists out of the root
device information. This Fixes #1650
2021-10-05 19:44:41 +02:00