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
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
The grub config parameter GRUB_DISABLE_LINUX_UUID must only
be set if the device persistence setting is not UUID. However,
in kiwi UUID device names are the default and doesn't have to
be expressed explicitly. Therefore the condition to check
for different than 'by-uuid' is wrong for the default case were
no device persistence setting exists. This results in a wrong
grub option to be set. This commit fixes it in a way to disable
UUID device names in grub if the only other device persistency
setting in kiwi named: 'by-label' is explicitly configured.
This Fixes#1842
Merging #1850 exposed the missing bootloader tests.
This reminds me to move the gitlab driven unit tests
to github actions because for forked repos the gitlab
tests does not run but github actions tests would run
For ISO images an embedded efi fat image is needed to boot.
As consequence of adding the mok manager it can happen that
the size of the efi fat image is too small. With this commit
the size is increased to prevent an out of space issue
Make sure MokManager gets copied. The name and location of
the mok manager is distribution specific in the same way as
the shim loader. Thus we need to apply a similar concept
for looking it up. This Fixes bsc#1187515
To support cloud platforms better we should allow the
creation of an initial(insecure) LUKS encrypted image
with an empty passphrase/keyfile. This Fixes
bsc#1187461 and bsc#1187460
The Debian/Ubuntu folks have a different system to support
EFI secure boot. In order to make use of it kiwi needs some
adaptions done in this pull request. This Fixes#1743
The option --target-arch allows to set the architecture
used to build the image. By default this is the host
architecture. Please note, if the specified architecture
name does not match the host architecture and is therefore
requesting a cross architecture image build, it's important
to understand that for this process to work a preparatory
step to support the image architecture and binary format
on the building host is required and is not considered a
responsibility of kiwi. There will be a followup effort
on providing a plugin for kiwi which should be used to
manage the needed binfmt settings for cross arch image
builds
If devicepersistency="by-label" is set in the KIWI description
it will correctly operate on the fstab values but still uses
the UUID based setting for root= in the grub config. This commit
allows to set root=LABEL=... in the grub config in case the
devicepersistency requested it. In order for this to work this
commit also had to increase the scope of the grub helper
method _fix_grub_root_device_reference which is now called in
any case. This Fixes#1757
This commit refactors grub2 installation method to split it in two
parts. Former grub2.install method was meant to run the grub2-install
tool, however, in addition it was also running the secure boot
installation shim-install. The install method in KIWI is skipped for
those architectures and firmware combinations for which bios support
doesn't exist. This was leading to skip the secure boot installation.
The current approach strips the secure boot installation logic from the
grub2.install method, so skipping the install method does not
automatically result in skipping the secure boot installation.
Fixes bsc#1182211
Not all systems (e.g Debian) creates the boot/grub|grub2 directory.
In kiwi when we need to create a custom grub image because we did
not find the distro provided one, an earlyboot.cfg file is created
and embedded into the grub image. The locaton to store that file
is below boot/grub|grub2. However if the directory does not exist
the build will fail as with the current Debian Live integration
test.
Moving the grub mkimage call as chroot operation also broke
the creation of image builds that uses the legacy custom kiwi
boot image feature instead of dracut. This commit fixes it
The last commit moved the grub mkimage call into the chroot.
As a side effect and when creating install media the earlyboot
script could no longer be found. This commit fixes it
If kiwi can't find the distribution provided grub image(s) it
creates them using the respective grub[X]-mkimage tool. However
the tool was called on the build host which could cause an
inconsistency on the used module path. Grub is not packaged
consistently across the distributions and also the provided
modules comes in different versions and patch sets. Therefore
it's required that kiwi calls the grub mkimage tool as chrooted
operation inside of the tree that provides the target image.
As consequence of the change it's required that the image root
tree provides the grub mkimage tool. In addition to the change
we now also log the output from the grub mkimage call in the
kiwi build logfile. This Fixes#1254
If an extra boot partition is used the grub toolchain
still references files from that partition as /boot/...
which fails because they are now at the toplevel. To
avoid this and keep any /boot/some-file reference still
valid we create a symlink 'boot -> .' This Fixes#1611
The regular expression to match the grub root device
used a lazy glob match ".*?". This however matches a
too long part depending on the rest of the content.
This commit fixes the expression to be strict on
the allowed characters and makes sure the anchor
characters are not part of the matching character
class. This Fixes#1607
If the image description explicitly specifies a displayname
it is expected that the bootloader shows this in the menu.
Therefore in case displayname is set GRUB_DISTRIBUTOR will
be set if grub2 is in use. This partially reverts #1420
and Fixes#1575
On s390 and in CDL mode (4k DASD) the call of grub2-install
does not work because grub2-install is not able to identify
a 4k fdasd partitioned loop device as a grub supported device
and fails. As grub2-install is only used to invoke
grub2-zipl-setup and has no other job to do we can
circumvent this problem by directly calling grub2-zipl-setup
instead. Also delete LDL mode support, IBM no longer supports
this
In addition to the wrong root=/dev/mapper/loop... reference
fixing, written by grub2-mkconfig when used in obs there is
also the case that grub2-mkconfig writes root=PARTUUID which
is also unwanted and needs fixing. To solve this properly
and also with respect to more unexpected grub2-mkconfig
data, the code changes to use a regular expression for the
root= replacement. The expression matches all root= cases which
we want to fixup:
1. If the local used root device appears in the grub config file.
2. If a linux by-id setting is used in the grub config file.
The replacement happens for overlayroot disk images where we
know grub2-mkconfig cannot handle the layout as well as if kiwi
runs in obs where we know grub2-mkconfig fails due to the absence
of udev.
This changes the s390 support on several stages:
1) On s390 the boot process is based on zipl which boots into an
initrd from which a userspace grub process is started to support
the grub capabilities. The implementation of this concept is
provided via the grub2-s390x-emu package. Once installed the
setup of the bootloader is done via the grub2-mkconfig and
grub2-install commands and therefore from a caller perspective
the same as with any other grub2 setup process. For kiwi this
means no extra zipl bootloader target code is needed. Therefore
this commit deletes the zipl setup from kiwi and puts on
the standard grub2 process. This Fixes bsc#1170863
2) To support different targettypes the grub2-s390x-emu provided
zipl template must be adapted. Parts of the former zipl bootloader
setup therefore now applies to an update of the zipl2grub
template file
3) Support for CDL/LDL DASD targets has been disabled in the schema
When testing 4k devices and a respective zipl2grub template
setup for CDL/LDL targettype it has turned out that grub2-install
is not able to run on such a device. My assumption is that
the device code in grub2-install does not work for 4k devices
with an fdasd created partition table. As this needs further
investigations and most probably adaptions on the grub toolchain
for s390, we disabled the setup of these modes for now.
emulated DASD (FBA) and SCSI targets stays supported.
This commit refactors BootLoaderInstall class to make it a proper
factory class. In addition type hints are added for the constructor
method.
Related to #1498
This commit refactors BootLoaderConfig to turn it into a proper factory
class and to also include type hints to facilitate it's use from an API
POV.
Related to #1498
A vmx image is the same disk as an oem just without the dracut
repart/resize feature. This difference is better handled with
an oemconfig parameter <oem-resize> which allows to switch resize
on or off. The extra image type vmx will be dropped and an XSLT
stylesheet automatically transforms a vmx description to be a
oem image with the resize feature switched off.
This Fixes#1425
This commit makes sure that the early boot configuration files
for grub make use of the proper boot path and omiting the `/boot`
prefix if there is a dedicated boot partition.
Fixes#1553
This commit includes the 'loadenv' module to the list of basic grub
modules. This makes sure the module is included in any grub-mkimage
that KIWI does.
Fixes#1547
Instead of restricting the dynamic linux vs. linuxefi setup
to a specific grub version, support this setup for any version
of grub. This Fixes bsc#1175729 and bsc#1176134
Set options variable in grub loader/entries to match the
kiwi image description setup. This adaption currently
happens only when building in OBS because in this env
the options setup done by grub is a complete mess.
Distributions like Fedora RawHide or CentOS8 applies to the
grub BootLoaderSpec as described here:
https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec
Part of the spec is that menu entries are handled in extra files
below /boot/loader/entries. Unfortunately the grub2-mkconfig code
has still no clue how to find the correct root device in special
environments like obs workers or in overlay systems. To fixup the
result of grub2-mkconfig there is code in kiwi which needs to be
adapted because the file that contains the wrong information is
now no longer grub.cfg but some /boot/loader/entries/*.conf file.
This commit solves the issue.
kiwi copied the same grub.cfg file as it exists in boot/grub2
to the efi path. This is wrong as the setup in the efi boot
directory is used to enable normal grub loading and not providing
the user grub configuration. In addition the changes here makes
sure that the early grub boot code is placed into the system
in any EFI case except for secure boot when shim-install is
present. If shim-install is present it also creates the early
grub boot setup such that kiwi doesn't have to do it.
This Fixes#1491 and Fixes bsc#1172908
To prevent shim-install from calling grub2-install in uefi mode
kiwi temporary replaces the tool by a noop. This acts as a
workaround for an issue in shim-install. However the workaround
left a file copy of grub2-install in the system which should
not happen. This commit Fixes bsc#1173226 and Fixes#1490
This commit fixes the patch applied on grub.cfg when EFI mode is
selected and grub < 2.04. There are some distros that make use of the
`linux16` command instead of `linux` in grub configuration, this commit
extends the regex to also consider `linux16` command.
In kiwi we support a one time patch for the grub config file
that changes the static use of linuxefi to be dynamic. In
grub2 >= 2.04 all this has already been fixed but for grub2
version older than this version we applied the patch. The
patch however was only applied based on the presence of a
grub setting named GRUB_USE_LINUXEFI. It has turned out that
this variable is a custom extension not part of grub upstream
which makes the test functional only on distributions that
supports this setting. The use of linuxefi however is code
that belongs to grub upstream. Therefore this patch changes
the scope of the one time patch to be only based on the
version of grub no matter if GRUB_USE_LINUXEFI is supported
by the distro or not. This Fixes#1453
In addition to the root device setup in grub.cfg we also
need to patch the vendor grubenv file which contains an
invalid kernelopts value written by grub2-mkconfig under
the conditions explained in Issue #1287. This Fixes
Issue #1454
So far kiwi used a static serial line setup of the console
type was configured to use a serial console. However if
different parameters are needed there was no way to change
the static setup. This commit adds a new bootloader attribute
called serial_line which allows to specify the serial line
parameters for the grub bootloader e.g
serial_line="serial --speed=9600 --unit=0 --word=8 --parity=no --stop=1"
Please note serial_line takes the value as it is given and
adds this as a line to the grub configuration or as content
to the variable GRUB_SERIAL_COMMAND. No further validation
of the information takes place by kiwi. This Fixes#1401
Grub supports a style setting that influences the display of
the menu depending on the configured timeout value. With this
patch kiwi allows to specify the style via a new bootloader
parameter named timeout_style="hidden|countdown". If not set
the grub default applies which shows the menu in any case.
This Fixes bsc#1165730 and Fixes#1404
The bootloader settings are handled through attributes in the
type element. Over the years some attributes were added and
there are requests for more settings. Therefore the bootloader
setup deservers its own section. With this commit the schema
changes from v7.1 to v7.2 and moves bootloader, bootloader_console
boottimeout and zipl_targettype into a new bootloader subsection
below type. The commit also adds an auto transformation template
such that customers don't have to change their image descriptions.
This is related to Issue #1401
An explicit video mode 800x600 was used for grub if no
video mode setup exists in the XML description. For grub
this should better result in the auto mode. Related to
bsc#1165730
grub mkconfig creates a proper string based on /etc/os-release
if GRUB_DISTRIBUTOR is not set. We assume this to be true
for all distributions. This Fixes#1416
The method returned the basename of the tool if it could
be found by Path.which(). But the method's scope has been
changed in a way that the return value of the method must
be the result from Path.which() to allow working on the
full path name.
On systems that uses GRUB_USE_LINUXEFI with grub2 version
less than 2.04 there is no support for dynamic EFI
environment checking. In this condition we extend the grub
setup to add this support. The change kiwi does is as
follows:
* Apply only on grub < 2.04
1. Modify 10_linux to set linux/initrd as variables
2. Write hybrid setup as 01_efihybrid
This Fixes bsc#1165960 and bsc#1168480