Commit Graph

1059 Commits

Author SHA1 Message Date
Marcus Schäfer
f6b3b14020
Fixed return value from _get_grub2_mkconfig_tool
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.
2020-04-16 11:24:28 +02:00
Marcus Schäfer
91373ea845
Merge pull request #1398 from OSInside/validate_grub_config_on_linuxefi
Validate use of GRUB_USE_LINUXEFI
2020-04-16 10:25:45 +02:00
David Cassany
c8d5c5a02e
Make CommandCapabilities.check_version take the longest match
This commit ensures that when trying to parse the version of a tool
the comparison is done with the longest match for the given regular
expression. This solves cases such in `grub2` where the tool name
already provides some digit that could be seen as a version.
2020-04-16 10:25:21 +02:00
Marcus Schäfer
a46c56a546
Validate use of GRUB_USE_LINUXEFI
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
2020-04-15 15:24:13 +02:00
Marcus Schäfer
5442e9c88a
Create qcow2 images in two steps
The creation of the qcow2 format was done in one qemu-img
convert call. That call instructs qemu to compress and
convert in one call. The downside of this approach is that
not all qcow2 options can be used. For example the setup
of:

    <type ... formatoptions="preallocation=metadata"/>

failed the build with an error message that compression and
preallocation is not possible at the same time. Thus this patch
changes the way the qcow2 image is created to be done in two
steps. The first step converts the format without compression
and therefore allows for any format option to be used. The
second call only applies the compression and leads to the
final result.
2020-04-11 18:18:02 +02:00
Marcus Schäfer
29a9d60a38
Allow overlay directories for profiles
In addition to the existing root/ overlay directory which
applies always there can now also be profile specific overlay
directories. If an overlay directory should be applied for
a specific profile this can now be done by placing this data
in a directory that is named the same as the profile name.
2020-04-02 12:58:38 +02:00
Marcus Schäfer
94c7a7cdf6
Added new oem-resize-once element
The new element controls the behavior of the repart/resize code
in the oem-repart dracut module. By default the repart/resize
happens on every reboot and therefore also allows for disk
geometry changes during the livetime of the machine. If the
element is set to false the repart/resize operation happens
only once and then never again. To check for this condition
a new profile environment variable kiwi_rootpartuuid which
holds the PARTUUID of the root partition has been added to
the disk builder.
2020-03-27 10:37:42 +01:00
Marcus Schäfer
44a1d78e96
Added new image type: wsl
Support for building appx container images for
Windows Subsystem Linux (WSL). This Fixes #1235
2020-03-26 19:42:25 +01:00
David Cassany
fe3c2f3c73
Add SECURE_BOOT parameter for grub2 in efi mode
This commit adds the SECURE_BOOT parameter on bootloader sysconfig
for grub2.

Fixes bsc#1167746
2020-03-26 15:38:47 +01:00
David Cassany
7492c83ebf
No default boot partition for btrfs_root_is_snapshot
This commit ensures no boot partition is used when root is set to be
a btrfs snapshot unless this is explicitly required by the user.

Fixes #1351
2020-03-25 09:22:38 +01:00
Marcus Schäfer
e566153138
Fixed bootloader install
Mount EFI partition in any case not only for the shim target
2020-03-20 17:53:28 +01:00
Marcus Schäfer
e154914c3e
Merge pull request #1377 from OSInside/complete_fstab_refactoring
Complete refactoring of fstab handling
2020-03-20 09:51:06 +01:00
Marcus Schäfer
3b7f5be918
Complete refactoring of fstab handling
With the new Fstab class from prior pull request there is an
opportunity to handle all fstab related actions to be done
by that class. This commit extends the Fstab class with an
add_entry method such that we can avoid the extra lists
holding raw fstab lines in e.g the disk builder. In the end
all fstab related data is stored in an instance of the Fstab
class. This also extends the KIWI api by an fstab management
class. Related to #1329 and #1349
2020-03-18 16:01:13 +01:00
Marcus Schäfer
a62cbd5edb
Cleanup fstab handling for containers
When building container images an extra create_fstab method
exists that created an empty fstab file. The reasons for this
are historical and also related to appx support from obs.
The obs based support for appx containers was based on the
creation of a kiwi docker image that got modified and turned
into an appx container. Now with native appx support by kiwi
this special fstab handling is no longer needed and should
be deleted. This Fixes #1329
2020-03-18 14:12:54 +01:00
Marcus Schäfer
e5b51e7dab
Merge pull request #1374 from OSInside/better_fstab_handling
Better fstab handling
2020-03-17 13:44:29 +01:00
Marcus Schäfer
bc372a12b1
Validate and order final fstab file
On write of the final fstab file read, validate and order
the entries. This is related to Issue #1349
2020-03-17 11:25:56 +01:00
Marcus Schäfer
bfcb277fe4
Added Fstab class
Handling of fstab should be done in its own namespace and class.
The current handling of fstab entries is spread at several places.
There should be only one code that writes the fstab entries and
that code should also care for the correct canonical order of
the mountpoints
2020-03-17 11:25:56 +01:00
David Cassany
563f258586
Fix order in fstab
Any mount point directly under / should be just right after the root
mountpoint and before the custom mountpoints based on user's subvolume
configuration.

Fixes #1349 and bsc#1164310
2020-03-17 07:07:38 +01:00
Marcus Schäfer
546fe7c3db
Skip nodev devices for size calculations
Added a static list of mountpoints used for devices that
are not associated with a physical device like /proc and
use that information in the exclude list for calculating
the image byte size. This Fixes #1363
2020-03-14 20:45:16 +01:00
Marcus Schäfer
4f5e6f18ff
Fixed file name for config.bootoptions file
The dracut code in 90kiwi-dump/kiwi-dump-image.sh looks for a
file matching ${image_uri}.config.bootoptions but the install
code packs a file named pxeboot.${image_uri}.config.bootoptions
into the tarball. Thus without renaming the file it won't
be found. Also the documentation mentions the file to be
named ${image_uri}.config.bootoptions. This commit fixes the
install code to match the dracut boot code and the documentation
2020-03-06 15:52:49 +01:00
David Cassany
487c75017a
Fix a regression for container builds in OBS
This commit fixes a regression introduced in 12d84be2. We need to ensure
that `labels` item exist in oci image configuration dict before updating
it and creating it in case it doesn't exist.
2020-03-04 15:47:41 +01:00
David Cassany
12d84be2fb
Fix container labels setup in OBS
This commits fixes the containers label setup in OBS, ensuring that
adding the 'org.openbuildservice.disturl' label does not clear any
other label.

Fixes #1338
2020-02-28 15:34:39 +01:00
Marcus Schäfer
52c5d4a703
Refactor plugin architecture
Set kiwi.tasks to be the plugin entry point and register
existing task plugins in setup.py. Change the code in
cli.py to auto register plugins using the iter_entry_points
method from the pkg_resources class. This allows for easier
writing of external kiwi plugins.
2020-02-26 16:40:04 +01:00
Marcus Schäfer
7160b7faa1
Fixed handling of fillup templates
Systems using a template tool to generate config files
might not be effective when they see the intermediate
config files we need from the host to let certain package
managers work correctly. Therefore the cleanup code in
kiwi takes care to restore from an optionally existing
template file if no other custom variant is present.
This Fixes bsc#1163978
2020-02-24 18:03:22 +01:00
0501e24bd6
Merge pull request #1345 from OSInside/squashfs_compression_configurable
Make squashfs compression configurable
2020-02-24 05:08:07 -05:00
David Cassany
e670b4a760
Make squashfs compression configurable
This commit adds the `squashfscompression` attribute in type element. It
can take `gzip`, `zstd`, `xz`, `lzo`, `lz4` or `none`. The default is `xz`.

Fixes #1315
2020-02-24 10:40:57 +01:00
Marcus Schäfer
05351f9c1c
Use GPT table for Power ofw firmware
GPT partition table should be preferred for power systems
these days. Related to Issue #1325
2020-02-19 10:26:16 +01:00
David Cassany
75a91385e4
Do not create empty macros file
This commit makes sure to empty RPM macros files are created during
the build. Additionally it also ensures that no needless `rm` and `mkdir`
calls are done.

Fixes #1316
2020-02-18 14:08:30 +01:00
Al
ad33c037dc Split kiwi-dump into 2 modules to allow inserting a module after the image dump and before system reboot 2020-02-11 10:04:19 -08:00
David Cassany
141f384ec3
Add .append file for PXE images
This commit creates the .append file for PXE images. This file
is only created for initrd based images and includes the
UUID of the rootfs and any parameter added by the user within
the 'kernelcmdline' attribute.

Fixes #1327
2020-02-06 09:03:48 +01:00
9af219f2f8 Disable RPM module content validation and filtering when building in OBS
The Open Build Service builds images by identifying the requested dependencies,
downloading them into an isolated environment, regenerating the repository
metadata from scratch with *only* that content, and then passing those
new repositories to be used for building images. This enforces the
reproducibility of the image build process.

However, when building images for Linux distributions that have
AppStreams/modules (such as Red Hat Enterprise Linux/CentOS 8)
in an Open Build Service system, the repository metadata associated
with modules is not present as OBS does not generate it.

This causes the image build to fail because the normal module
content filtering rules make it so that modular RPMs are disabled
unless there is module metadata in the repository that identifies
them and that the module has been configured to be enabled.

As it is not possible for us to satisfy those conditions, instead
we disable modular filtering entirely when we detect that the image
build is occurring inside the build service, as we are reasonably
certain that OBS will not give us bad or broken package sets.
2020-01-29 09:43:17 -05:00
Marcus Schäfer
f87062aaf5
Merge pull request #1323 from OSInside/fix_solver_flags_lookup
Fixed sat solver flags validation
2020-01-29 09:43:07 +01:00
Marcus Schäfer
775b9a6c8f
Fixed ppc kernel lookup
On power the kernel is named e.g vmlinux-4.12.14-197.29-default
kiwi was missing that name match. Related to Issue #1325
2020-01-28 11:27:30 +01:00
Marcus Schäfer
25f75f1f8d
Fixed sat solver flags validation
The sat library from the python3-solv plugin does not expose
the flags information as method. Instead the flags value is
a variable pointing to an integer that has a name mapping
in self.solv.Selection from the library.
2020-01-27 17:11:36 +01:00
Marcus Schäfer
b45aa25af3
Merge pull request #1321 from OSInside/refactor_path_which_usage
Make use of Path.which including root_dir parameter
2020-01-24 10:18:29 +01:00
David Cassany
1466a6c69a
Make use of Path.which including root_dir parameter
This commit refactors the use of Path.which in several parts of the
code. Since dd4d2ed78 the Path utility is capable to run Path.which
on certain chroot env, thus no need to adapt the PATH environment
variable.

Fixes #1281
2020-01-22 16:12:08 +01:00
Marcus Schäfer
e35a0356a8
Make PXE oem deployment genericly useable
When deploying a disk image via PXE the initrd contained a config
file which connects it to a certain image. This has the disadvantage
that no other image could be deployed with it. This commit changes the
deployment code in a way that the config file is read from the
network if the disk is deployed via PXE. The tarball created by
kiwi provides the image connected config file but users now have
the opportunity to create their own boot configurations which allows
deployment of different images with the same kiwi built deployment
initrd. This Fixes #1298 and is one first step into a more generic
PXE support offered by kiwi.
2020-01-21 12:10:33 +01:00
Marcus Schäfer
579626a4e6
Merge pull request #1319 from OSInside/refactor_move_to_root_method_usage
Remove RootBind.move_to_root method
2020-01-20 16:49:47 +01:00
David Cassany
686dafc9e4
Remove RootBind.move_to_root method
This commit removes the RootBind.move_to_root method as this can all be
done by using the Path.move_to_root utility method. This allows
to drop the RootBind attribute in PackageManager classes and focus
path manipulation methods into a common utility.

Related to #1281
2020-01-20 16:17:24 +01:00
Marcus Schäfer
1a3d0dadb3
Fixed order of fstab entries
If a volume manager is used the volumes are added before the
root filesystem(/) entry in fstab. This does not hurt because
at boot time systemd manages the mounting of the rootfs prior
to any other information in the fstab file but it's conceptually
broken. Users justifiably can expect the fstab entries in the
correct order such that mounting from top to bottom leads
to a consistent root filesystem state.
2020-01-17 15:10:54 +01:00
Marcus Schäfer
37f88e4c27
Merge pull request #1312 from OSInside/allow_builds_without_kiwi_dracut_modules
Allow builds without KIWI dracut modules
2020-01-17 10:36:37 +01:00
Marcus Schäfer
04b345e7aa
Added support for spare partition fs attributes
Added new type attribute:

```xml
<type ... spare_part_fs_attributes="..."/>
```

which can be a comma separated list of the following currently
supported filesystem attributes:

* no-copy-on-write
* synchronous-updates

See chattr and filesystem manual pages for details on those
attributes. More attributes for the spare part context can be
added on request. This Fixes #1233
2020-01-15 16:15:48 +01:00
David Cassany
fc4a1616bc
Allow builds without KIWI dracut modules
This commit avoids requesting non installed dracut modules to the dracut
creation. It bumps a warning message if the module requested by KIWI is
not installed in the root-tree and ignores the request.

This allows the creation of images without including KIWI dracut modules
when the related runtime checks are disabled.

Fixes #1300
2020-01-15 11:08:19 +01:00
Marcus Schäfer
550cccdbea
Refactor kernel version lookup
For the lookup of the kernel version kiwi provided a small
C program that reads the first bytes of the kernel binary
and extracts the version information. Given the various
compression formats and also the problem of kernel files
that contains the decompressor code which could be anything
it has turned out to be difficult to provide a stable tool
to read the version from the binary. Therefore the code in
kiwi was refactored to read the version via regexp match
from the filename which also makes kversion an obsolete
tool. This Fixes #1308
2020-01-11 22:31:02 +01:00
David Cassany
2e271b882d
Fix grub2 configuration for shim fallback setup
If shim fallback setup is enabled the grub.cfg is copied to the EFI
partition. This commit makes sure that the grub.cfg is copied to the EFI
partition according to the efi mount point.

Fixes bsc#1159235
2019-12-18 18:51:59 +01:00
Marcus Schäfer
8c6eeac4a5
Open image files in UTF-8
Post image build metadata like the packages file which are
created from data produced by the package manager can contain
multibyte characters and should be written into files opened
with the UTF-8 encoding. The same applies to the image imported
XML description. This Fixes #1290
2019-12-05 09:26:31 +01:00
386aecb36e
Merge pull request #1284 from OSInside/fix_grub_default_setup
Fixed setup of default grub config
2019-11-29 11:54:06 -05:00
Marcus Schäfer
9a9e62018f
Fixed setup of default grub config
In /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT also contained
the root= information. If grub2-mkconfig runs with that information
it places the root device information twice because grub2-mkconfig
resolves this information itself. This commit prevents the root=
information to be placed in the default grub config and
Fixes bsc#1156908
2019-11-29 17:36:54 +01:00
Marcus Schäfer
f7d89f9868
Lookup distribution specific grub font dir
In addition to the generic grub font directory also lookup
distribution specific font paths in the system and copy the
grub unicode font into it. This Fixes #1253
2019-11-28 14:43:02 +01:00
David Cassany Viladomat
6db270c4ef
Merge pull request #1279 from OSInside/add_new_root_in_path_which
Add new root option in Path.which method
2019-11-27 13:00:10 +01:00