Debian Codegraph @

doc/source/troubleshooting/buildhost_constraints.rst

raw
1 .. _supported-distributions:
2
3 Build Host Constraints
4 ======================
5
6 For building images, a host system is required that runs the build process.
7 Tools to create the image are used from that host, and this creates an
8 indirect dependency on the target image. For example, building an
9 Ubuntu image requires the apt and dpkg tools and metadata to be available
10 and functional on the host to build an Ubuntu image. There are many more
11 of those host vs. image dependencies, and not all of them can be resolved
12 in a clear and clean way.
13
14 The most compatible environment is provided if the build host is of the same
15 distribution as the target image. In other cases, our recommendation is that
16 the build host is of the same distribution as the target and near to the
17 major version (+-1) compared to the target. Such an environment can be
18 found in:
19
20 * The Open Build Service `OBS <https://build.opensuse.org>`__.
21 * The {kiwi} boxed plugin: :ref:`self_contained`
22
23 In general, our goal is to support any major distribution with {kiwi}. However,
24 for building images, we rely on core tools that are not under our control.
25 Also, several design aspects of distributions like **secure boot** and working
26 with **upstream projects** are different and not influenced by us. There
27 are many side effects that can be annoying, especially if the build host
28 is not of the same distribution vendor as the image target.
29
30 Package Manager Behavior
31 ------------------------
32
33 One of the key requirements for {kiwi} is that the target distribution
34 consists of a collection of software packages provided through
35 software repositories. As of today, this applies to every Linux
36 distribution in some shape or form. For the installation of this
37 software packages, there are tools available called `package manager`,
38 and {kiwi} implements an API for a variety of package managers to
39 support the different Linux distributions.
40
41 In {kiwi}, the package manager tools are called in a way that allows
42 for a non-interactive installation of the packages specified in the
43 image description. However, {kiwi} does not intentionally configure
44 other features of the package manager to keep their distribution
45 default behavior as much as possible. There are many options that
46 can be set for a package manager to behave differently. This
47 part of the troubleshooting exists to inform about the most common
48 surprises or unexpected behavior of certain package managers and
49 solutions on how to address them.
50
51 .. note::
52
53 All of the following information applies to package manager
54 calls performed inside of the image root tree. Meaning, `after`
55 the image bootstrap phase. During the image bootstrap phase,
56 all package manager calls happen on the build host, and their
57 behavior can only be influenced by changing the setup of the
58
59 build host. An isolated build environment is required to
60 address issues in this area. See :ref:`self_contained` for
61 details.
62
63 zypper: modalias matching
64 ~~~~~~~~~~~~~~~~~~~~~~~~~
65 A module alias is an identifier that exists if the respective
66 hardware was found by the kernel on this system. The package
67 manager can use this information to match package(s) that holds
68 a reference to the alias name and installs it automatically.
69 For example: Automatically install a driver package if the
70 respective hardware is present. In zypper, this behavior is by
71 default enabled. When building an image, this feature can be
72 unwanted and lead to interesting side effects. As it's required
73 to build the image on some host, there is also some hardware
74 available during the build. This must not necessarily be the same
75 or compatible hardware the image is expected to run on later.
76 For example, the build host has a NVIDIA graphics card. An
77 image build process would install the NVIDIA driver package due
78 to the modalias match. The image is expected to run on a system
79 without an NVIDIA card. The build process would install unneeded
80 software. To switch off modalias matching in zypper, follow
81 these steps:
82
83 1. Add a `post_bootstrap.sh` hook script to your image description
84 with the following code:
85
86 .. code:: bash
87
88 echo 'ZYPP_MODALIAS_SYSFS=""' > .kiwi.package_manager.env
89
90 2. Optionally, add a `config.sh` hook script to your image description
91 with the following code:
92
93 .. code:: bash
94
95 rm .kiwi.package_manager.env
96
97 This will delete the custom environment file so that it does
98 not appear in the final image.
99
100 3. Rebuild your image. The `.kiwi.package_manager.env` environment
101 file is used by kiwi and added to the execution environment
102 of the package manager. The `ZYPP_MODALIAS_SYSFS` variable
103 can be used to switch off the modalias matching. For more
104 details on zypper settings, please refer to: https://doc.opensuse.org/projects/libzypp/HEAD/zypp-envars.html
105