Step by Step Guide to create autoyast xml file for SuSE Linux (SLES) with examples

In this article I will show you some examples of autoyast xml files and syntax which can be used based on your requirement.

Below article contains a sample autoyast xml file which works with SLES 10 and higher version

AutoYast2 xml in SLES is similar to kickstart used with Red Hat only in terms of concept which means both of them are used for automating the installation but the syntax and variables used are completely different.

AutoYaST2 is a system for installing one or more SUSE Linux systems automatically and without user intervention. AutoYaST2 installations are performed using an AutoYaST profile with installation and configuration data. That profile can be created using the configuration interface of AutoYaST2 and can be provided to YaST2 during installation in different ways.

Configure General options (timezone, keyboard and mouse)

General options include all the settings related to the installation process and the environment of the installed system.

The mode section configures the behavior of AutoYaST with regard to confirmation and rebooting.

  • By default, the user must confirm the auto-installation process. This option allows the user to view and change the settings for a target system before they are committed and can be used for debugging.
  • confirm is set to "true" by default to avoid recursive installs when the system schedules a reboot after initial system setup. Only disable confirmation if you want to carry out a fully unattended installation.
  • With halt you cause AutoYaST to shut down the machine after all packages have been installed. Instead of a reboot into stage two, the machine is turned off. The boot loader is already installed and all your chroot scripts have run.
  • final_halt and final_reboot have been introduced with openSUSE 11.0 and SLES11. You can reboot or halt the machine after installation and configuration are finished at the end of stage 2.

Replace the highlighted values tin yellow o configure your keyboard and language value
    <halt config:type="boolean">false</halt>
        <forceboot config:type="boolean">false</forceboot>
        <final_reboot config:type="boolean">false</final_reboot>
        <final_halt config:type="boolean">false</final_halt>
        <confirm config:type="boolean">true</confirm>
        <second_stage config:type="boolean">true</second_stage>
          <show config:type="boolean">true</show>
          <timeout config:type="integer">10</timeout>
          <log config:type="boolean">true</log>
          <show config:type="boolean">true</show>
          <timeout config:type="integer">10</timeout>
          <log config:type="boolean">true</log>
          <show config:type="boolean">true</show>
          <timeout config:type="integer">10</timeout>
          <log config:type="boolean">true</log>

Configure bootloader

Below section in the autoyast xml is mandatory, although the highlighted values can be modified accordingly

      <activate config:type="boolean">false</activate>
      <repl_mbr config:type="boolean">false</repl_mbr>
        <boot_mbr config:type="boolean">true</boot_mbr>

Configure Networking, DNS, Routing

  • YaST will keep network settings created during installation (via Linuxrc) and/or merge it with network settings from the AutoYaST profile (if defined). 
  • AutoYaST settings have higher priority than already present configuration files. 
  • YaST will write ifcfg-* files from profile without removing old ones. 
  • If there is an empty or no dns and routing section, YaST will keep already present values. Otherwise settings from the profile will be applied.

To configure network settings and activate networking automatically, one global resource is used to store the whole network configuration.

In the below syntax I am creating a single interface with a DNS server and hostname

        <dhcp_resolv config:type="boolean">true</dhcp_resolv>
        <ip_forward config:type="boolean">false</ip_forward>
        <routes config:type="list">
      <interfaces config:type="list">

Configure NTP

Using the below syntax you can configure your NTP client with the list of NTP servers

      <configure_dhcp config:type="boolean">false</configure_dhcp>
      <peers config:type="list">
          <initial_sync config:type="boolean">true</initial_sync>
          <initial_sync config:type="boolean">true</initial_sync>
      <start_at_boot config:type="boolean">true</start_at_boot>
      <start_in_chroot config:type="boolean">true</start_in_chroot>

Create a User

To create a user use syntax as explained below with the encrypted password and it's login shell

    <users config:type="list">
        <encrypted config:type="boolean">true</encrypted>

Configure partitioning

To understand more on every syntax used here you can follow the Guide from SuSE.

In the below example I am creating LVM based configiration with root, boot, swap and some other data partitions

<partitioning config:type="list" >
<initialize config:type="boolean">true</initialize>
<partitions config:type="list">
  <!-- part for boot -->
    <format config:type="boolean" >false</format>
    <partition_id config:type="integer" >131</partition_id>
   <filesystem config:type="symbol" >ext3</filesystem>
   <format config:type="boolean" >true</format>

  <!-- part for root -->
    <format config:type="boolean" >false</format>
    <partition_id config:type="integer" >142</partition_id>

<!-- max alloc root 128 auto -->
    <initialize config:type="boolean" >false</initialize>
    <is_lvm_vg config:type="boolean" >true</is_lvm_vg>
    <lvm2 config:type="boolean" >true</lvm2>
    <partitions config:type="list" >
      <!-- LV for root -->
        <filesystem config:type="symbol" >ext3</filesystem>
        <format config:type="boolean" >true</format>
        <partition_id config:type="integer" >142</partition_id>

      <!-- LV for tmp -->
        <filesystem config:type="symbol" >ext3</filesystem>
        <format config:type="boolean" >true</format>
        <partition_id config:type="integer" >142</partition_id>

      <!-- LV for var -->
        <filesystem config:type="symbol" >ext3</filesystem>
        <format config:type="boolean" >true</format>
        <partition_id config:type="integer" >142</partition_id>

      <!-- LV for opt -->
        <filesystem config:type="symbol" >ext3</filesystem>
        <format config:type="boolean" >true</format>
        <partition_id config:type="integer" >142</partition_id>

      <!-- LV for swap -->
        <filesystem config:type="symbol" >swap</filesystem>
        <format config:type="boolean" >true</format>
        <partition_id config:type="integer" >142</partition_id>



Configure Software

You can provide a custom list of rpms which you want to be installed or removed during the installation

      <patterns config:type="list">

      <packages config:type="list">

      <remove-packages config:type="list">

Custom User scripts

By adding scripts to the auto-installation process you can customize the installation according to your needs and take control in different stages of the installation.

In the auto-installation process, five types of scripts can be executed and they will be described here in order of "appearance" during the installation.

All scripts have to be in the <scritps> section.

  • pre-scripts (very early, before anything else really happens)
  • postpartitioning-scripts (after partitioning and mounting to /mnt but before RPM installation—since openSUSE 11.2 and SLES11 SP3)
  • chroot-scripts (after the package installation, before the first boot)
  • post-scripts (during the first boot of the installed system, no services running)
  • init-scripts (during the first boot of the installed system, all services up and running)

Some examples

1. pre script

<pre-scripts config:type="list">
echo "This is a dummy pre script"

2. post scripts

<post-scripts config:type="list">
        <source> <![CDATA[#!bin/sh
echo "This is a dummy post script"

3. chroot scripts

<chroot-scripts config:type="list">
        <chrooted config:type="boolean">true</chrooted>
sysctl -w net.ipv6.conf.all.disable_ipv6=1;
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf;

There are many more sections which can be used in an autoyast xml file which goes out of this article's scope. For more information you can always follow the SuSE Documentation

I hope the article was useful.