The wikis are now using the new authentication system.
If you did not migrate your account yet, visit


Jump to: navigation, search

Susemini.png 本文处于需要翻译的文章的状态,欢迎您积极参与翻译与修订。 翻译人员:无,修订人员:无。



a few KIWI recipts

The OpenSuSE KIWI Image System provides a complete operating system image solution for Linux supported hardware platforms as well as for virtualisation systems like Xen or VMware.

With KIWI you can

  • Create a tuned server appliance, containing your application and just enough operating system components
  • Spin a live CD or DVD with just the packages and software you need
  • Create a ready-to-run VMware virtual appliance
  • Create a live USB key and carry your Linux system with you wherever you go
  • Build a hard disk image for preloading onto hardware

To make it easy to start with KIWI, i would like to give you a few easy recipts to try by yourself.

If you are interested in a very detailed description of the kiwi image system, it exists in the system design document on your system at /usr/share/doc/packages/kiwi/kiwi.pdf or at KIWI Image System Cookbook.

General Preparation for all recipts

Before we can start cooking, we should be shure that we have all needed ingredients ready and set up correct. Also be shure that you are logged in as root on your system.

The repository

Before you start to use any of the examples provided with kiwi, your build system has to have a valid installation source, which is also called a repository, for the distribution you are about to create an image for. There could be more than one repository to build your image.

By default all examples will connect to the network to find the installation source.

It depends on your network bandwidth how fast an image creation process is and in almost all cases it is better to prepare a local installation source first.

So let's look at the options we have for the base repository

  • The default is the online openSUSE repository. The build speed depends on your connection rate to the internet.
  • If you have the openSUSE DVD ready in your drive it's also fine. The speed of you CD or DVD drive is here the crucial factor for building the image. The DVD should normaly be mounted under the directory
  • If you only have the ISO image, it is also no problem. This would be the fastest way, because then it's live on the harddisk. You could loop-mount the iso-image with the command
mount -o loop /path-to-the-iso-file/filename.iso /mnt

The actual KIWI toolset

You should always work with the actual released versions of the KIWI toolset. So please add the openSUSE:Tools repository to your system. If you don't have it installed yet, the simplest way to add it is by commandline as root with help of zypper.

Add the repository

# zypper ar openSUSE:Tools

Refresh it

# zypper refresh

Update all installed packages with newer versions

# zypper up -t package -r openSUSE:Tools

If you don't have kiwi and other needed packages installed you can do it by typing

# zypper in kiwi kiwi-doc kiwi-desc-* squashfs

The directories where we cook

We need some space on the harddisk to build with KIWI.

One directory we use as temporary build space

mkdir -p /tmp/myiso

another where our result will go into

mkdir -p /tmp/myiso-result

So now we have all things together to be ready for our examples.

Kiwi.png Ready to start cooking!

KIWI always operates in two steps.

The first step is the preparation step and if that step was successful, a creation step follows, which is able to create different image output types.

In the preparation step, you prepare a directory (e.g. /tmp/myiso ) including the contents of your new filesystem based on one or more software package source(s) from your repositories.

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 (e.g. /tmp/myiso-result). 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 is able to create images for virtual and para-virtual (Xen) environments as well as for USB stick, LiveCD, PXE network clients and OEM customized Linux systems.

So it would look like this two lines to build a image with KIWI

kiwi --prepare <ImageDescriptionPath> --root <RootPath>
kiwi --create <RootPath> --destdir <DestinationPath>

The kiwi --build option just combines both steps into one, to make it easier to start with kiwi. Then a command to create a image with KIWI look like this

kiwi --build <ImageDescriptionPath> --destdir <DestinationPath>

Get Juiced - our first recipt

Ups - what? Which Juice?

Juice is the pronunciation for JeOS, which stands for “Just Enough Operating System.”

The term JeOS refers to a customized operating system that precisely fits the needs of a particular application. It means it includes only the pieces of an operating system required to support a particular application, a very minimal system where you add on only the things on top you really need.

This approach will result in smaller, faster, more efficient, more secure and offers better performance than an application running under a full blown, general-purpose OS. This also makes it a perfect way of building virtual appliances.


Juice (JeOS) recipt

Prep Time:

  • 10 min

Cook Time:

  • 20 min


  • a running openSUSE 11.1 system
  • a openSUSE 11.1 repository, e.g. the DVD
  • the actual KIWI toolset
  • about 8 GB free disk space

The kiwi-template package provides example descriptions based on a JeOS system, which i would like to use in this reciept.

Tux Live - our second recipt

In this example i would like you to show how to build a openSUSE live system. As special we change the boot splash to our own image.

A live system image is an operating System on CD or DVD. In principal one can treat the CD/DVD as the hard disk of the system with the restriction that you can’t write data on it.

So as soon as the media is plugged into the computer, the machine is able to boot from that media. After some time one can login to the system and work with it like on any other system. All write actions takes place in RAM space and therefore all changes will be lost as soon as the computer shuts down.

The recipt provided here is based on openSUSE 11.1 and includes the base + kde patterns.


LiveCD recipt

Prep Time:

  • 15 min

Cook Time:

  • 18 min


  • a running openSUSE 11.1 system
  • a openSUSE 11.1 repository, e.g. the DVD
  • the actual KIWI toolset
  • about 8 GB free disk space
  • Bootsplash files

mkdir /tmp/myiso
mkdir /tmp/myiso-result
cd /usr/share/doc/packages/kiwi/examples/suse-11.1
kiwi --prepare /usr/share/doc/packages/kiwi/examples/suse-11.1/suse-live-iso --root /tmp/myiso
kiwi --create /tmp/myiso --type iso -d /tmp/myiso-result

Testing this iso can be done with any full virtual system (e.g. vmware, qemu) or simply by burning the .iso file on a CD or DVD and boot from it.

Example with qemu:

qemu -cdrom /tmp/myiso-result/suse-11.1-live-iso.i686-2.5.1.iso -m 512

Login Details are

  • User: root
  • pwd : linux

Makeing it our SUSE Tux - Changing the image description

In order to be able to create an image with KIWI, a so called image description must be created. It controls how KIWI builds the image and what it can use to build it.

The image description is represented by a directory which has to contain at least one file named config.xml. A detail description you can find in /usr/share/doc/packages/kiwi/kiwi.pdf or at KIWI Image System Cookbook.

Adding a package

As example, i would like to add an additional package (kde4-kdf - Disk Usage Viewer) and would like change the system boot screen. For this we should copy the Image description directory we used before to make our changes and not destroy the original examples (which would always a good idea - to work only on copies).

# cp -a /usr/share/doc/packages/kiwi/examples/suse-11.1/suse-live-iso /tmp/tux-suse-live-iso
# cd  /tmp/tux-suse-live-iso
# ls -l
 total 52
 drwxr-xr-x  3 root root  4096 Mar 18 17:48 ./  
 drwxrwxrwt 22 root root 36864 Mar 19 14:52 ../
 -rwxr-xr-x  1 root root  1204 Oct  2 16:19*
 -rw-r--r--  1 root root  1101 Jan  7 10:49 config.xml
 drwxr-xr-x  3 root root  4096 Feb 10 17:34 root/

Now let's add the needed package to the image description. The main file we must change, is the config.xml file. Please open it in a text editor and look at the package part. It should look like this

      <packages type="image">
               <package name="kernel-default"/>
               <package name="bootsplash"/>
               <package name="bootsplash-branding-openSUSE"/>
               <package name="ifplugd"/>
               <package name="vim"/>
               <opensusePattern name="default"/>
               <opensusePattern name="kde4"/>

We now add another package (BOLD) and afterwards it should look like this

      <packages type="image">
               <package name="kernel-default"/>
               <package name="bootsplash"/>
               <package name="bootsplash-branding-openSUSE"/>
               <package name="ifplugd"/>
               <package name="vim"/>
               <package name="kde4-kdf"/>
               <opensusePattern name="default"/>
               <opensusePattern name="kde4"/>

That's all we must do. The package "kde4-kdf" will be additional installed during the prepare step and we have an additional program installed in our live cd. Instead of packages you can also add complete patterns which could include many packages.


As you can see there is an package named "bootsplash-branding-openSUSE" which is responsible for the look and feel of the bootscreen. We also would like to change the bootscreen, but unfortunatly we don't have a package with an other boot screen. What now?

There is an additional concept in KIWI where we can add or change things without having an rpm package. The concept is called overlay files. Think about a directory where you can copy directly your needed files and maybe subdirectories.

It's also in the image description. Did you wonder what the directory "root" is for? Yes, that is the place where we copy our files as an overlay. It could contain special files, directories, and scripts for adapting the image environment after the preparation step (the installation of all the image packages). The entire directory is copied into the root of the image tree (e.g. /tmp/myiso) using cp -a, it's copied over the existing root tree.

So let's do it. I would like to use for this recipet a black SUSE splash screen, which we could download from I assume that you download it into your home into the "Download" directory.

After downloading, please unpack the archive and copy the Black_SUSE folder inside our overlay root directory into root/etc/bootsplash/themes.

# mkdir -p /tmp/tux-suse-live-iso/root/etc/bootsplash/themes
# cd /tmp
# tar xvjf /root/Download/77016-Black_SUSE_Bootsplash.tar.gz
# cp -a /tmp/Black_SUSE_Bootsplash/Black_SUSE  /tmp/tux-suse-live-iso/root/etc/bootsplash/themes

Now we additionaly must switch this screen on. This is done in a running system with help of the file /etc/sysconfig/bootsplash. Lukily it exists in our configuration directory, so we could edit easily to use our new theme. Please open the file /tmp/tux-suse-live-iso/root/etc/sysconfig with an editor and change the entry for THEME


# Choose the bootsplash theme. It should be based in
# /etc/bootsplash/themes/


# Choose the bootsplash theme. It should be based in
# /etc/bootsplash/themes/

baking it

I also would like to show you how to use a different repository than the online repository.

It's quite easy - we can add it as parameter

--set-repo RepoPath [--set-repotype Type]
It set the given repository and optional type for the first repository entry within the config.xml. The change will not be written to the XML file and is valid for the subsequent image preparation or upgrade process.

or change it within our central config.xml file

Original with online repository:
       <repository type="yast2">
               <!--<source path="/image/CDs/full-11.1-i386"/>-->
New with the DVD as repository:
       <repository type="yast2">

So our commands would look like

rm -rf /tmp/myiso
mkdir  /tmp/myiso
kiwi --prepare /tmp/tux-suse-live-iso --root /tmp/myiso --set-repo /media/SU1110.001
kiwi --create /tmp/myiso --type iso -d /tmp/myiso-result

Mango-icon.png Branding-logo.png Tux_Suse.png