Commit Graph

45 Commits

Author SHA1 Message Date
Marcus Schäfer
30eb1c1a5b
Correct setfiles relabeling
This change was inspired by a change done on Fedora's livecd-tools
from here: livecd-tools/livecd-tools#236. The patch corrects issues
with the setfiles SELinux relabel command. The issues become apparent
when the host and guest policies differ. Thus it becomes required
to explicitly set the policy to decouple from eventual unwanted
host settings.
2022-06-13 13:18:51 +02:00
Marcus Schäfer
6144ade736
update docs 2022-05-20 22:09:33 +02:00
Marcus Schäfer
04d966b920
Add support for group id in users setting
Allow to specify the group id in the groups list a user
should belong to. The group id can be placed as part of
the group name separated by a colon like in the following
example:

<users>
    <user groups="kiwi,admin:42,users" password="..." name="kiwi"/>
</users>

Please note kiwi checks if the provided group already
exists and only creates a group if it is not already present in
the system. As default groups are usually provided by the OS
itself including its preferred group id, you will intentionally
not be able to overwrite group id for existing groups.
This Fixes #2064
2022-05-20 19:23:22 +02:00
Marcus Schäfer
4f47b1d94b
Add support for prebuilt bootstrap package for apt
When using the apt packagemanager kiwi required the use of
debootstrap to create the initial rootfs. This works as long
as there is always a main distribution repository available
which follows the structure of the official debian mirrors.
However if such a main distribution is not present or an
alternative layout like e.g OBS repos is used, debootstrap
will refuse to work. To allow for an alternative and without
the dependency to debootstrap kiwi supports using a prebuilt
bootstrap package providing the mini rootfs to serve as
the bootstrap result. As all other package managers properly
supports installation into an empty new root, this feature
was only added when using the apt packagemanager
2022-05-18 11:19:51 +02:00
Marcus Schäfer
61e4f05f1b
Add support for partition cloning
Support creating block level clones of certain partitions
used in the image. Clones can be created from the root, boot
and any partition listed in the <partitions> element.
2022-05-05 17:00:36 +02:00
Marcus Schäfer
e7e8c3bf42
Add support for dm integrity with secret key
Allow to protect the opening of the integrity data map and
journal through a keyfile. For setting the key file two new
optional type attributes were added:

* integrity_keyfile
* integrity_metadata_key_description

The key file format must be correct according to the selected
integrity algorithm. As of now the kiwi default hmac-sha256
algorithm is used with the selected keyfile

The optional integrity_metadata_key_description attribute
allows to specify a custom description of an integrity key
as it is expected to be present in the kernel keyring. The
information is placed in the integrity metadata block. If
not specified kiwi creates a key argument string instead
which is based on the given integrity_keyfile filename.
The format of this key argument is:

:BASENAME_OF_integrity_keyfile_WITHOUT_FILE_EXTENSION
2022-05-04 16:04:37 +02:00
ozboss
18dbe55725
Add option to set LUKS type to luks1 (#2126)
Add option to set LUKS type to luks1

So far the LUKS type could be set to luks and luks2. However, what luks
version the value 'luks' evaluates to depends on how the distributor has
packaged luks. Thus it's possible that 'luks' is either luks1 or luks2. To
also have the opportunity to explicitly specify luks1 this commit adds
the opportunity in the schema.
2022-05-04 15:28:57 +02:00
Marcus Schäfer
d5e7e546ca
Add support for standalone dm integrity
There is support in kiwi to use dm_integrity in combination
with the LUKS header and dm_crypt. However there is also the
use case to setup dm_integrity in standalone mode. This commit
allows to create the dm_integrity layer outside of LUKS using
/etc/integritytab to activate the map through a systemd
generator if systemd is used.

Regarding systemd it's required to use a version of system which
provides: system-generators/systemd-integritysetup-generator.
If this generator does not exist in the distribution it will
also be missing in the dracut generated initrd and the boot
will not be able to succeed. It's mentioned here because even
newer distributions might be missing the generator

Along with the implementation there are two new optional
attributes in the <type> section:

    standalone_integrity="true|false"
    embed_integrity_metadata="true|false"

standalone_integrity activates/deactivates the dm_integrity map
on top of the root filesystem. Similar to the veritysetup support
there is the opportunity to create an embedded magic metadata
block at the end of the device containing the root
filesystem via embed_integrity_metadata
2022-04-25 15:40:32 +02:00
Tim Serong
5c6e8e0523 Add ensure_empty_tmpdirs option for OCI containers (bsc#1197783)
Since #1759 was merged, the contents of /run/ and /tmp/ are excluded from
built images.  This causes problems for some containers, notably Ceph when
deployed in a Rook/k8s environment, which needs to have certain directories
present inside /run/.  This commit adds the ability to return to the previous
behaviour and *not* empty those temporary directories, if you specify
<image><preferences><type [...] ensure_empty_tmpdirs="false">.

Fixes: https://github.com/OSInside/kiwi/issues/2093
Signed-off-by: Tim Serong <tserong@suse.com>
2022-03-31 15:43:40 +11:00
Marcus Schäfer
82f0950620
Added embed_verity_metadata attribute
Specifies to write a binary block at the end of the
partition serving the root filesystem, containing information
for dm_verity verification and to construct the device map
2022-03-25 12:07:23 +01:00
Marcus Schäfer
c30ac9f1fb
Handle LUKS type in its own attribute 2022-03-21 23:28:22 +01:00
Marcus Schäfer
74ad1e5744
Allow luks format options
Added new luksformat element which allows to pass
along options to the luksFormat call. This allows users to
switch between LUKS and LUKS2 via e.g

    <luksformat>
        <option name="--type" value="luks2"/>
    </luksformat>

It also allows to pass along a set of options only available
to LUKS2, e.g

    <luksformat>
        <option name="--type" value="luks2"/>
        <option name="--cipher" value="aes-gcm-random"/>
        <option name="--integrity" value="aead"/>
    </luksformat>

In addition to the new attribute the existing luks attribute
can also be specified to read credentials from a keyfile by
using the file:// source locator, e.g

    <type ... luks="file:///path/to/a/keyfile"/>

This Fixes #1898
2022-03-21 21:40:35 +01:00
Marcus Schäfer
bd91dabfcc
Add support for verity setup on standard rootfs
So far the verity support was only available with the
overlayroot layout and the read-only squashfs root. This
commit adds a new attribute: verity_blocks="number|all"
which allows to create the verity setup also on the
standard root partition

In addition to the change it was needed to extend the
Filesystem API with an additional optional paramter to
allow setup of the filesystem UUID. Having the opportunity
to set the UUID at filesystem creation is generally useful
and with regards to this particular change it became also
required
2022-03-21 20:37:18 +01:00
6ea306256d Allow Btrfs and XFS as options for the boot partition filesystem
We already do this implicitly when we do not define this attribute
and request a boot partition, so let us explicitly offer these as
options too.
2022-03-18 07:10:39 -04:00
Marcus Schäfer
fe265a6a81
Move scope of veritysetup
veritysetup was called as part of the disk builder. However,
the veritysetup should be a responsibility of the classes which
implements the sync_data method. This allows to use the creation
of a verity hash format right after sync as a feature to these
classes and in a broader scope. In addition to that change the
VeritySetup::format method now returns the metadata from the
format call and stores it as debug information to the log file.
A concept to persistently store the verification metadata as part
of the partition(s) will be a next step.
2022-03-10 09:19:08 +01:00
Marcus Schäfer
a0cc1989c6
Merge pull request #2081 from OSInside/support_extended_partitions
Support extended partitions
2022-03-09 20:53:37 +01:00
Dan Čermák
0e30214c23
Style changes in container docs
Reformulate the container building guide a bit
2022-03-09 18:14:29 +01:00
Marcus Schäfer
2da706f5ed
Add support for extended layout to msdos table
This commit adds the following new type attribute

    <type ... dosparttable_extended_layout="true|false"/>

If set it specifies to make use of logical partitions inside
of an extended one. Effective only on type configurations which
uses the msdos table type, it will cause the fourth partition
to be an extended partition and all following partitions will be
placed as logical partitions inside of that extended partition.
This setting is useful if more than 4 partitions needs to be
created in an msdos table.

In addition to the support for extended/logical partitions the
the attributes 'mountpoint' and 'filesystem' in the <partitions>
section becomes optional. This also allows to place partitions
as placeholders not mounted into the system
2022-03-05 21:25:56 +01:00
Marcus Schäfer
4ce7842e99
Added overlayroot_verity_blocks attribute
Setting this attribute to a number or 'all' in an overlayroot
configuration will create a dm verity hash from the number of
given blocks (or all) placed at the end of the squashfs compressed
read-only root filesystem. For later verification of the device,
and without further image description settings, the credentials
information produced by veritysetup from the cryptsetup tools, is
created as a file in /boot/overlayroot.verity and is stored as
such into the image by default.
2022-03-03 21:58:14 +01:00
Marcus Schäfer
6e3ac0e2ea
Added overlayroot_readonly_partsize attribute
Specifies the size in MB of the partition which stores the
squashfs compressed read-only root filesystem in an
overlayroot setup. This Fixes #2068
2022-02-25 17:32:47 +01:00
Marcus Schäfer
372590d05d
Added overlayroot_write_partition attribute
For the oem type only, allows to specify if the extra read-write
partition in an overlayroot setup should be created or not.
By default the partition is created and the kiwi-overlay dracut
module also expect it to be present. However, the overlayroot
feature can also be used without an initrd and under certain
circumstances it is handy to configure if the partition table
should contain the read-write partition or not.
2022-02-20 14:42:30 +01: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
Marcus Schäfer
e2f32e8c8a
Added support for collection modules
In CentOS Stream 8 and Red Hat Enterprise Linux 8, there are
Application Streams that are offered in the form of modules
(using Fedora Modularity technology). To build images that use
this content KIWI needs to support to enable/disable various
modules. This commit allows to configure collection modules
in a new element as shown below

<packages type="bootstrap">
    <collectionModule name="module" stream="stream" enable="true|false"/>
</packages>

This Fixes Issue #1999
2021-12-14 22:55:05 +01:00
Marcus Schäfer
7e3297d9d3
Added support for setting up release version
Currently the release version is not set or set to '0'
for package managers which requires a value to operate.
However, in order to support leveraging the same description
across different releases it is important to have the
opportunity to specify a setting for the release version.
This commit adds a new optional attribute to the preferences
section which allows to specify a custom value which
serves as the release version:

<preferences>
    <release-version>TEXT</release-version>
</preferences>

If not specified the default setting as before applies.
Please note the release version information is currently
used in dnf and microdnf package managers only. It might
happen that it gets applied to the other package manager
backends as well. This will happen on demand though.
Related to Issue #1918. This Fixes #1927
2021-12-06 09:54:41 +01:00
Marcus Schäfer
4ac456b31f
Support this:// resource locator for includes
Allow include references like the following example:
<include from="this://include.xml"/>
2021-11-25 16:02:48 +01:00
Marcus Schäfer
350ed05454 Allow to set sign keyfile in repository elements
This commit adds a new and optional child element <signing>
to the repository/source element as shown in the following
example:

<repository>
    <source path="...">
        <signing key="keyfile"/>
    </source>
</repository>

The collection of all keyfiles from all repositories will be
added to the keyring as used by the selected package manager.
Signing keys specified on the commandline and signing keys
specified in the image description will be combined.
This Fixes #1883
2021-11-16 10:15:46 -05:00
Marcus Schäfer
9cb68abcea Fixed include processing
This commit fixes several issue connected with the use of
the <include> directive:

First and foremost the XSLT chain was broken in a way that
the include XSLT in combination with the PrettyPrinter XSLT
were called not in the chain of stylesheets but together.
This results in XML descriptions which duplicated the content
and went invalid

Another change is, when the include XSLT is called in the chain.
This commit moves it to become the very first processing
instruction such that the included data is part of all subsequent
XSLT stylesheets. This also allows to use older schema versions
in included XML data and they get automatically converted through
the chain of XSLT stylesheets.

Last change is the evaluation of the from= attribute value. This
value is now interpreted as an URI. Currently only local URIs are
supported. The reason to do this is because XSLT when processing
a document resolves relative paths according to the file path
of the master document. As kiwi does not change the original
content that path with will be a /var/tmp location if one of
the XSLT stylesheets were used. The documentation for this change
was updated as well
2021-11-12 07:46:52 -05:00
Marcus Schäfer
94de1336d8
Support custom partitions
In addition to the volume volume management settings also
allow to setup low level table entries like in the following
example:

<partitions>
    <partition name="var" size="100" mountpoint="/var" filesystem="ext3"/>
</partitions>
2021-11-03 13:31:17 +01:00
Marcus Schäfer
ef05ecc36e
Add support for toplevel include directive(s)
On the toplevel of an image description you can now
specify include directive(s) like in the following
example

<image ...>
    ...
    <include from="filename_a.xml"/>
    ...
    <include from="filename_b.xml"/>
</image>

At the place of their occurrence the include statement
will be replaced with the contents of the given filename.
The implementation is based on a XSLT stylesheet and
applies very early in the process. The stylesheet reads
the contents of the given file as XML document().
Thus only valid XML documents gets accepted by this
include concept. This Fixes #1929 and is related to
Issue #1918
2021-10-07 09:50:38 +02:00
Jesus Bermudez Velazquez
fd52237478
Allow target dir for archive
- Add the option to specify a target directory
  to unpack the archive
- Update doc for target dir attribute

This Fixes #1794
2021-09-07 15:13:24 +01:00
Marcus Schäfer
e3e0d888c8
Added support for repo customization script
repo files allows for several customization options
which could not be set by kiwi through the current
repository schema. As the options used do not follow
any standard and are not compatible between package
managers and distributions the only generic way to
handle this is through a script which is invoked
with the repo file as parameter for each file created
to describe a repo for the selected package manager.
This allows users to update/change the repo file content
on their individual needs. In the kiwi description the
path to the custom script can be specified as follows

    <repository ... customize="/path/to/custom_script">
        <source path="..."/>
    </repository>

This Fixes #1896
2021-08-10 10:10:01 +02:00
gnuninu
ac634eb3ac
Corrected preferences timezone code tag 2021-06-04 15:31:38 +01:00
Marcus Schäfer
8ede3ee0b6
Added support for skipping initrd creation
Embedded systems and other customer use cases sometimes
doesn't require an initrd. So far the initrd creation was
a mandatory step in the process. With this commit it's
possible to configure <type ... initrd_system="none"/>
and therefore skip the creation and setup of an initrd.
Using this feature comes with a price. Without an initrd
the task of mounting the specified root=DEVICE_SPEC now
becomes a task of the kernel. If the kernel doesn't have
the required filesystem driver compiled in or the mount
process of the device is not just a simple mount
action, the boot of such an appliance will fail
2021-05-27 16:07:55 +02:00
David Cassany Viladomat
42e25bcae9
Merge pull request #1766 from OSInside/drop_by_path_devicepersistency
Drop by-path devicepersistency setting
2021-03-17 15:05:40 +01:00
Marcus Schäfer
1850076d73
Drop by-path devicepersistency setting
The dev/disk/by-path device representation is a host specific
PCI location. For image building which happens disconnected from
the later target device this setting is useless.
This Fixes #1747
2021-03-16 14:23:30 +01:00
Marcus Schäfer
93d72e78dc
Change packagemanager setting from apt-get to apt
In kiwi we use the name of the section as package name to install this
package manager capability. However on Debian based distros there is
no package named apt-get. There is only a package named apt which
provides a tool named apt-get. To avoid inconsistencies like we had it
in Issue #1735 and to bring this setting in line with all other
packagemanager settings the setting was moved to just apt.
This Fixes #1738
2021-03-15 16:13:02 +01:00
David Cassany
7ecac68f4e
Include installmedia documentation 2021-01-27 12:36:02 +01:00
Marcus Schäfer
69c691d521
Update preferences documentation
The last commit added the optional arch attribute to the
preferences section but the documentation did not expose
this information. This is related to Issue #1640
2020-12-17 10:44:24 +01:00
David Cassany
a5dfcddeea
Make debootstrap repository explicit
This commit introduces the use_for_debootstrap attribute for
repositories of type apt-deb. This is a boolean attribute to specify
the repository that will be used for bootstrapping in apt-deb based
images. Only one can be selected and if none is specified KIWI just
makes use of the last one in the list.

Fixes #1593
2020-12-11 17:20:00 +01:00
David Cassany
d6fa037637
Fix documentation to be consistent with the XML KIWI scheme
This commit fixes the user section documentation to properly reflect
XML KIWI scheme constraints. 'home' attribute is optional and 'password'
attribute is mandatory.

Fixes #1599
2020-11-12 16:19:01 +01:00
Marcus Schäfer
89f85e4504
Use custom tmpfs for managing overlays
Provide a method to manage the base mount point for overlay and
iso mount points and set the base directory to it because /run
has a RAM space limitation which is unfortunate to handle live
systems. This Fixes #1558
2020-10-08 15:04:13 +02:00
Marcus Schäfer
8d2d9c214c
Make oem be a superset of vmx
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
2020-09-16 12:56:14 +02:00
Marcus Schäfer
00818f3932
Complete documentation of type attributes
Some type attributes e.g efipartsize and others were not
documented properly. This Fixes #1532
2020-09-08 12:07:06 +02:00
Marcus Schäfer
d10341df3f
Fixed doc structure for image types
The documentation did not differentiate correctly between
the explanation of the image types, their results and the
build host constraints compared to the documentation that
actually describes how to build an image for those types.
This Fixes #1520
2020-08-10 16:26:43 +02:00
Marcus Schäfer
caf1b633fe
Update documentation in content and structure
This commit adds a documentation for the KIWI XML description.
In contrast to the former auto generated code from the XML
schema this document can now finally be used as a reference.
Along with that new chapter all auto generated and static
html content as been deleted. Also all helper scripts around
the proprietary oxygen tool and our schema doc generator
has been deleted. Auto generating this information does not
lead to a reference guide people can really work with.
As a consequence to these changes this commit also includes
some changes of the structure such that no information written
by other people in the past gets lost. This Fixes #1421
and Fixes #1474
2020-07-01 10:42:51 +02:00