SDB:KIWI Cookbook AutoYaST

Jump to: navigation, search


How to use the graphical interfaces of YaST and AutoYaST as an configuration tool for creating an image with KIWI.
Icon-checked.png This procedure was tested on at least Kiwi version 3.25 ( kiwi --version ) - other (mostly older) version did not support all shown features



KIWI and AutoYaST - a winning combination


This example will guide you through the steps to create an AutoYaST file and use it with KIWI in order to configure your system automatically during bootup.

KIWI and AutoYaST


AutoYaST recipe

Prep Time:

  • 10 min

Cook Time:

  • 15-25 min depending on bandwidth (see discussion above) and hardware of host

Ingredients:

  • a running openSUSE 11.1 system (or greater)
  • an openSUSE 11.1 repository (or greater)
  • installed recent release of the KIWI toolset (at least version 3.25)
  • installed kiwi-doc package
  • about 2 GB free disk space

AutoYaST

The AutoYaST installation method allows for almost complete customization of an installation by using an XML control file. You can easily create and modify this hardware-independent file using the Autoinstallation tool. Best of all, AutoYaST files are portable; a configuration can be created once, and often used on a wide range of hardware configurations with little or no change.

Kiwi Image Description

In order to be able to create an image with KIWI, a so called image description must be created. The image description is represented by a directory which contain at least a file named config.xml, which is the main kiwi control file. There are some more files possible in this directory and one of them is the config-yast-autoyast.xml file.

This is a configuration file used by AutoYaST which can be processed by KIWI and setup your image as follows:

  1. While booting the image YaST is started in AutoYaST mode automatically
  2. The AutoYaST description is parsed and the instructions are handled by YaST. In other words the system configuration is performed
  3. If the process finished successfully the environment is cleaned and AutoYaST won’t be called at next reboot.

Unfortunately you can not use all features of AutoYaST with KIWI, because some parts are done by both tools.

You can not use all installation parts of AutoYaST (often called stage1) e.g. partitioning, initial package installation, because KIWI does the same, but use all 'configuration parts of AutoYaST (often called stage2).

Create a AutoYaST XML file

Please have the following packages installed

  • autoyast2
  • autoyast2-installation
  • yast2-ntp (for our example)
# zypper in autoyast2 autoyast2-installation

You will find the tool Autoinstallation in YaST under the section Miscellaneous or you can start it directly on the command-line with

# yast2 autoyast

You will now be presented with a window that allows you to configure most of your installation options as if you were installing a new machine. You can proceed through the menu system configuring your options for your system.

As an example here i would like set the NTP Server

  1. click on Network Services
  2. Click on NTP Configuration
  3. Click on Edit

You will now see the YaST configuration module for the NTP service

  1. choose Now and On Boot
  2. accept the warning message that you will need a permanent internet connection
  3. choose Auto as runtime policy
  4. click Add'
  5. choose Server and press next button
  6. select within the drop-down on the right Public NTP server
  7. choose your country and the NTP server of your choice
  8. press Test to see if he is reachable
  9. press Ok to finish the chooser dialog
  10. press Ok to finish the server dialog

Now we have set up our NTP server and could finish the YaST NTP configuration by pressing OK'

Last step is to save our autoyast xml file, so please go to the top menu and choose File - Save as and enter the name config-yast-autoyast.xml.

The default location where this file will be written is /var/lib/autoinstall/repository. Later on we need it with KIWI, so you could save it also directly into in our KIWI image description directory.

The AutoYaST UI can do more. You can clone single modules by just pressing a single button or You can apply the configuration of one module to the currently running system. And last but not least you can check your XML file for syntax errors.

Putting all together

Now we have the needed pieces together, so lets look again on the workflow

  1. yast2 autoyast
  2. setup configuration
  3. save or copy file as config-yast-autoyast.xml into the kiwi image description directory.
  4. make sure autoyast is part of the image
  5. build image

So step by step

Create a build directory structure

# mkdir -p /tmp/myimage/img

Clone a JeOS template into our build directory

# kiwi --clone suse-11.1-JeOS -d /tmp/myimage

Create the AutoYaST xml file

# yast2 autoinstall

save it as /tmp/myimage/config-yast-autoyast.xml


Add the packages autoyast2,autoyast2-install to you KIWI config.xml or add it on the fly through the parameter --add-package

Because we are using for this example here the JeOS template we must add some more packages to our KIWI control.xml file to let the example work.

Scroll to the packages list in your config.xml file to see the current list of packages selected for the image and add the following packages:

<packages type="image">
 ...
 <package name="autoyast2"/>
 <package name="autoyast2-installation"/>
 <package name="yast2-ncurses"/>
 <package name="yast2-sysconfig"/>
 <package name="yast2-ntp"/>
 <package name="ntp"/>
 <package name="yast2-network"/>
 ...
</packages>
# kiwi --build /tmp/myimage --destdir /tmp/myimage/img

You can do this also on the fly with help of --add-package, e.g.

# kiwi --build /tmp/myimage --destdir /tmp/myimage/img --add-package autoyast2 --add-package autoyast2-installation --add-package yast2-ncurses --add-package yast2-sysconfig --add-package yast2-ntp --add-package ntp --add-package yast2-network

Let's have a look what will happen (if you have qemu-kvm it will be faster)

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

You will see that YaST to is started during boot and configures the NTP service. To check the settings you can look into the NTP configuration file if your settings done by the autoyast GUI interface is there.

# cat /etc/ntp.conf

With my settings it look like:

server de.pool.ntp.org iburst
# key (7) for accessing server variables
# controlkey 15                 # key (6) for accessing server variables


If you would like using a graphical interface you must pay attention to the version of openSUSE.

For setting up a X configuration prior to openSUSE 11.3 you must add sax2 -a as part of /etc/init.d/boot.local. This is also true for SUSE Linux Enterprise Server up to version 11 SP1

For details you can look into the recipe SDB:KIWI Cookbook GNOME System where we used this too

Starting with openSUSE 11.3 X configures automatically.