SDB:KIWI Cookbook AutoYaST
tagline: From openSUSE
All of KIWI edit
|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.
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:
- While booting the image YaST is started in AutoYaST mode automatically
- The AutoYaST description is parsed and the instructions are handled by YaST. In other words the system configuration is performed
- 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
- yast2-ntp (for our example)
You will find the tool Autoinstallation in YaST under the section Miscellaneous or you can start it directly on the command-line with
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
- click on Network Services
- Click on NTP Configuration
- Click on Edit
You will now see the YaST configuration module for the NTP service
- choose Now and On Boot
- accept the warning message that you will need a permanent internet connection
- choose Auto as runtime policy
- click Add'
- choose Server and press next button
- select within the drop-down on the right Public NTP server
- choose your country and the NTP server of your choice
- press Test to see if he is reachable
- press Ok to finish the chooser dialog
- 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
- yast2 autoyast
- setup configuration
- save or copy file as config-yast-autoyast.xml into the kiwi image description directory.
- make sure autoyast is part of the image
- build image
So step by step
Create a build directory structure
Clone a JeOS template into our build directory
Create the AutoYaST xml file
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>
You can do this also on the fly with help of --add-package, e.g.
Let's have a look what will happen (if you have qemu-kvm it will be faster)
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.
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.