| 1 |
.. _debianbootstrap_alternative: |
| 2 |
|
| 3 |
Circumvent Debian Bootstrap |
| 4 |
=========================== |
| 5 |
|
| 6 |
.. sidebar:: Abstract |
| 7 |
|
| 8 |
This page provides information on how to build Debian-based |
| 9 |
images without an extra bootstrap process. |
| 10 |
|
| 11 |
When building Debian-based images, {kiwi} uses `apt` in the |
| 12 |
bootstrap and the system phase to create the image root tree. |
| 13 |
However, `apt` does not support a native way to bootstrap |
| 14 |
an empty root tree. Therefore, the bootstrap phase uses |
| 15 |
apt only to resolve the given bootstrap packages and to |
| 16 |
download these packages from the given repositories. |
| 17 |
The list of packages is then manually extracted into the |
| 18 |
new root tree, which is not exactly the same as if `apt` |
| 19 |
would have installed them natively. For the purpose of |
| 20 |
creating an initial tree to begin with, this procedure |
| 21 |
is acceptable, though. |
| 22 |
|
| 23 |
If, for some reason, this bootstrap procedure is not |
| 24 |
applicable, {kiwi} allows for an alternative process that is |
| 25 |
based on a prebuilt bootstrap-root archive provided as a package. |
| 26 |
|
| 27 |
To make use of a `bootstrap_package`, the name of that package |
| 28 |
needs to be referenced in the {kiwi} description as follows: |
| 29 |
|
| 30 |
.. code:: xml |
| 31 |
|
| 32 |
<packages type="bootstrap" bootstrap_package="bootstrap-root"> |
| 33 |
<package name="a"/> |
| 34 |
<package name="b"/> |
| 35 |
</packages> |
| 36 |
|
| 37 |
The bootstrap process now changes in a way that the provided |
| 38 |
`bootstrap_package`, `bootstrap-root`, will be installed on the build |
| 39 |
host machine. Next, {kiwi} searches for a tar archive file, |
| 40 |
:file:`/var/lib/bootstrap/bootstrap-root.ARCH.tar.xz`, |
| 41 |
where `ARCH` is the name of the host architecture, e.g., `x86_64`. |
| 42 |
If found, the archive is unpacked and serves as the bootstrap |
| 43 |
root tree to begin with. The optionally provided additional |
| 44 |
bootstrap packages, `a` and `b` in this example, will be installed |
| 45 |
like system packages via `chroot` and `apt`. Usually, no additional |
| 46 |
bootstrap packages are needed, as they could all be handled as |
| 47 |
system packages. |
| 48 |
|
| 49 |
How to Create a bootstrap_package |
| 50 |
--------------------------------- |
| 51 |
|
| 52 |
Changing the setup in {kiwi} to use a `bootstrap_package` rather |
| 53 |
than using {kiwi}'s Debian bootstrap method to do the job comes with |
| 54 |
the task of creating that package, providing the bootstrap root tree. There |
| 55 |
is more than one way to do this. The following procedure is just one |
| 56 |
example and requires some background knowledge about the Open Build Service |
| 57 |
(`OBS <https://build.opensuse.org>`__) and its {kiwi} integration. |
| 58 |
|
| 59 |
1. Create an OBS project and repository setup that matches your image target. |
| 60 |
2. Create an image build package. |
| 61 |
|
| 62 |
.. code:: bash |
| 63 |
|
| 64 |
osc mkpac bootstrap-root |
| 65 |
|
| 66 |
3. Create the following :file:`appliance.kiwi` file: |
| 67 |
|
| 68 |
.. code:: xml |
| 69 |
|
| 70 |
<image schemaversion="{schema_version}" name="bootstrap-root"> |
| 71 |
<description type="system"> |
| 72 |
<author>The Author</author> |
| 73 |
<contact>[email protected]</contact> |
| 74 |
<specification>prebuilt bootstrap rootfs for ...</specification> |
| 75 |
</description> |
| 76 |
|
| 77 |
<preferences> |
| 78 |
<version>1.0.1</version> |
| 79 |
<packagemanager>apt</packagemanager> |
| 80 |
<type image="tbz"/> |
| 81 |
</preferences> |
| 82 |
|
| 83 |
<repository type="rpm-md"> |
| 84 |
<source path="obsrepositories:/"/> |
| 85 |
</repository> |
| 86 |
|
| 87 |
<packages type="image"> |
| 88 |
<package name="gawk"/> |
| 89 |
<package name="apt-utils"/> |
| 90 |
<package name="debconf"/> |
| 91 |
<package name="mawk"/> |
| 92 |
<package name="libpam-runtime"/> |
| 93 |
<package name="util-linux"/> |
| 94 |
<package name="systemd"/> |
| 95 |
<package name="init"/> |
| 96 |
<package name="gnupg"/> |
| 97 |
<package name="iproute2"/> |
| 98 |
<package name="iptables"/> |
| 99 |
<package name="iputils-ping"/> |
| 100 |
<package name="ifupdown"/> |
| 101 |
<package name="isc-dhcp-client"/> |
| 102 |
<package name="netbase"/> |
| 103 |
<package name="dbus"/> |
| 104 |
<package name="xz-utils"/> |
| 105 |
<package name="usrmerge"/> |
| 106 |
<package name="language-pack-en"/> |
| 107 |
</packages> |
| 108 |
|
| 109 |
<packages type="bootstrap"/> |
| 110 |
</image> |
| 111 |
|
| 112 |
.. code:: bash |
| 113 |
|
| 114 |
osc add appliance.kiwi |
| 115 |
osc ci |
| 116 |
|
| 117 |
4. Package the image build results into a Debian package. |
| 118 |
|
| 119 |
In step 3, the bootstrap root tarball was created but not yet |
| 120 |
packaged. A Debian package is needed so that it can be |
| 121 |
referenced with the `bootstrap_package` attribute and the repository |
| 122 |
providing it. The simplest way to package the `bootstrap-root` tarball |
| 123 |
is to create another package in OBS and use the tarball file as |
| 124 |
its source. |