OpenSUSE-KIWI Image System
OpenSUSE-KIWI Image System
openSUSEKIWIImageSystem
openSUSE-KIWI Image
System
Cookbook
Author: Marcus Schfer
Contributor:
Publication Date: 03/17/2016, Version: KIWI Version 7.03
I Concepts and Basics
1 Introduction
1.1 What is KIWI?
1.2 What does KIWI do?
1.3 How to use KIWI?
2 Installation
2.1 Installing KIWI Packages
2.2 Running KIWI from a Source Checkout
3 Basic Workflow
3.1 Building Images
3.2 Customizing the Boot Process
3.3 Distribution-Specific Code
4 KIWI Image Description
4.1 The config.xml File
https://doc.opensuse.org/projects/kiwi/doc/
1/148
9/23/2016
openSUSEKIWIImageSystem
5 Advanced Configuration
5.1 Image Caches
5.2 KIWI RAID Support
5.3 KIWI Custom Partitions
5.4 KIWI Encryption Support
6 Maintaining Appliance Images
6.1 Image Maintenance: Updating Software Packages
6.2 Image Maintenance: Modifying the Configuration
II Usecases
7 ISO Image / Live System
7.1 Building Live CD/DVD Images
7.2 Building Live Images for Removable USB Devices
8 VMX Image / Virtual Disks
8.1 Building VMX Images
8.2 VMware support
8.3 LVM Support
8.4 Extra Boot Partition
9 Docker images
9.1 Building Docker Images
9.2 Image Configuration Details
10 Vagrant boxes
10.1 Building Vagrant Boxes
11 PXE Image / Thin Clients
11.1 Building PXE Images
11.2 PXE Configuration Files
11.3 The PXE Client Configuration File Syntax
11.4 Hardware Grouping
12 OEM Image / Preload Systems
12.1 Building an OEM System and an Installation Image
12.2 Testing the Images
12.3 Installation Image Flavors
12.4 Customizing the OEM Images
https://doc.opensuse.org/projects/kiwi/doc/
2/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
3/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
4/148
9/23/2016
openSUSEKIWIImageSystem
1 Introduction
1.1 What is KIWI?
https://doc.opensuse.org/projects/kiwi/doc/
5/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
6/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
7/148
9/23/2016
openSUSEKIWIImageSystem
2 Installation
2.1 Installing KIWI Packages
2.2 Running KIWI from a Source Checkout
https://doc.opensuse.org/projects/kiwi/doc/
8/148
9/23/2016
openSUSEKIWIImageSystem
KIWI is developed and maintained in a repository on GitHub. You can clone the
source code using the following command.
git clone https://github.com/openSUSE/kiwi.git
Before running KIWI make sure all its dependencies are fullfilled. Get a list of
required packages by running the following command in the checkout directory (
kiwi/ ):
awk '/BuildRequires:/ { print $2 | "sort" }' rpm/kiwi.spec
Once all dependent packages are installed run the test suite from the checkout
directory as follows
make test
If all tests pass, all dependencies are fullfilled and KIWI can be run with from the
checkout directory with the following command:
./kiwi
To update to the latest version available, run git pull from the KIWI checkout
directory.
3 Basic Workflow
3.1 Building Images
3.2 Customizing the Boot Process
3.3 Distribution-Specific Code
https://doc.opensuse.org/projects/kiwi/doc/
9/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
10/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
11/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
12/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
13/148
9/23/2016
openSUSEKIWIImageSystem
The successful completion of the prepare step is a prerequisite for the create
step. It ensures the unpacked root tree is complete and consistent. Creating the
packed, or final, image is done in the create step. Multiple images can be created
using the same unpacked root tree. It is, for example, possible to create a self
installing OEM image and a virtual machine image from a single unpacked root tree.
The only prerequisite is that both image types are specified in the config.xml
before the prepare step is executed.
During the create step the following major operations are performed by kiwi:
1. Execute the User-defined Script images.sh .
At the beginning of the image creation process the script named images.sh
is executed if present. It is executed on the top level of the target root tree.
The script is usually used to remove files that are no needed in the final
image. For example, if an appliance is being built for a specific hardware,
unnecessary kernel drivers can be removed using this script. Consult the
kiwi::images.sh(1) man page for a detailed description of pre-defined
functions available in the images.sh script.
2. Create Requested Image Type.
The image types that can be created from a prepared image tree depend on
the types specified in the image description config.xml file. The
configuration file must contain at least one type element. The figure below
shows the currently supported image types:
https://doc.opensuse.org/projects/kiwi/doc/
14/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
15/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
16/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
17/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
18/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
19/148
9/23/2016
openSUSEKIWIImageSystem
The hooks are called before and after the client network is setup, respectively.
The hooks only exist for the PXE image type.
prepartition | postpartition
The hooks are called before and after the client creates the partition table on
the target disk, respectively. The hooks only exist for the PXE image type.
preprobe | postprobe
The hooks are called before and after the loading of modules not handled by
udev, respectively. The hooks only exist for the PXE image type.
preswap | postswap
The hooks are called before and after the creation of the swap space,
respectively. The hooks only exist for the PXE image type.
preactivate
This hook is called before the root file system is moved to / . The hook only
exists for the pxe image type.
preCallInit
This hook is called before the initialization process, init or systemd, is started.
At call time the root file system has already been moved to / .. The hook only
exists for the OEM and VMX image types.
preRecovery | postRecovery
This hook is called before and after the recovery code is processed. At call time
of preRecovery the recovery partition is not yet mounted. At call time of
postRecovery the recovery partition is still mounted on /reco-save . The hook
only exists for the OEM image type.
preRecoverySetup | postRecoverySetup
This hook is called before and after the recovery setup is processed. At call time
of preRecoverySetup the recovery partition is not yet mounted. At call time of
postRecoverySetup the recovery partition is still mounted on /reco-save. The
hook only exists for the OEM image type.
preException
This hook is called before a system error is handled. The error message is
passed as parameter. This hook can be used for all image types.
preHWdetect | postHWdetect
The hooks are called before and after the install image boot code detects the
possible target storage device(s). The hooks only exist for the OEM image type.
preNetworkRelease
https://doc.opensuse.org/projects/kiwi/doc/
20/148
9/23/2016
openSUSEKIWIImageSystem
preNetworkRelease
This hook is called before the network connection is released. The hook only
exists for the PXE image type.
The TAR archive must be located at the top level of the image description directory,
this is the same level that contains the config.xml file.
Hook scripts are only executed from within kiwi's boot code and must therefore be
part of the KIWI created boot image. Including the content of a TAR archive in the
initrd is accomplished by setting the value of the bootinclude attribute of the
archive element to true in the config.xml file as shown below:
<packages type="image">
<archive name="kiwi-hooks.tgz" bootinclude="true"/>
</packages>
The concept of including an archive in the boot image follows the same concepts
described for the system image previously. To use an archive in a pre-built boot
image the archive must be part of the boot image description in which case it is not
necessary to set the bootinclude attribute.
https://doc.opensuse.org/projects/kiwi/doc/
21/148
9/23/2016
openSUSEKIWIImageSystem
This will activate the post command execution for the preHWdetect hook. If
this variable is not set, the post command will not be executed.
2. The corresponding variable KIWI_HOOK_CMD_ HOOKNAME needs to passed
to the Kernel command line. Its value contains the command that is to be
executed, for example:
KIWI_HOOK_CMD_preHWdetect="ls -l"
This will cause the preHWdetect hook to call ls -l at the end of the hook
script code.
3.
Tip: Disable Post Command Execution at Boot Time
To disable all post commands for the current boot process pass the following
variable to the Kernel command line:
KIWI_FORBID_HOOK_CMDS=1
https://doc.opensuse.org/projects/kiwi/doc/
22/148
9/23/2016
openSUSEKIWIImageSystem
on the Kernel command line. With that parameter set to 1 , the system will enter a
limited shell environment in case of a fatal during boot. The shell contains a basic
set of commands. The first place to look for debugging information should be the
boot log file /var/log/kiwi.boot .
In addition to the shell, KIWI also starts the dropbear SSH server if the
environment is suitable. Support for dropbear can be added to the netboot and
oemboot (in PXE boot mode) boot images. For isoboot and vmxboot boot images
there is no remote login support because they do not set up a network. It is
required that the repository setup provides dropbear .
To have dropbear installed as part of the boot image the following needs to be
added to the system image configuration:
<packages type="image"/>
<package name="dropbear" bootinclude="true"/>
</packages>
It might be useful to also include a tool for copying remote files, such as scp or
rsync into the boot image. Note that the required packages need to be provided
by the repositories configured. To include rsync , for example, add the line
<package name="rsync" bootinclude="true"/> to the listing above.
To access the boot image via SSH it is required to provide a public key on the PXE
server in the directory: SERVER-ROOT /KIWI/debug_ssh.pub . KIWI exclusively
searches for that file name, so it is required to name it debug_ssh.pub .
SERVER-ROOT depends on what server type was configured to download the
image. By default this is done via TFTP. In that case SERVER-ROOT translates to
/srv/tftpboot ion the PXE server. Adjust the path accordingly if having used
HTTP or FTP.
https://doc.opensuse.org/projects/kiwi/doc/
23/148
9/23/2016
openSUSEKIWIImageSystem
Adding more than one public key to file is possible, the file uses the same format as
the common SSH file authorized_keys. If a public key was found you can login as
follows:
ssh root@IP-ADDRESS
In case rsync is available, you can copy the KIWI boot log to your local machine as
follows:
RSYNC_RSH='ssh -l root'
rsync -avz <ip>:/var/log/boot.kiwi
https://doc.opensuse.org/projects/kiwi/doc/
24/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
25/148
9/23/2016
openSUSEKIWIImageSystem
config-cdroot.sh
https://doc.opensuse.org/projects/kiwi/doc/
26/148
9/23/2016
openSUSEKIWIImageSystem
config-cdroot.sh
Along with the config-cdroot.tgz one can provide a script which allows to
manipulate the extracted data.
config/
Optional subdirectory that contains Bash scripts that are called after the
installation of all the image packages, primarily to remove the parts of a
package that are not needed for the operating system. The name of the Bash
script must resemble the package name listed in the config.xml.
The image definition starts with an image tag and requires the schema format at
version 2.0. The attribute name specifies the name of the image which is also used
for the filenames created by KIWI. Because we dont want spaces in filenames the
name attribute must not have any spaces in its name.
The following optional attributes can be inserted in the image tag:
displayname
Allows setup of the boot menu title for the selected boot loader. So you can
have suse-SLED-foo as the image name but a different name as the boot display
name. Spaces are not allowed in the display name because it causes problems
for some boot loaders and kiwi did not take the effort to separate the ones
which can display them correctly from the ones which can't
kiwirevision
https://doc.opensuse.org/projects/kiwi/doc/
27/148
9/23/2016
openSUSEKIWIImageSystem
kiwirevision
specifies a KIWI git revision number which is known to build a working image
from this description. If the KIWI git revision doesn't match the specified value,
the process will exit. The currently used git revision can be queried by calling
kiwi --version .
id
Inside the image section the following mandatory and optional subelements
exists. The simplest image description must define the elements description ,
preferences , repository and packages (at least one of type ="
bootstrap ").
The optional profiles section lets you maintain one image description while
allowing for variation of the sections packages and drivers that are included. A
separate profile element must be specified for each variation. The profile child
element, which has name and description attributes, specifies an alias name
used to mark sections as belonging to a profile, and a short description explaining
what this profile does.
https://doc.opensuse.org/projects/kiwi/doc/
28/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
29/148
9/23/2016
openSUSEKIWIImageSystem
For each preferences block at least one type element must be defined. It is
possible to specify multiple type elements in any preferences block. To set a
given type description as the default image use the boolean attribute primary
and set its value to true . The image type to be created is determined by the value
of the image attribute. The following list describes the supported types and
possible values of the image attribute:
image =" lxc|docker "
Use the lxc or docker image type to build a linux container image. For
additional information refer to the Chapter 9, Docker images chapter.
image =" [filesystem] "
Use one of the following image types to build a plain filesystem image. This will
create a file containing the data in the specified filesystem and you can loop
mount the image to view the contents e.g image="ext3":
ext2
ext3
ext4
btrfs
squashfs
xfs
image =" tbz "
Use the tbz image type to just pack the unpacked image tree into a tarball.
image =" cpio "
Use the cpio image type to specify the generation of a boot image (initrd).
When generating a boot image, it is possible to specify a specific boot profile
and boot kernel using the optional bootprofile =" default " and
bootkernel =" std " attributes.
A boot image should group the various supported kernels into profiles. If the
user chooses not to use the profiles supplied by KIWI, it is required that one
profile named std be created. This profile will be used if no other bootkernel is
specified. Further it is required to create a profile named default. This profile is
used when no bootprofile is specified.
It is recommended that special configurations that omit drivers, use special
drivers and/or special packages be specified as profiles.
https://doc.opensuse.org/projects/kiwi/doc/
30/148
9/23/2016
openSUSEKIWIImageSystem
The bootprofile and bootkernel attribute are respected within the definition of
a system image. Us the attribute and value type =" system " of the
description element to specify the creation of a system image. The values
of the bootprofile and bootkernel attributes are used by KIWI when generating
the boot image.
image =" iso "
Specify the key-value pair image =" iso " to generate a live system suitable for
deployment on optical media (CD or DVD). Use the boot =" isoboot/suse-* "
attribute when generating this image type to select the appropriate boot image
for optical media. In addition the optional flags attribute may be set to the
following values with the effects described below:
seed
Creates a btrfs based compressed read-only filesystem which allows write
operations into a btrfs seed device.
overlay
Creates a squashfs based compressed read-only filesystem which is
combined with a write space via the overlayfs filesystem. overlayfs is part of
the kernel since version 3.7
compressed
Creates a split ext3 plus squashfs filesystem and combines them via a
symlink system to a complete system it is recommended to specify a
split section as a child of this type element.
If the flags attribute is not used the filesystem will be squashfs compressed for
/bin /boot /lib /lib64 /opt /sbin and /usr. The rest of the filesystem is packed
into a tmpfs and linked via symbolic links
image =" oem "
Use this type to create a virtual disk system suitable in a preload setting. In
addition specify the attributes filesystem , and boot =" oemboot/suse-* "
to control the filesystem used for the virtual and to specify the proper boot
image. Using the optional format attribute and setting, the value to iso or usb
will create self installing images suitable for optical media or a USB stick,
respectively. Booting from the media will deploy the OEM preload image onto
the selected storage device of the system. It is also possible to configure the
system to use logical volumes. Use the optional lvm attribute and specify the
logical volume configuration with the systemdisk child element. The default
volume group name is kiwiVG. Further configuration of the image is performed
using the appropriate *config child block.
https://doc.opensuse.org/projects/kiwi/doc/
31/148
9/23/2016
openSUSEKIWIImageSystem
kernelcmdline
https://doc.opensuse.org/projects/kiwi/doc/
32/148
9/23/2016
openSUSEKIWIImageSystem
kernelcmdline
Specifies additional kernel parameters. The following example disables kernel
messages: kernelcmdline="quiet"
mdraid
For disk based image types, aka oem and vmx, mdraid activates the creation of
a software raid image. The raid inside the image is created in degraded mode
because at creation time we only know about one disk. It's in the hand of the
user to add devices to the raid after the image runs on the target machine. The
value for mdraid can be either mirroring or striping, which means the raid level
is set to RAID1 (mirroring) or RAID0 (striping).
Within the preferences section, there are the following optional elements:
showlicense
Specifies the base name of a license file which is displayed in oem images
before the installation happens. It's possible to add more showlicense sections
to display more licenses one after the other. If no such element is specified the
default 'license' and 'EULA' files are searched. The search algorithm will append
the .txt or .locale.txt suffix to the license name to form the license file name.
You should make sure that you license files contains this suffix.
rpm-check-signatures
Specifies whether RPM should check the package signature or not
rpm-excludedocs
Specifies whether RPM should skip installing package documentation
rpm-force
Specifies whether RPM should be called with --force
keytable
Specifies the name of the console keymap to use. The value corresponds to a
map file in /usr/share/kbd/keymaps . The KEYTABLE variable in
/etc/sysconfig/keyboard file is set according to the keyboard mapping.
timezone
Specifies the time zone. Available time zones are located in the
/usr/share/zoneinfo directory. Specify the attribute value relative to
/usr/share/zoneinfo . For example, specify Europe/Berlin for
/usr/share/zoneinfo/Europe/Berlin . KIWI uses this value to configure
the timezone in /etc/localtime for the image.
locale
https://doc.opensuse.org/projects/kiwi/doc/
33/148
9/23/2016
openSUSEKIWIImageSystem
Specifies the name of the UTF-8 locale to use, which defines the contents of the
RC_LANG system environment variable in /etc/sysconfig/language .
Please note only UTF-8 locales are supported here which also means that the
encoding must not be part of the locale information. The KIWI schema validates
the locale string according to the following pattern:
[a-z]{2}_[A-Z]{2}(,[a-z]{2}_[A-Z]{2})* . This means you need to
specify the locale like the following example: en_US or en_US,de_DE
bootsplash-theme
Specifies the name of the bootsplash theme to use
bootloader-theme
Specifies the name of the gfxboot theme to use
defaultdestination
Used if the --destdir option is not specified when calling KIWI
defaultroot
Used if the option --root is not specified when calling KIWI
The type element may contain child elements to provide specific configuration
information for the given type. The following lists the supported child elements:
systemdisk
Using the optional systemdisk section it is possible to create a LVM (Logical
Volume Management) based storage layout or a btrfs based layout using sub
volumes. See chapter 17 for details.
By default, the volume group is named kiwiVG. It is possible to change the name
of the group by setting the name attribute to the desired name. Individual
volumes within the volume group are specified using the volume element.
The following example shows the creation of a volume named usr and a
volume named var inside the volume group systemVG.
<systemdisk name="systemVG">
<volume name="usr" freespace="100M"/>
<volume name="var" size="200M"/>
</systemdisk>
34/148
9/23/2016
openSUSEKIWIImageSystem
oemconfig
By default, the oemboot process will create or modify a swap, and / partition.
It is possible to influence the behavior by the oem-* elements explained
below.
<oemconfig>
<oem-systemsize>2000</oem-systemsize>
<oem-... >
</oemconfig>
https://doc.opensuse.org/projects/kiwi/doc/
35/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
36/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
37/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
38/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
39/148
9/23/2016
openSUSEKIWIImageSystem
Should the given size exceed the necessary size for the image KIWI will not alter
the image size as the free space might be required for proper execution of
components within the image.
If the size element is not used, KIWI will create an image containing
approximately 30% free space.
<size unit="M">1000</size>
split
For images of type split or iso the information provided in the optional split
section is considered if the compressed attribute is set to true. With the
configuration in this block it is possible to determine which files are writable
and whether these files should be persistently writable or temporarily. Note
that for ISO images only temporary write access is possible.
When processing the provided configuration KIWI distinguishes between
directories and files. For example, providing /etc as the value of the name
attribute indicates that the /etc directory should be writable. However, this
does not include any of the files or sub-directories within /etc . The content of
/etc is populated as symbolic links to the read-only files. The advantage of
setting only a directory to read-write access is that any newly created files will
be stored on the disk instead of in tmpfs . Creating read-write access to a
directory and its files requires two specifications as shown below.
<split>
<temporary>
<!-- read/write access to -->
<file name="/var"/>
<file name="/var/*"/>
<!-- but not on this file: -->
<except name="/etc/shadow"/>
</temporary>
<persistent>
<!-- persistent read/write access to: -->
<file name="/etc"/>
<file name="/etc/*"/>
<!-- but not on this file: -->
<except name="/etc/passwd"/>
</persistent>
</split>
https://doc.opensuse.org/projects/kiwi/doc/
40/148
9/23/2016
openSUSEKIWIImageSystem
If the target is a VMware virtual machine indicated by the format attribute set
to vmdk, KIWI creates a VMware configuration file. If the target is a Xen virtual
machine indicated by the domain attribute in the machine section KIWI will
create a Xen guest config file.
The sample block below shows the general outline of the information that can
be specified to generate the configuration file
<machine arch="arch" memory="MB"
HWversion="number" guestOS="suse|sles"
domain="dom0|domU"/>
<vmconfig-entry>Entry_for_VM_config_file<\vmconfig-entry>
<vmconfig-entry .../>
<vmnic driver="name" interface="number" mode="mode"/>
<vmnic ...>
<vmdisk controller="ide|scsi" id="number"/>
<vmdvd controller="ide|scsi" id="number"/>
</machine>
arch
The virtualized architecture. Supported values are ix86 or x86_64 . The
default value is ix86 .
memory
The mandatory memory attribute specifies how much memory in MB
should be allocated for the virtual machine
HWversion
The VMware hardware version number, the default value is 3 .
guestOS
The guest OS identifier. For the ix86 architecture the default value is suse
and for the x86_64 architecture suse-64 is the default. At this point only the
SUSE and SLES guestOS types are supported.
domain
The Xen domain setup. This could be either a dom0 which is the host
machine hosting the guests and therefore doesnt require a configuration
file, or it could be set to domU which indicates this is a guest and also
requires a guest configuration which is created by KIWI.
Use the vmconfig-entry element to create entries in the virtual machine's
configuration file; .vmx for VMware images and .xenconfig for Xen images. You
may specify as many configuration options as desired. The value of the
vmconfig-entry element is expected to be specified in the syntax required
by the VM configuration file to be written. The value is free format text and is
not validated by Kiwi in any way. The entry is written to the VM configuration
file verbatim.
https://doc.opensuse.org/projects/kiwi/doc/
41/148
9/23/2016
openSUSEKIWIImageSystem
Use the vmdisk element to setup the virtual main storage device.
controller
Supported values for the mandatory controller attribute are ide and
scsi .
id
The mandatory id attribute specifies the disk id. If only one disk is set the
id value should be set to 0.
device
The device attribute specifies the disk that should appear in the para virtual
instance. Therefore only relevant for Xen
Use the vmdvd element to setup a virtual optical drive (CD/DVD) connection
controller
Supported values for the mandatory controller attribute are ide and
scsi .
id
The mandatory id attribute specifies the disk id. If only one disk is set the
id value should be set to 0.
Use the vmnic element to setup the virtual network interface. Multiple
vmnic child elements may be specified to setup multiple virtual network
interfaces.
driver
The mandatory driver attribute specifies the driver to be used for the
virtual network card. The supported values are e100 , vlance , and
vmxnet . If the vmxnet driver is specified the vmware tools must be
installed in the image.
interface
The mandatory interface attribute specifies the interface number. If
only one interface is set the value should be set to 0.
mode
The network mode used to communicate outside the VM. In many cases
the bridged mode is used.
https://doc.opensuse.org/projects/kiwi/doc/
42/148
9/23/2016
openSUSEKIWIImageSystem
The optional users element lists the users belonging to the group specified with
the group attribute. At least one user child element must be specified as part of
the users element. Multiple users elements may be specified.
The attributes home , id , name , pwd , realname , and shell specify the
created users home directory, the user name, the users password, the users real
name, and the users login shell, respectively. By default, the value of the password
attribute is expected to be an encrypted string. An encrypted password can be
created using kiwi --createpassword . It is also possible to specify the
password as a non encrypted string by using the pwdformat attribute and setting
its value to plain. KIWI will then encrypt the password prior to the user being
added to the system.
All specified users and groups will be created if they do not already exist. By default,
the defined users will be part of the group specified with the group attribute of the
users element and the default group called users. If it is desired to have the
specified users to only be part of the given group it is necessary to specify the id
attribute. It is recommended to use a group id greater than 100.
The optional drivers element is only useful for boot images (initrd). As a boot
image doesnt need to contain the complete kernel one can save a lot of space if
only the required drivers are part of the image. Therefore the drivers section exists.
If present only the drivers which matches the file names or glob patterns will be
included into the boot image. Each file is specified relative to the
/lib/modules/ Version /kernel directory.
https://doc.opensuse.org/projects/kiwi/doc/
43/148
9/23/2016
openSUSEKIWIImageSystem
According
the driver
the specified files are searched in the
Type to
smart
zypper element
apt yum
corresponding directory. The information about the driver names is provided as
environment variable named like the value of the type attribute and is processed
by the function suseStripKernel . According to this along with a boot image
description a script called images.sh must exist which calls this function in order
to allow the driver information to have any effect.
Type
apt-deb yes
no
yes no
rpm-dir
yes
yes
no
no
rpm-md yes
yes
no
yes
yast2
yes
no
no
yes
https://doc.opensuse.org/projects/kiwi/doc/
44/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
45/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
46/148
9/23/2016
openSUSEKIWIImageSystem
The obs:// prefix is also valid as part of the value for the boot attribute of the
type . If used with the boot attribute it is evaluated as
this://images/$dir1/$dir2 .
opensuse:// PROJECTNAME
A special network location used with the http protocol. The given
PROJECTNAME specifies a project in the openSUSE Build Service. The
repository is a repository of type rpm-md . For example: path =
"opensuse://openSUSE:10.3/standard" .
plain:// URI
A plain resource string. Everything following 'plain://' will be forwarded to the
package manager without further modification. This type of location
specification is useful when KIWI does not support a specific URI but the
specified package manager does.
smb:// Samba share pathname
A path to a samba share using the cifs protocol. KIWI creates a mount point and
mounts the share including username and password, if specified. Access to the
smb share from within the new root tree is provided via a cifs mount.
Therefore, the package providing the cifs tools must be included in the package
list for the bootstrap section of the image configuration. At the time of this
writing the package providing the cifs tools is called cifs-utils. If any packages
provided by the Samba share are used as part of the boot image the cifs tools
must also be included in the boot image. This is accomplished with the
bootinclude attribute of the package element. This is shown in the
example below:
<packages type="bootstrap">
<package name="cifs-utils" bootinclude="true"/>
</packages>
this:// PATH
PATH is the relative location to the image description directory for the current
image.
https://doc.opensuse.org/projects/kiwi/doc/
47/148
9/23/2016
openSUSEKIWIImageSystem
<namedCollection .../>
<opensuseProduct name="name"/>
<opensuseProduct .../>
<ignore name="name"/>
<ignore .../>
</packages>
Note, that the delete value is indiscriminate of the image type being built.
image
Image packages, list of packages to be installed in the image.
iso
Image packages, a list of additional packages to be installed when building an
ISO image.
oem
Image packages, a list of additional packages to be installed when building an
OEM image.
pxe
Image packages, a list of additional packages to be installed when building an
PXE image.
vmx
https://doc.opensuse.org/projects/kiwi/doc/
48/148
9/23/2016
openSUSEKIWIImageSystem
vmx
Image packages, a list of additional packages to be installed when building a
vmx virtual image of any format.
https://doc.opensuse.org/projects/kiwi/doc/
49/148
9/23/2016
openSUSEKIWIImageSystem
5 Advanced Configuration
5.1 Image Caches
5.2 KIWI RAID Support
5.3 KIWI Custom Partitions
5.4 KIWI Encryption Support
https://doc.opensuse.org/projects/kiwi/doc/
50/148
9/23/2016
openSUSEKIWIImageSystem
In this chapter you will learn how to speed up image rebuilds by using
images caches. It also deals with setting up images supporting complex
storage scenarios such as RAID, LVM and encrypted partitions.
https://doc.opensuse.org/projects/kiwi/doc/
51/148
9/23/2016
openSUSEKIWIImageSystem
A cache needs to be created before it can be used. This can be done using any
standard kiwi image description, including boot image descriptions. That means
you can simply use one of the template or *boot descriptions and create a cache
from it. However, it is more efficient to create image descriptions for the sole
purpose of caching. Such descriptions could represent a set of patterns for
example. The less specific a cache is the more often it can be re-used
https://doc.opensuse.org/projects/kiwi/doc/
52/148
9/23/2016
openSUSEKIWIImageSystem
Once there are caches in the system KIWI selects the best match and mounts the
cache in a way that all write actions (copy-on-write cache) are redirected to the new
root system. That way the cache itself is never changed and can be re-used
simultaneously for other build processes. As a result the build process does not
start with an empty tree but with a tree filled with the contents of the cache. Only
the missing parts need to be added, which speeds up the build considerably.
EXAMPLE 5.1: BUILDING MULTIPLE VMX IMAGES
Assume we want to build some images of type 'vmx' based on the SLES 12 JeOS
image description. Create image caches for the system and the boot image like
follows:
1. Build the boot image (initrd) cache:
kiwi --init-cache /usr/share/kiwi/image/vmxboot/suse-SLES12
This call speeds up the build a lot compared to building without caches. It is
important to understand that a cache based build will create a root tree which
contains only the differences compared to the used cache. Thus at any time
you want to create an image out of it you need to make sure that the cache
exists and is accessible on the system.
https://doc.opensuse.org/projects/kiwi/doc/
53/148
9/23/2016
openSUSEKIWIImageSystem
name
https://doc.opensuse.org/projects/kiwi/doc/
54/148
9/23/2016
openSUSEKIWIImageSystem
name
A required attribute. The name of the volume. If mountpoint is not specified,
a directory with the given name will be created by KIWI if it does not already
exist inside the root tree. However, if the name contains the KIWI internal path
field separator _, it is required to specify the path in an additional mount point
attribute. The special value @root can be combined with the size or
freespace attribute to control the size of the root volume.
size
An optional attribute. Absolute size of the volume. If the size value is too small
to store all data kiwi will exit. If no suffix is used, the value will be considered as
Megabytes, otherwise add M (Megabyte) or G (Gigabyte) as suffix.
freespace
An optional attribute. Free space to be added to this volume. If no suffix is
used, the value will be considered as Megabytes, otherwise add M (Megabyte)
or G (Gigabyte) as suffix.
mountpoint
An optional attribute. Specifies a path which needs to exist inside the root
directory.
EXAMPLE 5.2: EXAMPLES FOR CONFIGURING LVM
The following example will create a logical volume named LVtmp with minimal
size to store the content of /tmp of the image at build time. The volume is
mounted to /tmp :
<image ...>
<preferences>
<type ...>
<systemdisk name="vgroup-name">
<volume name="tmp"/>
</systemdisk>
...
</type>
...
</preferences>
...
</image>
https://doc.opensuse.org/projects/kiwi/doc/
55/148
9/23/2016
openSUSEKIWIImageSystem
...
</type>
...
</preferences>
...
</image>
To create the logical volume named foo with 500 MB of free space mounted
as /tmp , use:
<image ...>
<preferences>
<type ...>
<systemdisk name="vgroup-name">
<volume name="tmp" freespace="500M" mountpoint="tmp"/>
</systemdisk>
...
</type>
...
</preferences>
...
</image>
The volumes LVRoot and LVSwap for the root file system and for swap, will
always be generated. To control the size if LVRoot , use the special name
@root .
<image ...>
<preferences>
<type ...>
<systemdisk name="vgroup-name">
<volume name="@root" size="2M"/>
</systemdisk>
...
</type>
...
</preferences>
...
</image>
https://doc.opensuse.org/projects/kiwi/doc/
56/148
9/23/2016
openSUSEKIWIImageSystem
There is no @root volume and no size setup. The Btrfs file system is created with
an initial size which can be specified by the size element All subvolumes are part
of the file system itself and managed by a namespace. The overall size is shared
across the entire file system and the size of an entity can be controlled by a Btrfs
quota which is not applied by kiwi at the moment
https://doc.opensuse.org/projects/kiwi/doc/
57/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
58/148
9/23/2016
openSUSEKIWIImageSystem
2. Run the following command to update the unpacked root tree from the
repositories configured in the image description:
kiwi --upgrade /tmp/myISO
You can optionally specify additional repositories not yet configured in the
image description, or additional packages and/or patterns. The latter two
can be part of the added repositories or the ones already configured.
kiwi --upgrade /tmp/myISO --add-repo REPO --add-repotype REPO_TYPE \
--add-package PACKAGE --add-pattern PATTERN
3. Run kiwi --create to build the final image. The following example
assumes that the image is created in /tmp :
kiwi --create /tmp/myISO --destdir /tmp
https://doc.opensuse.org/projects/kiwi/doc/
59/148
9/23/2016
openSUSEKIWIImageSystem
In case you need to change the configuration of the appliance (see Section 14.1,
The KIWI Model) or the image description (see Chapter 4, KIWI Image Description
you need to rebuild the complete image tree by running kiwi --prepare , to
make your changes permanent. It is strongly recommended to put your image
description under a version control system to enable tracking of changes and
different version builds.
1. Put your image description directory under a version control system such
as git. This step is optional, but strongly recommended.
2. Change the image description as needed. Stick to the following general
rules:
a. To add packages or patterns, modify the respective entries in
configuration.xml . See Section 4.1.8, packages Element for
details.
b. To change the list of repositories, modify the respective entries in
configuration.xml . See Section 4.1.7, repository Element
for details.
c. To change the configuration of your appliance, modify the respective
files in the overlay tree or provide an updated archive.
d. To change the user-defined tasks that will be carried out after the
installation (for example activating services), adjust the
configuration.sh script.
3. Create an unpacked root tree by running kiwi --prepare . The following
example assumes that the image description is located under
/tmp/myISO_config and that the result is written to /tmp/myISO :
kiwi --prepare /tmp/myISO_config --root /tmp/myISO
4. Run kiwi --create to build the final image. The following example
assumes that the image is created in /tmp :
kiwi --create /tmp/myISO --destdir /tmp
5. When the final version of your changes has been applied, make sure to
check this state in to the version control system.
https://doc.opensuse.org/projects/kiwi/doc/
60/148
9/23/2016
openSUSEKIWIImageSystem
Part II Usecases
7 ISO Image / Live System
A live system image is an operating System on CD, DVD or removable USB
storage. It can bee booted directly from the media. A CD/DVD live system is
read-onlyall changes to the system are done in RAM will be lost as soon as
the computer shuts down. A removable USB storage can optionally be set up
with an additional partition (hybrid ISO image) which can be used for writing
data.
8 VMX Image / Virtual Disks
A VMX image is a virtual disk image for use in full virtualization systems like
Qemu or VMware. The image is a file containing the system (represented by the
configured packages in config.xml ) as well as partition data and boot loader
information. VMX images have a fixed disk size and geometry that cannot be
changed (see Chapter 12, OEM Image / Preload Systems for images with
expandable disks).
9 Docker images
https://doc.opensuse.org/projects/kiwi/doc/
61/148
9/23/2016
openSUSEKIWIImageSystem
Docker is a shipping container system for code that can run virtually
everywhere. It is an extension of LXC's capabilities. Since Docker is based on
LXC, a Docker container does not include a separate operating system. It relies
on the functionality provided by the underlying infrastructure. As such, it can
package the application and all its dependencies in a virtual container which
can be run on any Linux server.
Docker not only makes it possible to deploy portable containers across
machines. It also includes versioning capabilities for tracking different versions
of a container, it allows re-using containers as a base for other specialized
components, and much more. Find more information about Docker on its
home page at http://www.docker.io.
10 Vagrant boxes
Vagrant (http://vagrantup.com/) is a nice framework to implement consistent
processing/testing work environments based on Virtualization technologies. To
run a system, Vagrant needs so-called boxes. A box is a TAR archive containing
a virtual disk image and some metadata.
To build Vagrant boxes, you can use veewee
(https://github.com/jedi4ever/veewee) which builds boxes based on AutoYaST,
or Packer (http://packer.io), which is provided by Vagrant itself.
Both tools are based on the official distribution media (DVDs). If such media
does not exist (for example if the distribution is still under development or you
want to use a collection of your own repositories), the KIWI way of building
images might be helpful. In addition you can use the KIWI image description as
source for the Open Build Service (http://openbuildservice.org/) which then
allows building and maintaining boxes in the Build Service as a plus.
11 PXE Image / Thin Clients
PXE is a network boot protocol that is shipped with most BIOS
implementations. The protocol sends a DHCP request to get an IP address.
When an IP address is assigned, it uses the TFTP protocol to download a Kernel
and boot instructions. Contrary to other images built with KIWI, a PXE image
consists of separate boot and system images, since both images need to be
made available in different locations on the network boot server.
12 OEM Image / Preload Systems
An OEM image is a virtual disk image representing all partitions and boot
loader information the same way as on a physical disk. All flavors discussed
previously in Chapter 8, VMX Image / Virtual Disks also apply to the OEM image
type. Compared to the VMX image type, an OEM image comes with addition
13 Xen Para- and Full virtual Images
https://doc.opensuse.org/projects/kiwi/doc/
62/148
9/23/2016
openSUSEKIWIImageSystem
A Xen image is a virtual disk like a vmx but with the Xen kernel installed for
dom0 or para virtual guest images. For fully virtualized guest images any
Kernel, for example kernel-default , my be used together with the Xen
kernel modules.
14 Creating Appliances
With the traditional model of application delivery, applications such as a word
processor or an e-mail program are installed by a user or an administrator on
individual machines. When deploying the application on multiple machines, this
often requires to start the application installation on each machine.
Furthermore, in case of machines solely dedicated to a single application or a
defined set of applications, it is good practice, to adjust the operating system to
optimize resource management and maximize security and performance.
When multiple machines are affected, the steps for adjusting the operating
system need to be performed on each machine, too.
An alternative to the traditional model of application delivery is to provide a socalled appliance. An appliance is the combination of the parts of a general
purpose OS needed by a given application and the application itself, bundled
and delivered as one unit. This unit may be delivered in a variety of formats, for
example a ready to run virtual machine or a self-installing system on an optical
media or a flash disk.
The appliance model has a many advantages. Operating system and
application installation are no longer separate steps. The application is installed
together with the operating system and the installation does not require
manual intervention. The appliance provider can preconfigure the application
to be ready-to-run directly after installation. Furthermore, the appliance
provider can customize the operating system in terms of performance,
resources and security, so it best fits the given appliance.
15 System Analysis/Migration
KIWI provides a module which allows you to analyze the running system for
creating a report and an image description representing the current state of the
machine. Among others, this allows you to clone your currently running system
into an image. The process has the following limitations at the mom
63/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
64/148
9/23/2016
openSUSEKIWIImageSystem
There are two possibilities to use the ISO image generated above:
1. Burn the .iso file on a CD or DVD with your preferred burn program. Plug
in the CD or DVD into a test computer and (re)boot the machine. Make sure
the computer boots from the CD drive as first boot device.
2. Use a virtualization system to test the image directly. Testing an ISO image
can be done with any full virtual system for example QEMU :
qemu -cdrom /tmp/myiso-result/LimeJeOS-SLE12.x86_64-1.13.1.iso
KIWI supports different flavors of file systems and boot methods along with the ISO
image type. The template suse-SLE12-JeOS from the example above, uses an
overlayfs -based compressed root file system. Set the file system type with the
flags attribute in config.xml :
<image ...>
<preferences>
<type image="iso" flags="FSTYPE" .../>
...
</preferences
...
</image>
Description
Does file system compression with squashfs, but does not use an
overlay file system for write support. A symbolic link list is used
compressed
instead and thus a split element is required in config.xml .
See Section 7.1.1, Split mode for details.
overlay
overlayfs allows to combine two file systems into one. The root
file system exists as a compressed squashfs file system and all
write operations are redirected to the RAM or to a persistent area
on a disk. The result is a fully writable live-system.
seed
unset
https://doc.opensuse.org/projects/kiwi/doc/
65/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
66/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
67/148
9/23/2016
openSUSEKIWIImageSystem
In contrast to the hybrid ISO image it is also possible to create an OEM virtual disk
image. This image type allows to create the live operating system plus a data
partition for custom data. The data partition is a fat partition also recognized by
Windows. To create such a partition use the option
--fat-storage size-in-MB on the KIWI command line:
kiwi --create ... --fat-storage 500
If this option is set, KIWI will use the syslinux boot loader for the image and for the
first FAT partition with the specified size. The live operating system itself will be
hosted on a logical volume (LVM), which allows to easily manipulate the logical root
volume. For further information about the OEM image type refer Chapter 12, OEM
Image / Preload Systems.
https://doc.opensuse.org/projects/kiwi/doc/
68/148
9/23/2016
openSUSEKIWIImageSystem
A VMX image is a virtual disk image for use in full virtualization systems
like Qemu or VMware. The image is a file containing the system
(represented by the configured packages in config.xml ) as well as
partition data and boot loader information. VMX images have a fixed disk
size and geometry that cannot be changed (see Chapter 12, OEM Image /
Preload Systems for images with expandable disks).
Tip: VMX Image Description Templates
KIWI comes with many image description templates. It is recommended to use
them as a basis for your own image descriptions. To do so, copy the respective
directory containing the image description of your choice to you working
directory and adjust it according to your needs.
VMX image templates are shipped with the package kiwi-desc-vmxboot .
They are installed to /usr/share/kiwi/image/vmxboot .
The command creates a virtual disk in the .raw format that can be directly booted
with any virtualization system. The following example shows how to boot it with
QEMU:
https://doc.opensuse.org/projects/kiwi/doc/
69/148
9/23/2016
openSUSEKIWIImageSystem
Description
qemuName
/tmp/myvm-result/LimeJeOS-SLE12.x86_64-1.13.1.raw
-m 1024
KIWI always generates a file in the .raw format. The .raw file is a disk image with
an equivalent to the structure of a physical hard disk. .raw images are supported
by any hypervisor, but are rather big in size (not compressed) and do not offer the
best performance.
Therefore each virtualization system supports its own proprietary format
supporting compression and improved I/O performance. To build an image in a
format other than .raw , add the format attribute to the type definition in
config.xml :
<image ...>
<preferences>
<type format="FORMAT" .../>
...
</preferences
...
</image>
Name
vmdk
Description
Disk format for VMware
qcow2
vdi
vagrant
gce
https://doc.opensuse.org/projects/kiwi/doc/
70/148
9/23/2016
openSUSEKIWIImageSystem
The guest configuration can be loaded via the VMware user interface and may be
modified through the GUI. The configuration file has the extension .vmx and the
same basename as the image:
/tmp/myvm-result/LimeJeOS-SLE12.x86_64-1.13.1.vmx
When using modern file systems like Btrfs or zfs, KIWI also supports using their
native volume management system. For more information how to setup custom
partitions/volumes, see Section 5.3, KIWI Custom Partitions.
https://doc.opensuse.org/projects/kiwi/doc/
71/148
9/23/2016
openSUSEKIWIImageSystem
Depending on the selected root file system and the capabilities of the boot loader,
KIWI automatically decides whether to set up a separate boot partition. The format
of a boot partition is set to ext2 by default.
To manually control the attributes bootpartition (can be set to true or
false ) and bootfilesystem (can be set to ext2 , ext3 , ext4 , fat32 , or
fat16 ). A runtime check at build time will test whether the given configuration can
be implemented. The following example will create an etx3-formatted boot
partition:
<image ...>
<preferences>
<type bootpartition="true" bootfilesystem="ext3" .../>
...
</preferences
...
</image>
9 Docker images
9.1 Building Docker Images
9.2 Image Configuration Details
Docker is a shipping container system for code that can run virtually
everywhere. It is an extension of LXC's capabilities. Since Docker is based
on LXC, a Docker container does not include a separate operating system.
It relies on the functionality provided by the underlying infrastructure. As
such, it can package the application and all its dependencies in a virtual
container which can be run on any Linux server.
Docker not only makes it possible to deploy portable containers across
machines. It also includes versioning capabilities for tracking different
versions of a container, it allows re-using containers as a base for other
specialized components, and much more. Find more information about
Docker on its home page at http://www.docker.io.
https://doc.opensuse.org/projects/kiwi/doc/
72/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
73/148
9/23/2016
openSUSEKIWIImageSystem
The generated configuration file restricts the device access of the container
according to a generally accepted best practice security model. The device access
permissions may be modified by editing the config file for the container.
10 Vagrant boxes
10.1 Building Vagrant Boxes
https://doc.opensuse.org/projects/kiwi/doc/
74/148
9/23/2016
openSUSEKIWIImageSystem
The build result is written to /tmp/my-box . The .box and .json files are
needed to add and run the box in Vagrant. The .box file is a TAR archive
containing the virtual disk image for the selected virtualization provider. In this
example it is a qcow2 image to be used with libvirt and some metadata which
mostly duplicates the information from the '.json' file to have it packaged in one
place, too.
The system installed on the virtual disk needs to fulfill some requirements which
are documented at http://docs.vagrantup.com/v2/boxes/base.html. The KIWI
template makes sure these requirements are met:
installation of mandatory packages: sudo , openssh and rsync
users root and vagrant are both configured to use vagrant as
password
integration of the Vagrant public SSH key from
https://github.com/mitchellh/vagrant/tree/master/keys
starting sshd daemon at boot time with UseDNS set to no
https://doc.opensuse.org/projects/kiwi/doc/
75/148
9/23/2016
openSUSEKIWIImageSystem
or by using the .json file to provide metadata such as a version number (similar
to the boxes downloaded from https://vagrantcloud.com/):
cd /tmp/my-box
vagrant box add LimeJeOS-SLE12.x86_64-1.13.1.libvirt.json
With either method, you can now boot the box and log in:
root # cd /tmp/my-box
root # vagrant init my-box
root # vagrant up --provider libvirt
root # vagrant ssh
This is the Lime-JeOS SLE12 Linux System...
vagrant@linux:~>
https://doc.opensuse.org/projects/kiwi/doc/
76/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
77/148
9/23/2016
openSUSEKIWIImageSystem
The following example shows how to build a Just enough Operating System (JeOS)
based on SUSE Linux Enterprise 12:
This command generates a compressed root file system image which is deployed as
an overlayfs-based union system. To use the image, all image parts need to be
copied to a PXE boot server. If you have not set up such a server, refer to
Appendix B, Setting Up a Network Boot Server for instructions. The following example
assumes you have created the PXE image on the boot server itself (if not, use scp
to copy the files on the remote host).
1. Change into the build directory:
cd /tmp/mypxe-result
5. Adjust the PXE configuration file. it controls which kernel and initrd is
loaded and which kernel parameters are set. A template has been installed
at /srv/tftpboot/pxelinux.cfg/default with the kiwi-pxeboot
package. The minimal configuration required to boot the SLE 12 JeOS looks
like to following:
DEFAULT KIWI-Boot
LABEL KIWI-Boot
kernel boot/linux
append initrd=boot/initrd
IPAPPEND 1
LABEL Local-Boot
localboot 0
https://doc.opensuse.org/projects/kiwi/doc/
78/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
79/148
9/23/2016
openSUSEKIWIImageSystem
KIWI_KERNEL="path-to-kernel"
KIWI_KERNEL_OPTIONS="opt1 opt2 ..."
NBDROOTNBDROOT="ip-address;export-name;device;swap-export-name;swap-device;write-export-n
NFSROOT="ip-address;path"
PART="size;id;Mount,...,size;id;Mount"
RAID="raid-level;device1;device2;..."
REBOOT_IMAGE=1
RELOAD_CONFIG=1
RELOAD_IMAGE=1
UNIONFS_CONFIGURATION="rw-partition,compressed-partition,container-fs"
To be able to use the device KIWI needs the information which AoE device
contains the root file system. In this example this is the device
/dev/etherd/e0.1 :
AOEROOT=/dev/etherd/e0.1
https://doc.opensuse.org/projects/kiwi/doc/
80/148
9/23/2016
openSUSEKIWIImageSystem
InstalledConfigFiles
Action
VENDOR_CONF
Writing to RAM as in the example above, is the default. You also can specify
another AoE location or a local device for writing the data.
COMBINED_IMAGE
If set to a non-empty string, indicates that the boot and the system image need
to be combined into a single bootable image. The first image defines the readwrite part and the second image defines the read-only part.
CONF , VENDOR_CONF
Specifies a comma-separated list of source:target configuration file names. The
source corresponds to the path on the TFTP server. It is downloaded to
target on the client. The download is only done when the file is missing on
the client or has a different md5-sum (in case the md5sum hash is supplied
with hash ).
To achieve this, a list of CONF files (and VENDOR_CONF ) files that generated by
KIWI and stored on the client ( /etc/KIWI/InstalledConfigFiles ) is
compared to the CONF data gathered from the configuration file (for example
config.default ), if supplied.
Configuration files selected for comparison are those with same destination
path (dest). If the destination path is same for more than one configuration file,
only the last one is used (and VENDOR_CONF always take s precedence over
CONF ). By comparing configuration file lists present in the current CONF and
VENDOR_CONF variables and with the local list, the following actions can result:
TABLE 11.1: CONFIGURATION FILES SYNCHRONIZATION POSSIBILITIES
InstalledConfigFiles
Action
hash_a
hash_a
nothing, keep
hash_a
hash_b
none
hash
hash
none
none
none
nothing, keep
present
not present
not present
present
delete on client
(regardless hash)
https://doc.opensuse.org/projects/kiwi/doc/
81/148
9/23/2016
openSUSEKIWIImageSystem
Note that actual configuration files (or their md5sum hashes) on the client
machine are not testedonly data from the list file
/etc/KIWI/InstalledConfigFiles is used to determine which files need
to be synchronized. This means that actual configuration files can be altered or
even be deleted without triggering any action. On the other hand, if the list file
is changed or deleted, an action could be triggered although the actual
configuration files have not changed.
DISK
Specifies the storage device. Only to be used together with PART , for example:
DISK=/dev/hda
FORCE_KEXEC
During the initial deployment process KIWI checks if the running Kernel is the
same as the Kernel installed via the system image. If there is a mismatch, KIWI
activates the installed kernel by calling kexec . Kexec is a tool to boot to
another kernel from the currently running one. The system boots faster,
because the hardware initialization phase and the boot loader are skipped..
If FORCE_KEXEC is set to a non-empty string kiwi will also perform kexec if the
Kernel versions matches.
IMAGE
Specifies the image to be downloaded and the device for the root file system.
IMAGE='device;name;version;srvip;bsize;compressed'
82/148
9/23/2016
openSUSEKIWIImageSystem
version
Version string, for example 1.13.1 .
srvip
Specifies the server IP address for the TFTP download. Must always be
indicated, except in PART .
bsize
Specifies the block size for the TFTP download. Must always be indicated,
except in PART . If the block size is too small according to the maximum
number of data packages (32768), linuxrc will automatically calculate a new
block size for the download.
compressed
Specifies if the image file on the TFTP server is compressed and handles it
accordingly. To specify a compressed image download only the keyword
compressed needs to be added. If compressed is not specified the
standard download workflow is used.
The name of the compressed image needs to contain the suffix .gz and
the image needs to be compressed with the gzip tool. Using a
compressed image will automatically deactivate the multicast download
option of atftp.
IMAGE='/dev/sda2;suse.i686.gz;1.2.8;192.168.100.2;4096;compressed'
Important:
The download will fail if you specify compressed and the image is not
compressed. It will also fail if you dont specify compressed but the
image is compressed.
KIWI_BOOT_TIMEOUT
Specifies the number of seconds to wait at the boot loader screen when doing
a local boot before booting the default boot entry. The default is 10.
KIWI_INITRD
Specifies the KIWI initrd to be used for a local boot of the system. The value
must be set to the name of the initrd file which is used via PXE network boot. If
the standard TFTP setup suggested with the kiwi-pxeboot package is used all
initrd files reside in /var/lib/tftpboot/boot/ . However, because the TFTP
server does a change root ( chroot /var/lib/tftpboot ) you need to
specify the initrd file as in the following example:
KIWI_INITRD=/boot/name-of-initrd-file
KIWI_KERNEL
https://doc.opensuse.org/projects/kiwi/doc/
83/148
9/23/2016
openSUSEKIWIImageSystem
KIWI_KERNEL
Specifies the Kernel to be used for a local boot of the system The same path
rules as described for KIWI_INITRD apply for the kernel setup:
KIWI_KERNEL=/boot/name-of-kernel-file
KIWI_KERNEL_OPTIONS
Specifies additional command line options to be passed to the Kernel when
booting from disk. For instance, to enable a splash screen, you might use
KIWI_KERNEL_OPTIONS="vga=0x317 splash=silent"
NBDROOT
Mount the system image root file system remotely via NBD (Network Block
Device). This requires a server which exports the root directory of the system
image via a specified export name. The Kernel provides the block layer,
together with a remote port that uses the nbd-server program. For more
information on how to set up the server, see man 1 nbd-server . The Kernel
on the remote client can set up a special network block device named
/dev/nb0 using the nbd-client command. After this device exists, the mount
program is used to mount the root file system. To allow the KIWI boot image to
use that, the following information must be provided:
NBDROOT=NBD.Server.IP.address;\
NBD-Export-Name;/dev/NBD-Device;\
NBD-Swap-Export-Name;/dev/NBD-Swap-Device;\
NBD-Write-Export-Name;/dev/NBD-Write-Device
The server IP and the export name are mandatory parameters, all other
parameters are optional. The default device names are:
NBD-Device: /dev/nbd0 ,
NBD-Swap-Device: /dev/nbd1
NBD-Write-Device: /dev/ram1
Defining a swap device is optional. It is only set up if the client has less than 48
MB of RAM. The optional NBD-Write-Export-Name and NBD-Write-Device
define a write copy-on-write (COW) location for the root file system. A separate
write device is only used together with a union setup based on, for example,
overlayfs.
NFSROOT
https://doc.opensuse.org/projects/kiwi/doc/
84/148
9/23/2016
openSUSEKIWIImageSystem
Mount the system image root file system remotely via NFS (Network File
System). This requires a server which exports the root file system of the
network client in such a way that the client can mount it read/write. To do that,
the boot image must know the server IP address and the path name where the
root directory exists on this server. The information must be provided like
follows:
NFSROOT=NFS.Server.IP.address;/path/to/root/tree
PART
Specifies the partitioning data. Comma-separated blocks contain size, partition
type and mount point:
PART='size;type;mountpoint,...,size;type;mountpoint'
RAID
https://doc.opensuse.org/projects/kiwi/doc/
85/148
9/23/2016
openSUSEKIWIImageSystem
In addition to the PART line it is also allowed to add a raid array setup. The first
parameter of the RAID line is the raid level. So far only raid1 (mirroring) is
supported. The second and third parameter specifies the raid disk devices
which make up the array. If a RAID line is present all partitions in PART will be
created as raid partitions. The first raid is named md0 the second one md1 and
so on. It is required to specify the correct raid partition in the IMAGE line
according to the PART setup. A typical raid image setup could look like this:
DISK=/dev/sda
RAID='1;/dev/sda;/dev/sdb'
IMAGE='/dev/md1;LimeJeOS-openSUSE-##.#.i686;1.11.3;192.168.100.2;4096'
PART='5;S;x,2000;L;/'
REBOOT_IMAGE
If set to a non-empty string, this will reboot the system after the initial
deployment process is done. This means the system is rebooted before the
system init process is activated. If the machine's default boot setup is to boot
via PXE it will again boot from the network.
RELOAD_CONFIG
If set to a non-empty string, this forces all configuration files to be loaded from
the server. The primary purpose of this setting is to aid debugging. The option
only applies to disk-based systems.
RELOAD_IMAGE
If set to a non-empty string, this forces the image to be loaded from the server
even if the image on the disk is up-to-date. The primary purpose of this setting
is to aid debugging. The option only applies to disk-based systems.
UNIONFS_CONFIG
Netboot images may use overlayfs as a container file system in combination
with a compressed system image. The recommended compressed file system
type for the system image is overlayfs.
UNIONFS_CONFIG=/dev/sda2,/dev/sda3,overlayfs
In this example the first device /dev/sda2 represents the read/write file
system and the second device /dev/sda3 represents the compressed system
image file system.
The union file system overlayfs is then used to cover the read/write layer with
the read-only device to one read/write file system. If a file on the read-only
device is going to be written, the changed inodes are part of the read/write file
system. Note the device specifications in UNIONFS_CONFIG must correspond
to the IMAGE and PART information. The following example should explain
the interconnections:
https://doc.opensuse.org/projects/kiwi/doc/
86/148
9/23/2016
openSUSEKIWIImageSystem
DISK=/dev/sda
IMAGE='/dev/sda3;image/myImage;1.1.1;192.168.1.1;4096'
PART='200;S;x,300;L;/,x;L;x'
UNIONFS_CONFIG=/dev/sda2,/dev/sda3,overlayfs
As the second element of the PART list must define the root partition it is
absolutely important that the first device in UNIONFS_CONFIG matches this
device as read/write device. The second device of UNIONFS_CONFIG needs to
match the given IMAGE device name.
https://doc.opensuse.org/projects/kiwi/doc/
87/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
88/148
9/23/2016
openSUSEKIWIImageSystem
EXAMPLE 11.3: MOUNT COMPRESSED IMAGE FROM REMOTE, WRITE TO LOCAL STORAGE
Depending on whether the remote image is served via AoE, NBD, or NFS, the
configuration differs:
AoE
PART='5;S;x,x;L;x'
AOEROOT=/dev/etherd/e0.1,/dev/sda2
UNIONFS_CONFIG=/dev/sda2,aoe,overlayfs
NBD
PART='5;S;x,x;L;x'
NBDROOT=192.168.100.7;root1;/dev/nbd0;;;;/dev/sda2
UNIONFS_CONFIG=/dev/sda2,nbd,overlayfs
NFS
PART='5;S;x,x;L;x'
NFSROOT="192.168.100.2;/srv/kiwi-read-only-path"
UNIONFS_CONFIG=/dev/sda2,nfs,overlayfs
Depending on whether the remote image is served via AoE, NBD, or NFS, the
configuration differs:
AoE
AOEROOT=/dev/etherd/e0.1
UNIONFS_CONFIG=tmpfs,aoe,overlayfs
NBD
NBDROOT=192.168.100.7;root1;/dev/nbd0
UNIONFS_CONFIG=tmpfs,nbd,overlayfs
https://doc.opensuse.org/projects/kiwi/doc/
89/148
9/23/2016
openSUSEKIWIImageSystem
NFS
NFSROOT="192.168.100.2;/srv/kiwi-read-only-path"
UNIONFS_CONFIG=tmpfs,nfs,overlayfs
AoE
AOEROOT=/dev/etherd/e0.1,/dev/etherd/e1.1
UNIONFS_CONFIG=aoe,aoe,overlayfs
NBD
NBDROOT=192.168.100.7;root1;/dev/nbd0;swap1;/dev/nbd1;write1;/dev/nbd2
UNIONFS_CONFIG=nbd,nbd,overlayfs
NFS
NFSROOT="192.168.100.2;/srv/kiwi-read-only-path"
UNIONFS_CONFIG=/srv/kiwi-read-write-path,nfs,overlayfs
https://doc.opensuse.org/projects/kiwi/doc/
90/148
9/23/2016
openSUSEKIWIImageSystem
<type fsreadonly="squashfs"
image="split" fsreadwrite="ext3" boot="netboot/suse-..."/>
<split>
<temporary>
<!-- allow RAM read/write access to: -->
<file name="/mnt"/>
<file name="/mnt/*"/>
</temporary>
<persistent>
<!-- allow DISK read/write access to: -->
<file name="/var"/>
<file name="/var/*"/>
<file name="/boot"/>
<file name="/boot/*"/>
<file name="/etc"/>
<file name="/etc/*"/>
<file name="/home"/>
<file name="/home/*"/>
</persistent>
</split>
...
</type>
Use the vbladed command on the remote server to bind a block device to an
Ethernet interface. The block device can be a disk partition or a loop device
(losetup) but not a directory. For example:
vbladed 0 1 eth0 blockdevice
Create a config. MAC pointing to the exported AoE device. For the example
above, this would be:
AOEROOT=/dev/etherd/e0.1
https://doc.opensuse.org/projects/kiwi/doc/
91/148
9/23/2016
openSUSEKIWIImageSystem
Export the KIWI prepared tree on the NBD server and use a config. MAC file
similar to the following example:
NBDROOT=192.168.100.7;root1;/dev/nbd0
Export the KIWI prepared tree via NFS and use a config. MAC file similar to
the following example:
NFSROOT=192.168.100.7;/tmp/kiwi.nfsroot
https://doc.opensuse.org/projects/kiwi/doc/
92/148
9/23/2016
openSUSEKIWIImageSystem
group1_KIWI_MAC_LIST="11:11:11:11:11:11, 00:11:00:11:22:CA"
"group2_KIWI_MAC_LIST="00:22:00:44:00:4D, 99:3F:21:A2:F4:32"
"group3_KIWI_MAC_LIST="00:54:33:FA:44:33, 84:3D:45:2F:5F:33"
GROUP_NAME_KIWI_MAC_LIST
This parameter is used to assign MAC addresses to the groups defined with
KIWI_GROUP . The name of this parameter depends on the group it represents.
In our example the groups group1, group2, group3 are defined, so the
corresponding parameters are:
group1_KIWI_MAC_LIST
group2_KIWI_MAC_LIST
group3_KIWI_MAC_LIST
These parameters contain a comma-separated list of MAC addresses that
should be assigned to the specified group. MAC addresses always need to be
specified with uppercase letters, otherwise they will not match. If the list of
addresses is very long (several thousand entries), the client's boot process my
be slowed down.
https://doc.opensuse.org/projects/kiwi/doc/
93/148
9/23/2016
openSUSEKIWIImageSystem
/srv/tftpboot/KIWI/config.group1
/srv/tftpboot/KIWI/config.group2
/srv/tftpboot/KIWI/config.group3
https://doc.opensuse.org/projects/kiwi/doc/
94/148
9/23/2016
openSUSEKIWIImageSystem
This element follows the same rules as defined by the KIWI_GROUP element.
However, this variable will create sub-groups used to ensure multiple types of
hardware vendors can be used within the same group. The name of the
group(s) should be clearly defined, and a good convention to follow would be to
use a combination of the vendor name with the model number or type. This
would allow for cases where the same vendor is used, but differences between
alternative models requires different maps to be used.
HARDWARE_MAP="myvendor_foo1000 myvendor_foo2000"
HARDWARE_MAP_NAME_HARDWARE_MAP
This element behaves identical to the GROUP_NAME _KIWI_MAC_LIST element. It
lists all MAC addresses that need to be linked to a hardware map. Any host
defined within the list will receive configuration files that have been specifically
defined in a hardware_config. HARDWARE_MAP file (in addition to any files
defined within a CONF element).
myvendor_foo1000_HARDWARE_MAP="11:11:11:11:11:11"
myvendor_foo2000_HARDWARE_MAP="00:11:00:11:22:CA"
VENDOR_CONF='CONFIGURATIONS/xorg.conf.hardware_name_model;/etc/X11/xorg.conf;192.168.100.
The format of the VENDOR_CONF values is identical to the CONF variable used in
the standard host and group configurations (see Section 11.3, The PXE Client
Configuration File Syntax). In addition, files defined within this list will over-write
any files defined in the group configuration, if and only if, the following
requirements are met:
The host is assigned to the current hardware map
The file is defined within the CONF and VENDOR_CONF elements
NOTE: If a file is not defined in the CONF element, but is defined in the
VENDOR_CONF element, it is simply downloaded to the host as if it was a CONF file.
In this case, no overwriting will take place as it is considered a new file.
https://doc.opensuse.org/projects/kiwi/doc/
95/148
9/23/2016
openSUSEKIWIImageSystem
KIWI_INITRD=/boot/initrd
KIWI_KERNEL=/boot/linux
DISK=/dev/sda
PART='5;S;x,769;L;/,x;L;x'
IMAGE='/dev/sda2;exmaple-kiosk-opensuse-##.#-pxe-client.i686;0.0.1;192.168.1.2;4096'
UNIONFS_CONFIG=/dev/sda3,/dev/sda2,overlayfs
RELOAD_IMAGE=yes
RELOAD_CONFIG=yes
CONF='prefs.js;/home/kioskuser/.mozilla/firefox/07xvl1ty.default/prefs.js;192.168.1.2;4
xorg.conf;/etc/X11/xorg.conf;192.168.1.2;4096' 1
HARDWARE_MAP='myvendor_foo2000' 2
myvendor_foo2000_HARDWARE_MAP='00:00:00:00:00:02 00:00:00:00:00:03 00:00:00:00:00:04'
https://doc.opensuse.org/projects/kiwi/doc/
96/148
9/23/2016
openSUSEKIWIImageSystem
The first seven lines define a standard KIWI configuration, while the last three
lines set up a hardware-specific configuration.
Specifies two default configuration files that will be copied to all clients
defined in this group: prefs.js (for Mozilla Firefox), and xorg.conf
(for X Window).
2 Defines the hardware map(s) ( myvendor_foo2000 in this case) that are
to be used to provide overrides for the configuration files defined in the
previous lines.
3 Defines the list of hosts (by MAC address) that will receive the
configuration file overrides (the three myvendor_foo2000 clients).
1
When the VENDOR_CONF definition is used, we are telling KIWI that all files
defined within this element, are specific to the hardware map they are linked
to. As a result, all files listed here will be transferred to a host if, and only if, the
host has been linked to the hardware map via the
myvendor_foo2000_HARDWARE_MAP element. In our example the only
systems that will receive the xorg.conf.myvendor_foo2000 file will be the three
myvendor_foo2000 thin clients listed in the hardware map itself.
In this VENDOR_CONF element, two files are defined. An override xorg.conf
file and an additional file called someconfig.cfg .
xorg.conf.myvendor_foo2000 will overwrite the xorg.conf file that was
previously transferred via the CONF element. In addition to that,
someconfig.cfg will be copied to the three myvendor_foo2000 thin clients.
As a result of this example, all ten thin clients will receive the prefs.js file
defined in CONF . The seven myvendor_foo1000 clients will receive the xorg.conf
defined in CONF , while the three myvendor_foo2000 clients will receive the specific
xorg.conf defined in VENDOR_CONF . The myvendor_foo2000 clients will also get
the file someconfig.cfg .
https://doc.opensuse.org/projects/kiwi/doc/
97/148
9/23/2016
openSUSEKIWIImageSystem
An OEM image is a virtual disk image representing all partitions and boot loader
information the same way as on a physical disk. All flavors discussed previously in
Chapter 8, VMX Image / Virtual Disks also apply to the OEM image type. Compared to
the VMX image type, an OEM image comes with additional features. It can expand
itself to a custom disk geometry and KIWI can create installation images which
embeds the OEM image for deployment from CD/DVD/Stick and over the network
via PXE.
The basic idea behind an OEM image is to provide the virtual disk data for OEM
vendors to support easy deployment of the system to physical storage media.
Tip: OEM Image Description Templates
KIWI comes with many image description templates. It is recommended to use
them as a basis for your own image descriptions. To do so, copy the respective
directory containing the image description of your choice to you working
directory and adjust it according to your needs.
OEM image templates are shipped with the package kiwi-desc-oemboot .
They are installed to /usr/share/kiwi/image/oemboot .
https://doc.opensuse.org/projects/kiwi/doc/
98/148
9/23/2016
openSUSEKIWIImageSystem
Alternatively, use the dd command to dump the image onto a spare hard disk or a
flash disk (this will wipe all existing data on the target device). To boot the image,
select the appropriate device for booting device in the BIOS/EFI.
cd /tmp/myoem-result
dd if=LimeJeOS-SLE12.x86_64-1.13.1.raw of=/dev/device
Note, when testing an OEM image using the virtual disk image, for example the
.raw file, the geometry of the disk image is not changed and therefore retains the
disk geometry of the host system. This implies that the re-partitioning performed
for a physical disk install during the OEM boot workflow will be skipped.
https://doc.opensuse.org/projects/kiwi/doc/
99/148
9/23/2016
openSUSEKIWIImageSystem
The installation image can also be tested using virtualization software. Note that
the hard disk will be re-partitioned in this case. The following example uses qemu
for testing. A virtual hard disk is created with qemu-img prior to starting the
image.
cd /tmp/myoem-result
qemu-img create /tmp/mydisk 20G
qemu -hda /tmp/mydisk -cdrom LimeJeOS-SLE12.x86_64-1.13.1.iso -boot d
installstick
Creates a .raw.install file which can be dumped ( dd ) onto a flash disk.
Use this format if your machine cannot boot from a hybrid image.
<image ...>
<preferences>
...
https://doc.opensuse.org/projects/kiwi/doc/
100/148
9/23/2016
openSUSEKIWIImageSystem
...
<type image="name" installstick="true" ....>
...
</type>
</preferences>
...
</image ...>
https://doc.opensuse.org/projects/kiwi/doc/
101/148
9/23/2016
openSUSEKIWIImageSystem
...
<type image="oem" ....>
<oemconfig>
<oem-.../>
</oemconfig>
...
</type>
</preferences>
...
</image ...>
https://doc.opensuse.org/projects/kiwi/doc/
102/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
103/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
104/148
9/23/2016
openSUSEKIWIImageSystem
The default installation method of an OEM image is to dump the entire virtual disk
onto the target disk and to re-partition the disk to match the real geometry. All data
that was previously stored on the disk will be erased.
Alternatively KIWI supports the installation into already existing partitions. This
requires to set up empty (no file system) partitions prior to deploying the image.
This way already existing data will not be touched. To activate the partition based
install mode the following option needs to be set in config.xml :
<image ...>
<preferences>
...
<type image="oem" ....>
<oemconfig>
<oem-partition-install>true</oem-partition-install>
</oemconfig>
...
</type>
</preferences>
...
</image ...>
With a partition-based installation, the setup differs from the default, disk-based
installation in the following ways:
The boot loader will be set up to boot the installed system only. If a multiboot setup is required, it needs to be manually configured by the user after
the initial boot.
The parameter oem-home* , oem-swap* , and oem-systemsize for
system, swap and home are ignored. In this mode KIWI will not create
additional partitions. If a swap partition exists, it will automatically be used,
if not, a swap-file will be created.
There is no support for a remote (PXE) OEM installation, because KIWI
needss to loop-mount the disk image and need to address specific regions
inside of the image. Such operations are not implemented for remote
access
https://doc.opensuse.org/projects/kiwi/doc/
105/148
9/23/2016
openSUSEKIWIImageSystem
Instead of manually dumping the OEM image on the target device or creating a
KIWI installation CD or flash disk, the image can alternatively be downloaded from a
PXE boot server over the network. This requires a PXE network boot server to be
setup as explained in Chapter 11, PXE Image / Thin Clients. If your PXE server is
running the following steps are required to set up the installation process over the
network:
1. Make sure to create an installation PXE TAR archive along with your OEM
image by setting the following option in configuration.xml :
<image ...>
<preferences>
...
<type image="oem" installpxe="true"....>
...
</type>
</preferences>
...
</image ...>
3. Also copy the system image and the md5 sum to the PXE boot server:
scp IMAGE_FILE.xz PXE_SERVER_IP:/srv/tftpboot/image/
scp IMAGE_FILE.md5 PXE_SERVER_IP:/srv/tftpboot/image/
https://doc.opensuse.org/projects/kiwi/doc/
106/148
9/23/2016
openSUSEKIWIImageSystem
A Xen image is a virtual disk like a vmx but with the Xen kernel installed for dom0 or
para virtual guest images. For fully virtualized guest images any Kernel, for example
kernel-default , my be used together with the Xen kernel modules.
A Xen image can only be booted on a Xen dom0 server. A Xen guest is booted via a
boot infrastructure. For paravirtual images pyGrub or pvGrub can be used, while
for HVM (fully virtualized) a special hvmloader is used. Xen extracts boot
information from the given image and boots the guest. Depending on the guest
type, also the boot loader configuration needs to be read. This puts some
constraints on the configuration which are addressed by KIWI.
Tip: Xen Image Description Templates
KIWI comes with many image description templates. It is recommended to use
them as a basis for your own image descriptions. To do so, copy the respective
directory containing the image description of your choice to you working
directory and adjust it according to your needs.
There are no special templates for Xen images. You may either use OEM or VMX
image templates. OEM image templates are shipped with the package
kiwi-desc-oemboot . They are installed to
/usr/share/kiwi/image/oemboot . VMX image templates are shipped with
the package kiwi-desc-vmxboot . They are installed to
/usr/share/kiwi/image/vmxboot .
https://doc.opensuse.org/projects/kiwi/doc/
107/148
9/23/2016
openSUSEKIWIImageSystem
When booted mydom0 is a Xen dom0 from which other Xen guests can be started.
https://doc.opensuse.org/projects/kiwi/doc/
108/148
9/23/2016
openSUSEKIWIImageSystem
The following example shows how to build a Just enough Operating System (JeOS)
based on SUSE Linux Enterprise 12. Contrary to the paravirtual guest image this
example builds a simple vmx image including the standard kernel plus some kernel
modules required by Xen. To boot such a guest, a hvmloader machine configuration
must be provided.
kiwi --build suse-SLE12-JeOS -d /tmp/myvmx-result --type vmx \
--add-profile xenFlavourHVM
For paravirtual guest images KIWI supports the creation of the configuration file
according to information provided with the machine element of the KIWI
configuration file config.xml :
<image ...>
<preferences ...<
<machine memory="512" domain="domU">
<vmdisk id="0" device="/dev/xvda" controller="ide"/>
<vmnic interface=""/>
</machine>
...
</preferences>
...
</image>
If this information exists, KIWI creates a file with the extension .xenconfig . Note
that not all possible configuration options are supported by the KIWI Xen
configuration file creator. For fully virtualized images there is currently no support
to create the configuration from KIWI. However tools like virt-manager support
you setting up the machine configuration. Refer to the SUSE Linux Enterprise
Virtualization Guide (https://www.suse.com/documentation/sles12/book_virt/data/book_virt.html) or the Xen Documentation
(http://www.xenproject.org/help/documentation.html) for more information.
https://doc.opensuse.org/projects/kiwi/doc/
109/148
9/23/2016
openSUSEKIWIImageSystem
14 Creating Appliances
14.1 The KIWI Model
https://doc.opensuse.org/projects/kiwi/doc/
110/148
9/23/2016
openSUSEKIWIImageSystem
5. Transfer the image generated in the previous step to the flash disk. Note
that all data on the disk will be erased!
dd if=PATH_TO_ISO_IMAGE
of=FLASH_DISK_DEVICE bs=4M
6. Plug the flash disk into your test machine and boot it from the disk
containing the appliance.
7. After your test system has successfully booted the image, log in to your
appliance and start to tweak the system according to your needs. This
includes all actions required to configure the appliance as needed. Before
you start take care for the following:
a. Create an initial package list. This can be done by calling:
rpm -qa | sort > /tmp/deployPackages
https://doc.opensuse.org/projects/kiwi/doc/
111/148
9/23/2016
openSUSEKIWIImageSystem
b. Check the output of the command git status and add all files
matching the following criteria to /.gitignore :
the file is not yet part of the repository
you do not plan to change the file
the file will not be included by one of the image description
overlay files
When the initial package list exist and the git repository is set up, you can
start to configure the system.
Important: Installing Additional Software
Do not add additional software by installing a package being part of a
repository not listed in configuration.xml or by compiling it from
the sources. It is very hard to find out what binary files have been
installed that way and it is also not architecture-safe.
If there is really no other way for the software to become part of the
image, you should address this issue directly in your image description
and the config.sh script, but not after the initial deployment has
happened.
8. As soon as the appliance on your test system works as expected it is ready
to enter the final stage. At this point you have done several changes to the
system which are tracked by the git repository and the package list. To
include them into your image description, use the following process:
a. Check the differences between the currently installed packages and
the initial deployment list. This can be done by running:
rpm -qa | sort > /tmp/appliancePackages
diff -u /tmp/deployPackages /tmp/appliancePackages
https://doc.opensuse.org/projects/kiwi/doc/
112/148
9/23/2016
openSUSEKIWIImageSystem
c. Check for new non binary files that have been added. This can be
done by calling:
git status
All files not yet tracked, will be listed under Untracked files .
Make sure to add all files from this list which are not created
automatically to your image description. To do this, clone (copy) these
files with regards to the file system structure as overlay files in your
image description root/ directory.
9. All customization work you did within your appliance is now stored in the
image description. The image description you created can be re-used for all
image types supported by KIWI.
To make sure the appliance works as expected prepare a new image tree and
create an image from the new tree. You may optionally disable the creation of the
git repository within this new image tree to save disk space. If this appliance is a
server, you should keep it, because it allows you to keep track of changes during
the live time of this appliance.
Important: Cross Platform Appliance Building
Building appliances for a specific processor architecture on a different processor
architecture is in generally not possible with KIWI. This limitation is based on the
requirement that KIWI needs to be able to execute installed software inside the
unpacked image tree. If the software installed inside the unpacked image tree
does not run on the architecture of the build platform then KIWI cannot build
the appliance. The only exception is building 32-bit x86 appliances on a 64-bit
x86-64 architecture.
KIWI's option --target-arch is not intended to support cross-platform
appliance builds. It rather tells the package manager to install packages for the
specified architecture.
https://doc.opensuse.org/projects/kiwi/doc/
113/148
9/23/2016
openSUSEKIWIImageSystem
15 System Analysis/Migration
KIWI provides a module which allows you to analyze the running system for
creating a report and an image description representing the current state of the
machine. Among others, this allows you to clone your currently running system into
an image. The process has the following limitations at the moment:
Works for SUSE systems only (with zypper on board)
The process works semi-automaticallydepending on the complexity of the
system, some manual postprocessing might be necessary
When calling KIWI's analysis module it tries to find the base version of your
operating system by using the active repositories specified in the zypper database
to identify the software packages currently installed. The result is a list of packages
and patterns representing your system. Files not belonging to any packages, such
as user data or configuration files, are provided as custom data by KIWI. In addition,
KIWI offers different data visualization e.g unmanaged binary data. Along with the
software analysis, KIWI also checks for enabled systemd services, augeas
configuration inventory and more. The process will not go beyond the scope of
local file systems.
To create an image of your running system, proceed as follows:
1. Create a report listing all packages and repositories currently installed by
running
sudo kiwi --describe workstation
https://doc.opensuse.org/projects/kiwi/doc/
114/148
9/23/2016
openSUSEKIWIImageSystem
2. Check the result of the previous step for packages that cannot be assigned
to a repository. If you do not need these packages within your image,
proceed with the next step. If you want them to be in the image, either add
the repositories containing these packages to your system (for example
with zypper addrepo ) and run the previous command again.
Alternatively, tell KIWI which additional repos to check, by using the
previous command together with the --add-repo and
--add-repotype options (refer to man 1 kiwi for more information).
3. Rerun the report generating command. List all packages that are not part of
a repository or should not be included with the --skip parameter. In case
you have previously used the --add-repo and --add-repotype
options, use them again with this command:
kiwi --describe workstation --nofiles \
--skip "LIST_OF_PAKAGES" \
--add-repo REPO --add-repotype TYPE
https://doc.opensuse.org/projects/kiwi/doc/
115/148
9/23/2016
openSUSEKIWIImageSystem
6. Check the size of the image description. It's good practice to keep the
image as small as possible. The size of a migrated image description mainly
depends on how many overlay files exists in the root/ directory. You
should make sure to maintain only required overlay files.
7. Create an image from the description. By default an OEM image, containing
a virtual disk that can also be deployed to a physical machine, is created. In
addition to that, an ISO image containing an installable version of the
image, is also generated. Refer to Chapter 12, OEM Image / Preload Systems
for details.
kiwi --build /var/cache/kiwi/describe/workstation -d /tmp/myResult
The following pages will show you the man page of KIWI and the functions which
can be used within config.sh and index.sh
Name
kiwi Creating Operating System Images
Synopsis
kiwi { -l | --list }
https://doc.opensuse.org/projects/kiwi/doc/
116/148
9/23/2016
openSUSEKIWIImageSystem
Basics
KIWI is a complete imaging solution that is based on an image description. Such a
description is represented by a directory which includes at least one config.xml
file and may as well include other files like scripts or configuration data. The
kiwi-templates package provides example descriptions based on a JeOS
system. JeOS means Just enough Operating System. KIWI provides image templates
based on that axiom which means a JeOS is a small, text only based image including
a predefined remote source setup to allow installation of missing software
components at a later point in time.
Detailed description of the kiwi image system exists in the system design document
in file:///usr/share/doc/packages/kiwi/kiwi.pdf. KIWI always operates in two steps.
The KIWI --build option just combines both steps into one to make it easier to
start with KIWI. The first step is the preparation step and if that step was successful,
a creation step follows which can create different image output types. If you have
started with an example and want to add you own changes it might be a good idea
to clone of from this example. This can be done by simply copying the entire image
description or you can let KIWI do that for you by using the kiwi --clone
command.
In the preparation step, you prepare a directory including the contents of your new
file system based on one or more software package source(s) The creation step is
based on the result of the preparation step and uses the contents of the new image
root tree to create the output image. If the image type ISO was requested, the
output image would be a file with the suffix .iso representing a live system on CD
or DVD. Other than that KIWI can create images for virtual and para-virtual (Xen)
environments as well as for USB stick, PXE network clients and OEM customized
Linux systems.
General Options
[ -h | --help ]
Display help.
[ --version ]
Display the KIWI version.
[ --check-config path-to-the-configuration-file ]
Checks the XML configuration file.
https://doc.opensuse.org/projects/kiwi/doc/
117/148
9/23/2016
openSUSEKIWIImageSystem
[ --nocolor ]
Do not use colored output.
Image Upgrade
If the image root tree is stored and not removed, it can be used for upgrading the
image according to the changes made in the repositories used for this image. If a
distributor provides an update channel for package updates and an image
config.xml includes this update channel as repository, it is useful to store the
image root tree and upgrade the tree according to changes on the update channel.
Given that the root tree exists it's also possible to add or remove software and
recreate the image of the desired type.
kiwi { -u | --upgrade } image-root [--add-package name ] [--add-pattern name
]
System Analysis
KIWI provides a module which allows you to analyze the running system and create
a report and an image description representing the current state of the machine.
Among others this allows you to clone your currently running system into an image.
The system requires the zypper back-end in order to work properly.
The process will always place it's result into the
/tmp/$OptionValueOf--describe directory. The reason for this is because
/tmp is always excluded from the analysis and therefore we can safely place new
files there without influencing the process itself. You should have at least 100 MB
free space for the cache file and the image description all the rest are just hard
links.
https://doc.opensuse.org/projects/kiwi/doc/
118/148
9/23/2016
openSUSEKIWIImageSystem
As one result a HTML based report file is created which contains important
information about the system. You are free to ignore that information but with the
risk that the image from that description does not represent the same system
which is running at the moment. The less issues left in the report the better is the
result. In most cases a manual fine tuning is required. This includes the repository
selection and the unmanaged files along with the configuration details of your
currently running operating system. You should understand the module as a helper
to analyze running linux systems.
kiwi { --describe } name
Helper Tools
The helper tools provide optional functions like creating an encrypted password
string for the users section of the config.xml file as well as signing the image
description with an md5sum hash and adding splash data to the boot image used
by the boot loader.
https://doc.opensuse.org/projects/kiwi/doc/
119/148
9/23/2016
openSUSEKIWIImageSystem
kiwi --createpassword
kiwi --createhash image-path
kiwi { -i | --info } ImagePath {--select
repopatterns|patterns|types|sources|size|profiles|packages|version
}
kiwi --setup-splash initrd
The following list describes the helper tools more detailed
[ --createpassword ]
Create a crypted password hash and prints it on the console. The user can use
the string as value for the pwd attribute in the XML users section
[ --createhash image-path ]
Sign your image description with a md5sum. The result is written to a file
named .checksum.md and is checked if KIWI creates an image from this
description.
[ -i | --info image-path --select selection ]
List general information about the image description. So far you can get
information about the available patterns in the configured repositories with
repo-patterns , a list of used patterns for this image with patterns , a list
of supported image types with types , a list of source URLs with sources , an
estimation about the install size and the size of the packages marked as to be
deleted with size , a list of profiles with profiles , a list of solved packages
to become installed with packages , and the information about the appliance
name and version with version
[ --setup-splash initrd ]
Create splash screen from the data inside the initrd and re-create the initrd
with the splash screen attached to the initrd cpio archive. This enables the
kernel to load the splash screen at boot time. If splashy is used only a link to
the original initrd will be created
Global Options
[ --add-profile profile-name ]
Use the specified profile. A profile is a part of the XML image description and
therefore can enhance each section with additional information. For example
adding packages.
https://doc.opensuse.org/projects/kiwi/doc/
120/148
9/23/2016
openSUSEKIWIImageSystem
[ --set-repo URL ]
Set/Overwrite the repo URL for the first repo listed in the configuration file that
does not have a "fixed" status. The change is temporary and will not be written
to the XML file.
[ --set-repotype type ]
Set/Overwrite repo type for the first listed repo. The supported repo types
depends on the package manager. Commonly supported are rpm-md, rpm-dir
and yast2. The change is temporary and will not be written to the XML file.
[ --set-repoalias name ]
Set/Overwrite alias name for the first listed repo. Alias names are optional free
form text. If not set the source attribute value is used and builds the alias name
by replacing each / with a _. An alias name should be set if the source
argument doesn't really explain what this repository contains. The change is
temporary and will not be written to the XML file.
[ --set-repoprio number ]
Set/Overwrite priority for the first listed repo. Works with the smart package
manager only. The Channel priority assigned to all packages available in this
channel (0 if not set). If the exact same package is available in more than one
channel, the highest priority is used.
[ --add-repo URL , --add-repotype type --add-repoalias name
--add-repoprio number ]
Add the given repository and type for this run of an image prepare or upgrade
process. Multiple --add-repo / --add-repotype options are possible. The
change will not be written to the config.xml file
[ --ignore-repos ]
Ignore all repositories specified so far, in XML or elsewhere. This option should
be used in conjunction with subsequent calls to --add-repo to specify
repositories at the command line that override previous specifications.
[ --logfile Filename | terminal ]
Write to the log file Filename instead of the terminal.
[ --gzip-cmd cmd ]
Specify an alternate command to run when compressing boot and system
images. Command must accept gzip options.
[ --package-manager smart|zypper ]
Set the package manager to use for this image. If set it will temporarily
overwrite the value set in the xml description.
https://doc.opensuse.org/projects/kiwi/doc/
121/148
9/23/2016
openSUSEKIWIImageSystem
[ -A | --target-arch i586|x86_64|armv5tel|ppc ]
Set a special target-architecture. This overrides the used architecture for the
image-packages in zypp.conf . When used with smart this option doesn't
have any effect.
[ --disk-start-sector number ]
The start sector value for virtual disk based images. The default is 2048. For
newer disks including SSD this is a reasonable default. In order to use the old
style disk layout the value can be set to 32.
[ --disk-sector-size number ]
Overwrite the default 512 byte sector size value. This will influence the partition
alignment.
[ --disk-alignment number ]
Align the start of each partition to the specified value. By default 4096 bytes are
used.
[ --debug ]
Prints a stack trace in case of internal errors
[ --verbose 1|2|3 ]
Controls the verbosity level for the instsource module
[ -y | --yes ]
Answer any interactive questions with yes
[ --create-instsource path-to-config.xml ]
Using this option, it is possible to create a valid installation repository from
blank RPM file trees. The created tree can be used directly for the image
creation process afterwards.
[ --bundle-build ]
This option bundles the build results to be suitable for publishing it in the Build
Service. It allows adding a build-number in combination with the
--bundle-id option as well as a SHA key to the results. It also removes
intermediate build results not relevant for users if they don't want to rebuild
the image.
[ --bundle-id build-number ]
The build-number/string in combination with --bundle-build
https://doc.opensuse.org/projects/kiwi/doc/
122/148
9/23/2016
openSUSEKIWIImageSystem
[ -r | --root RootPath ]
Set up the physical extend, chroot system below the given root-path path. If no
--root option is given, KIWI will search for the attribute defaultroot in
config.xml . If no root directory is known, a mktemp directory will be created
and used as root directory.
[ --force-new-root ]
Force creation of new root directory. If the directory already exists, it is deleted.
https://doc.opensuse.org/projects/kiwi/doc/
123/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
124/148
9/23/2016
openSUSEKIWIImageSystem
[ --fs-journalsize number ]
When calling KIWI in creation mode this option will set the journal size in mega
bytes for ext[23] based file systems and in blocks if the Reiser file system is
used
[ --fs-inodesize number ]
When calling KIWI in creation mode this option will set the inode size in bytes.
This option has no effect if the Reiser file system is used
[ --fs-inoderatio number ]
Set the bytes/inode ratio. This option has no effect if the Reiser file system is
used
[ --fs-max-mount-count number ]
When calling kiwi in creation mode this option will set the number of mounts
after which the file system will be checked. Set to 0 to disable checks. This
option applies only to ext[234] file systems.
[ --fs-check-interval number ]
When calling kiwi in creation mode this option will set the maximal time
between two file system checks. Set to 0 to disable time-dependent checks.
This option applies only to ext[234] file systems.
[ --fat-storage size in MB ]
if the syslinux boatload is used this option allows to specify the size of the fat
partition. This is useful if the fat space is not only used for booting the system
but also for custom data. Therefore this option makes sense when building a
USB stick image (image type: usb or oem)
[ --partitioner parted|fdasd ]
Select the tool to create partition tables. Supported are parted and fdasd
(s390). By default parted is used
[ --check-kernel ]
Activates check for matching kernels between boot and system image. The
kernel check also tries to fix the boot image if no matching kernel was found.
[ --mbrid number ]
Specifies a custom mbrid. The number value is treated as decimal number
which is internally translated into a 4byte hex value. The allowed range
therefore is from 0x0 to max 0xffffffff. By default kiwi creates a random value
[ --edit-bootconfig script ]
https://doc.opensuse.org/projects/kiwi/doc/
125/148
9/23/2016
openSUSEKIWIImageSystem
Specifies the location of a custom script which is called right before the boot
loader is installed. This allows to modify the boot loader configuration file
written by kiwi. The scripts working directory is the one which represents the
image structure including the boot loader configuration files. Please have in
mind that according to the image type, architecture and boot loader type the
files/directory structure and also the name of the boot loader configuration
files might be different.
[ --edit-bootinstall script ]
Specifies the location of a custom script which is called right after the boot
loader is installed.
[ --archive-image ]
When calling kiwi --create this option allows to pack the build result(s) into a
tar archive.
[ --targetdevice device ]
Use an alternative block device instead of the loop device. The given location
must be a block device node, not a symlink or other linux device node type.
Name
KIWI::config.sh Customization File for KIWI image description
https://doc.opensuse.org/projects/kiwi/doc/
126/148
9/23/2016
openSUSEKIWIImageSystem
Description
The KIWI image description allows to have an optional config.sh bash script in
place. It can be used for changes appropriate for all images to be created from a
given unpacked image (since config.sh runs prior to create step) Basically the script
should be designed to take over control of adding the image operating system
configuration. Configuration in that sense means all tasks which runs once in an os
installation process like activating services, creating configuration files, prepare an
environment for a firstboot workflow, etc. The config.sh script is called after the
following kiwi built in configuration tasks: User/Groups, copy of overlay root tree
and setup of AutoYaST If config.sh exits with an exit code != 0 the kiwi process
will exit with an error too.
EXAMPLE A.1: TEMPLATE FOR CONFIG.SH
#======================================
# Functions...
#-------------------------------------test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile
#======================================
# Greeting...
#-------------------------------------echo "Configure image: [$kiwi_iname]..."
#======================================
# Mount system filesystems
#-------------------------------------baseMount
#======================================
# Call configuration code/functions
#-------------------------------------...
#======================================
# Umount kernel filesystems
#-------------------------------------baseCleanMount
#======================================
# Exit safely
#-------------------------------------exit 0
Common functions
https://doc.opensuse.org/projects/kiwi/doc/
127/148
9/23/2016
openSUSEKIWIImageSystem
The .kconfig file allows to make use of a common set of functions. Functions
specific to SUSE Linux specific begin with the name suse. Functions applicable to all
linux systems starts with the name base. The following list describes the functions
available inside the config.sh script.
[baseCleanMount]
Umount the system filesystems /proc , /dev/pts , and /sys .
[baseDisableCtrlAltDel]
Disable the Ctrl Alt
Del
[baseGetPackagesForDeletion]
Return the name(s) of packages which will be deleted
[baseGetProfilesUsed]
Return the name(s) of profiles used to build this image
[baseSetRunlevel {value}]
Set the default run level
[baseSetupBoot]
Set up the linuxrc as init
[baseSetupBusyBox {-f}]
activates busybox if installed for all links from the busybox/busybox.links
fileyou can choose custom apps to be forced into busybox with the -f
option as first parameter, for example:
baseSetupBusyBox -f /bin/zcat /bin/vi
[baseSetupInPlaceGITRepository]
Create an in place git repository of the root directory. This process may take
some time and you may expect problems with binary data handling
[baseSetupInPlaceSVNRepository {path_list}]
Create an in place subversion repository for the specified directories. A
standard call could look like this baseSetupInPlaceSVNRepository /etc , /srv ,
and /var/log
[baseSetupPlainTextGITRepository]
Create an in place git repository of the root directory containing all plain/text
files.
[baseSetupUserPermissions]
https://doc.opensuse.org/projects/kiwi/doc/
128/148
9/23/2016
openSUSEKIWIImageSystem
Search all home directories of all users listed in /etc/passwd and change the
ownership of all files to belong to the correct user and group.
[baseStripAndKeep {list of info-files to keep}]
helper function for strip* functions read stdin lines of files to check for
removing params: files which should be keep
[baseStripDocs {list of docu names to keep}]
remove all documentation, except one given as parameter
[baseStripInfos {list of info-files to keep}]
remove all info files, except one given as parameter
[baseStripLocales {list of locales}]
remove all locales, except one given as parameter
[baseStripMans {list of manpages to keep}]
remove all manual pages, except one given as parameter example:
baseStripMans more less
[baseStripRPM]
remove rpms defined in config.xml in the image type=delete section
[suseRemovePackagesMarkedForDeletion]
remove rpms defined in config.xml in the image type=delete section. The
difference compared to baseStripRPM is that the suse variant checks if the
package is really installed prior to passing it to rpm to uninstall it. The suse rpm
exits with an error exit code while there are other rpm version which just ignore
if an uninstall request was set on a package which is not installed
[baseStripTools {list of toolpath} {list of tools}]
helper function for suseStripInitrd function params: toolpath, tools
[baseStripUnusedLibs]
remove libraries which are not directly linked against applications in the bin
directories
[baseUpdateSysConfig {filename} {variable} {value}]
update sysconfig variable contents
[Debug {message}]
Helper function to print a message if the variable DEBUG is set to 1
[Echo {echo commandline}]
Helper function to print a message to the controlling terminal
https://doc.opensuse.org/projects/kiwi/doc/
129/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
130/148
9/23/2016
openSUSEKIWIImageSystem
[suseStripPackager {-a}]
Remove smart or zypper packages and db files Also remove rpm package and
db if -a given
https://doc.opensuse.org/projects/kiwi/doc/
131/148
9/23/2016
openSUSEKIWIImageSystem
The basic image type. Can be a simply file system image type of ext2, ext3,
reiserfs, squashfs, cpio, or one of the following complex image types: iso, split,
usb, vmx, oem, xen, or pxe.
Name
KIWI::images.sh Customization File for KIWI image description
Description
The KIWI image description allows to have an optional images.sh bash script in
place. It can be used for changes appropriate for certain images/image types on
case-by-case basis (since it runs at beginning of create step) Basically the script
should be designed to take over control of handling image type specific tasks. For
example if building the oem type requires some additional package or config it can
be handled in images.sh. Please keep in mind there is only one unpacked root tree
the script operates in. This means all changes are permanent and will not be
automatically restored. It is also the script authors tasks to check if changes done
before do not interfere in a negative way if another image type is created from the
same unpacked image root tree If images.sh exits with an exit code != 0 the kiwi
process will exit with an error too.
EXAMPLE A.2: TEMPLATE FOR IMAGES.SH
#======================================
# Functions...
#-------------------------------------test -f /.kconfig && . /.kconfig
test -f /.profile && . /.profile
#======================================
# Greeting...
#-------------------------------------echo "Configure image: [$kiwi_iname]..."
#======================================
# Call configuration code/functions
#-------------------------------------...
#======================================
# Exit safely
#-------------------------------------exit
https://doc.opensuse.org/projects/kiwi/doc/
132/148
9/23/2016
openSUSEKIWIImageSystem
Common functions
The .kconfig file allows to make use of a common set of functions. Functions
specific to SUSE Linux specific begin with the name suse. Functions applicable to all
linux systems starts with the name base. The following list describes the functions
available inside the images.sh script.
[baseCleanMount]
Umount the system file systems /proc , /dev/pts , and /sys .
[baseGetProfilesUsed]
Return the name(s) of profiles used to build this image.
[baseGetPackagesForDeletion]
Return the list of packages setup in the packages type =" delete " section of
the config.xml used to build this image.
[suseGFXBoot {theme} {loadertype}]
This function requires the gfxboot and at least one bootsplash-theme-*
package to be installed to work correctly. The function creates from this
package data a graphics boot screen for the isolinux and grub boot loaders.
Additionally it creates the bootsplash files for the resolutions 800x600,
1024x768, and 1280x1024
[suseStripKernel]
This function removes all kernel drivers which are not listed in the *drivers
sections of the config.xml file.
[suseStripInitrd]
This function removes a whole bunch of tools binaries and libraries which are
not required to boot a suse system with KIWI.
[Rm {list of files}]
Helper function to delete files and announce it to log.
[Rpm {rpm commandline}]
Helper function to the rpm function and announce it to log.
[Echo {echo commandline}]
Helper function to print a message to the controlling terminal.
[Debug {message}]
Helper function to print a message if the variable DEBUG is set to 1.
https://doc.opensuse.org/projects/kiwi/doc/
133/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
134/148
9/23/2016
openSUSEKIWIImageSystem
Name
KIWI::kiwirc Resource file for the Kiwi imaging system
Description
The KIWI imaging tool chain supports the use of an optional resource file named
.kiwirc located in the users home directory.
The file is sourced by a Perl process and thus Perl compatible syntax for the
supported variable settings is required.
EXAMPLE A.3: TEMPLATE FOR .KIWI.RC
$BasePath='/usr/share/kiwi';
$Gzip='bzip2';
$LogServerPort='4455';
$System='/usr/share/kiwi/image';
https://doc.opensuse.org/projects/kiwi/doc/
135/148
9/23/2016
openSUSEKIWIImageSystem
[System]
Specify the location of the KIWI system image description.
The default value is the value of BasePath concatenated with /image.
Contrary to the atftp server setup the following instructions can only serve as
an example. Depending on your network structure, the IP addresses, ranges
and domain settings need to be adapted to allow the DHCP server to work
within your network. If you already have a DHCP server running in your
network, make sure that the filename and next-server are correctly set
in /etc/dhcpd.conf on this server.
The following steps describe how to set up a new DHCP server instance:
1. Install the package dhcp-server .
https://doc.opensuse.org/projects/kiwi/doc/
136/148
9/23/2016
openSUSEKIWIImageSystem
3. Edit the file /etc/sysconfig/dhcpd and setup the network interface the
server should listen on:
DHCPD_INTERFACE="eth0"
C GNU Licenses
C.1 GNU Free Documentation License
This appendix contains the GNU Free Documentation License version 1.2.
https://doc.opensuse.org/projects/kiwi/doc/
137/148
9/23/2016
openSUSEKIWIImageSystem
Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is
not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in
the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author and
publisher a way to get credit for their work, while not being considered responsible for modifications made by
others.
This License is a kind of "copyleft", which means that derivative works of the document must themselves be
free in the same sense. It complements the GNU General Public License, which is a copyleft license designed for
free software.
We have designed this License to use it for manuals for free software, because free software needs free
documentation: a free program should come with manuals providing the same freedoms that the software
does. But this License is not limited to software manuals; it can be used for any textual work, regardless of
subject matter or whether it is published as a printed book. We recommend this License principally for works
whose purpose is instruction or reference.
https://doc.opensuse.org/projects/kiwi/doc/
138/148
9/23/2016
openSUSEKIWIImageSystem
A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose
specification is available to the general public, that is suitable for revising the document straightforwardly with
generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely
available drawing editor, and that is suitable for input to text formatters or for automatic translation to a variety
of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose
markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by readers
is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy that is
not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format,
LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML,
PostScript or PDF designed for human modification. Examples of transparent image formats include PNG, XCF
and JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word
processors, SGML or XML for which the DTD and/or processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to hold,
legibly, the material this License requires to appear in the title page. For works in formats which do not have
any title page as such, "Title Page" means the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or contains
XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific
section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To
"Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled
XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to the
Document. These Warranty Disclaimers are considered to be included by reference in this License, but only as
regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or noncommercially, provided
that this License, the copyright notices, and the license notice saying this License applies to the Document are
reproduced in all copies, and that you add no other conditions whatsoever to those of this License. You may not
use technical measures to obstruct or control the reading or further copying of the copies you make or
distribute. However, you may accept compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
3. COPYING IN QUANTITY
https://doc.opensuse.org/projects/kiwi/doc/
139/148
9/23/2016
openSUSEKIWIImageSystem
If you publish printed copies (or copies in media that commonly have printed covers) of the Document,
numbering more than 100, and the Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and
Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of
these copies. The front cover must present the full title with all words of the title equally prominent and visible.
You may add other material on the covers in addition. Copying with changes limited to the covers, as long as
they preserve the title of the Document and satisfy these conditions, can be treated as verbatim copying in
other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as
many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either include
a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque copy a
computer-network location from which the general network-using public has access to download using publicstandard network protocols a complete Transparent copy of the Document, free of added material. If you use
the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque copies in
quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until at least
one year after the last time you distribute an Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any
large number of copies, to give them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3
above, provided that you release the Modified Version under precisely this License, with the Modified Version
filling the role of the Document, thus licensing distribution and modification of the Modified Version to whoever
possesses a copy of it. In addition, you must do these things in the Modified Version:
1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from
those of previous versions (which should, if there were any, be listed in the History section of the
Document). You may use the same title as a previous version if the original publisher of that version
gives permission.
2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the
modifications in the Modified Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five), unless they release you from this
requirement.
3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
4. Preserve all the copyright notices of the Document.
5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
6. Include, immediately after the copyright notices, a license notice giving the public permission to use the
Modified Version under the terms of this License, in the form shown in the Addendum below.
https://doc.opensuse.org/projects/kiwi/doc/
140/148
9/23/2016
openSUSEKIWIImageSystem
7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the
Document's license notice.
10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of
the Document, and likewise the network locations given in the Document for previous versions it was
based on. These may be placed in the "History" section. You may omit a network location for a work
that was published at least four years before the Document itself, or if the original publisher of the
version it refers to gives permission.
11. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and
preserve in the section all the substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section
numbers or the equivalent are not considered part of the section titles.
13. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified
Version.
14. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant
Section.
https://doc.opensuse.org/projects/kiwi/doc/
141/148
9/23/2016
openSUSEKIWIImageSystem
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for
publicity for or to assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under the terms defined in
section 4 above for modified versions, provided that you include in the combination all of the Invariant Sections
of all of the original documents, unmodified, and list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may
be replaced with a single copy. If there are multiple Invariant Sections with the same name but different
contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the
original author or publisher of that section if known, or else a unique number. Make the same adjustment to
the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History" in the various original documents,
forming one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any
sections Entitled "Dedications". You must delete all sections Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under this License, and
replace the individual copies of this License in the various documents with a single copy that is included in the
collection, provided that you follow the rules of this License for verbatim copying of each of the documents in
all other respects.
You may extract a single document from such a collection, and distribute it individually under this License,
provided you insert a copy of this License into the extracted document, and follow this License in all other
respects regarding verbatim copying of that document.
8. TRANSLATION
https://doc.opensuse.org/projects/kiwi/doc/
142/148
9/23/2016
openSUSEKIWIImageSystem
Translation is considered a kind of modification, so you may distribute translations of the Document under the
terms of section 4. Replacing Invariant Sections with translations requires special permission from their
copyright holders, but you may include translations of some or all Invariant Sections in addition to the original
versions of these Invariant Sections. You may include a translation of this License, and all the license notices in
the Document, and any Warranty Disclaimers, provided that you also include the original English version of this
License and the original versions of those notices and disclaimers. In case of a disagreement between the
translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement
(section 4) to Preserve its Title (section 1) will typically require changing the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this
License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However, parties who have received copies, or rights,
from you under this License will not have their licenses terminated so long as such parties remain in full
compliance.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the with...Texts. line with this:
with the Invariant Sections being LIST THEIR TITLES,
with the Front-Cover Texts being LIST, and with
the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two
alternatives to suit the situation.
https://doc.opensuse.org/projects/kiwi/doc/
143/148
9/23/2016
openSUSEKIWIImageSystem
If your document contains nontrivial examples of program code, we recommend releasing these examples in
parallel under your choice of free software license, such as the GNU General Public License, to permit their use
in free software.
Index
B
boot parameters, FAQ: Boot Image Customization, Boot Parameters
build process, Building Images
C
config.xml, Partition Based Installation
container
docker, Docker images
D
DVD, OEM Image / Preload Systems
H
hook scripts, Boot Image Hook-Scripts
I
images
ISO, ISO Image / Live System
OEM, OEM Image / Preload Systems
PXE, PXE Image / Thin Clients
VMX, VMX Image / Virtual Disks
https://doc.opensuse.org/projects/kiwi/doc/
144/148
9/23/2016
openSUSEKIWIImageSystem
K
KIWI
architecture restrictions, Architecture Restrictions
boot parameters, FAQ: Boot Image Customization, Boot Parameters
boot partition, Extra Boot Partition
boot process, Customizing the Boot Process
Btrfs, KIWI Custom Partitions
build process, Building Images
Caches, Image Caches
compressed root, OEM compressed / Read-only removable USB Media
config.xml, The config.xml File
container, Vagrant boxes
Container image, Docker images
create -- requested image types, The Create Step
create -- user defined scripts images.sh, The Create Step
cross-platform, The KIWI Model
distribution specific code, Distribution-Specific Code
encryption, KIWI Encryption Support
hook scripts, Boot Image Hook-Scripts
hybrid mode, Hybrid mode
Hybrid stick, Hybrid ISO Image
image analysis, System Analysis/Migration
image description, KIWI Image Description
initrd customization, FAQ: Boot Image Customization
Installation, Installation
Introduction, Introduction
ISO image, ISO Image / Live System
luks, KIWI Encryption Support
LVM, KIWI Custom Partitions
https://doc.opensuse.org/projects/kiwi/doc/
145/148
9/23/2016
openSUSEKIWIImageSystem
M
manpages
kiwi, kiwi
kiwi::config.sh, kiwi::config.sh
kiwi::images.sh, kiwi::images.sh
kiwi::kiwirc, kiwi::kiwirc
N
network boot, PXE Image / Thin Clients
https://doc.opensuse.org/projects/kiwi/doc/
146/148
9/23/2016
openSUSEKIWIImageSystem
O
OEM images, OEM Image / Preload Systems
P
postHWdetect.sh, Customizing the OEM Install Process
postImageDump.sh, Customizing the OEM Install Process
preHWdetect.sh, Customizing the OEM Install Process
preImageDump.sh, Customizing the OEM Install Process
PXE images, PXE Image / Thin Clients
R
raw
file name extension, Testing the Images
U
union image
local-local, Union Image
local-ram, Union Image
remote-local, Union Image
remote-ram, Union Image
remote-remote, Union Image
USB Stick, OEM Image / Preload Systems
V
vagrant
box, Vagrant boxes
vagrant image
vagrant image, Vagrant boxes
virtual disk formats, Building VMX Images
VMware, VMware support
VMX images, VMX Image / Virtual Disks
https://doc.opensuse.org/projects/kiwi/doc/
147/148
9/23/2016
openSUSEKIWIImageSystem
https://doc.opensuse.org/projects/kiwi/doc/
148/148