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} `boxbuild` command: :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 these
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 build host. An isolated build environment is required to
59 address issues in this area. See :ref:`self_contained` for
60 details.
61
62 zypper: modalias matching
63 ~~~~~~~~~~~~~~~~~~~~~~~~~
64 A module alias is an identifier that exists if the respective
65 hardware was found by the kernel on this system. The package
66 manager can use this information to match package(s) that holds
67 a reference to the alias name and installs it automatically.
68 For example: Automatically install a driver package if the
69 respective hardware is present. In zypper, this behavior is by
70 default enabled. When building an image, this feature can be
71 unwanted and lead to interesting side effects. As it's required
72 to build the image on some host, there is also some hardware
73 available during the build. This must not necessarily be the same
74 or compatible hardware the image is expected to run on later.
75 For example, the build host has a NVIDIA graphics card. An
76 image build process would install the NVIDIA driver package due
77 to the modalias match. The image is expected to run on a system
78 without an NVIDIA card. The build process would install unneeded
79 software. To switch off modalias matching in zypper, follow
80 these steps:
81
82 1. Add a `post_bootstrap.sh` hook script to your image description
83 with the following code:
84
85 .. code:: bash
86
87 echo 'ZYPP_MODALIAS_SYSFS=""' > .kiwi.package_manager.env
88
89 2. Optionally, add a `config.sh` hook script to your image description
90 with the following code:
91
92 .. code:: bash
93
94 rm .kiwi.package_manager.env
95
96 This will delete the custom environment file so that it does
97 not appear in the final image.
98
99 3. Rebuild your image. The `.kiwi.package_manager.env` environment
100 file is used by kiwi and added to the execution environment
101 of the package manager. The `ZYPP_MODALIAS_SYSFS` variable
102 can be used to switch off the modalias matching. For more
103 details on zypper settings, please refer to: https://doc.opensuse.org/projects/libzypp/HEAD/zypp-envars.html
104