Sunday, May 15, 2011

301 Moved Permanently

This is the last posting I do on this blog.
I decided to switch to a self hosted wordpress installation for blogging. I hope to see you soon on my new blog site.
There is already a new blog post about setting up SUSE Manager.

Friday, April 8, 2011

Cobbler on openSUSE

Preamble


What is cobbler?


To answer that, I want to quote from the homepage of Cobbler


Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between lots of various commands and applications when rolling out new systems, and, in some cases, changing existing ones.

With a simple series of commands, network installs can be configured for PXE, reinstallations, media-based net-installs, and virtualized installs (supporting Xen, qemu, KVM, and some variants of VMware). Cobbler uses a helper program called 'koan' (which interacts with Cobbler) for reinstallation and virtualization support.


This artice describes the installation and setup of Cobbler on openSUSE 11.4 and the basic steps of using it.

Preparation


Install the required software


First of all, you need it install an openSUSE 11.4 with the cobbler+cobbler-web package installed of course :)

Most people will have those repos already after the installation but anyway, if you don't have the default repos do:

zypper ar http://download.opensuse.org/distribution/11.4/repo/oss/ oss
zypper ar http://download.opensuse.org/update/11.4/ updates

There is cobbler v2.0.10 on openSUSE 11.4 (oss repo) but that version does not have all fixes and functionality you want. So you have to use the latest cobbler version you can find in this repo:


zypper ar http://download.opensuse.org/repositories/systemsmanagement/openSUSE_11.4/ cobbler
zypper ref -s

Make sure you have the latest mod_python module update installed. It has to be at least apache2-mod_python-3.3.1-161 because the 11.4 goldmaster version of mod_python has a bug and does not work with any python script. We released an online update for mod_python on 11.4 on openSUSE 11.4 in the beginning of march 2011, so maybe you already have it installed. In any case, do:

zypper up apache2-mod_python

Now we install cobbler:

zypper install cobbler cobbler-web atftp

That should install version 2.1.0 or later. We are done with the package installation and have to do some configuration now.


Basic configuration of Cobbler


If you want to use the cobbler web ui, you have to authenticate and there are multiple ways cobbler can authenticate a user. In the file /etc/cobbler/modules.conf we set the authentication module to authn_configfile. That will read the account information from /etc/cobbler/users.digest:

sed -i 's/module = authn_denyall/module = authn_configfile/' \
/etc/cobbler/modules.conf

There are more auth modules like for ldap-authentication and they are all documented in /etc/cobbler/modules.conf

Now we change the server settings in /etc/cobbler/settings. Search for "server: 127.0.0.1" in that file and replace it with the ip address of your cobbler server. That address will end later in the autoyast=..... and install=.... parameter.


YOUR_IP="....."
sed -i "s/^server: 127.0.0.1/server: $YOUR_IP/" \
/etc/cobbler/settings

We are done with the basic configuration now and it's time start cobbler for the first time:

insserv apache2
insserv cobblerd
rcapache2 restart
rccobblerd restart

First Steps


Look around


take your webbrowser and visit http://localhost/cobbler_web. You'll get a login mask where you can login with user: cobbler, password: cobbler. That's the default configuration in /etc/cobbler/users.digest and we did not change that so far. If you want to add your own accounts, you can do that by:


htdigest2 /etc/cobbler/users.digest "Cobbler" $USER

After the login, your webbrowser presents you a webpage like this:


We are ready to work with cobbler now.

Importing a Distro


To do installations, we need an installation source. So let us import one into Cobbler and we use the openSUSE 11.4 DVD for that. Please mount the DVD to /mnt and choose "Import DVD" on the left side of the webui. Fill out the form like you see on the screenshot:


If you press the "run" button, an import job is being scheduled. You can see the job by clicking on "Events" (third link from the top in "Configuration" on the left side). Your import job has the state "running" but that will change to "complete" in a while, when cobbler has copied the complete DVD to the harddisk.

When Cobbler has finished the import, two new distros are created like you can see on the Distros page


Distro is another word for installation source but why two? Because the DVD contains two bootable kernels. One for xen guests and one for a normal physical machine. You can see that one distro got a "xen" in the name and that's the installation source you can use to install virtual xen machines.
As you can see, an install=... parameter has already been added by Cobbler so the distro is ready for installations. You can add own kernel parameter if you wish but for this tutorial it's not needed.

Adding an Autoinstallation Profile


Profiles in Cobbler are connected to a distribution.

If you click on Profiles you can see that cobbler has created two empty autoinstallation profiles already - one for each distro. We will ignore those and create our own one by chosing "Create new profile" and click on "go". Copy your AutoYaST XML file to /var/lib/cobbler/kickstarts/ (or any other path you like) and fill out the form like I did:


You can see that I selected the non-xen version of our distros. If you want to install a virtual xen machine, you have to choose the other distro with the "xen" in the name.

If you press "save" you'll get back to the profile overview page where you can see three profiles now, including the one you just created.

On the right side of each profile is a link "view kickstart" and if you press on that, you'll see your XML file (cobbler has added some scripts but you don't have to care about that now).

Install a virtual machine


We have a distro and an AutoYaST XML file now and that's enough to create a virtual machine. I'll not explain here how to setup kvm or xen but I assume you have a physical machine configured for running virtual machines. I use kvm and need to to some little changes in the test_profile for that. I change the virt-type to qemu and the Virt Bridge from xenbr0 tp br0 because that's how the bridge is called on my virtual host platform.

You have to install koan from the same repo as cobbler on your virtual host platform (cobbler itself is not needed to be installed) and run:

koan --server=$your_cobbler_server.example.net \
--virt \
--profile=test_profile \
--virt-name=virt_host1

This will trigger the creation and autoinstallation of a virtual machine called "virt_host1". If you start virt-manager, you can see that the machine is installing the openSUSE 11.4 with the AutoYaST XML file.

Bare Metal Installation


If you want to do bare metal installations via PXE boot, you need to acticate the tftp server on the Cobbler machine:

rcatftpd start
insserv atftpd

For the bare metal installation we have to create a system record in Cobbler, so let's got to Systems -> create new system and configure the fields as I di in the screenshot:


When you press save you will be redirected to the systems-list and you can see your system there. If you switch to the console, you can see that a PXE boot config file was created in /srv/tftpboot/pxelinux.cfg/01-yo:r:mac:add:rr:ess so it'll start an installation next time it boots.

If you set the option pxe_just_once in /etc/cobbler/settings to "1", autoyast will turn off the PXE boot before it reboots at the end of the 1st stage, so you don't have endless PXE boot loops. You can switch on/off the netboot option for a system in the web ui of cobbler.

What else?


There is a lot to discover in cobbler. For example:

  • You can create Snippets which are a kind of include files but way more powerful. They can be referenced by $SNIPPET(name_of_snippet) then in the AutoYaST XML file

  • You can let Cobbler manage your dhcp server, so all systems get a dhcp record automatically (very useful, I use it here in my testlab)
  • You can let Cobbler manage your dns server, so all systems get a dns record automatically (very useful too but I don't use it here)
  • You can create boot ISO images so you can do installations without network
  • You can register existing systems by calling cobbler-register to add a system-record based on the running system automatically (devel:tools:python-ethtool is needed for that on the client)

  • You can let koan reinstall a running machine. It'll copy kernel/initrd to the harddisk and rewrites the grub config. With the next reboot, a new system is getting installed on the machine
  • cobbler has a command line client tool called cobbler that lets you do everything you can do in the web ui via command line too
  • ...


As you can see, cobbler offers a lot more than I can cover in one blog.

If you have questions or look for more information go to:

Of course you can send me an eMail too.


have fun, Uwe

Friday, March 4, 2011

SUSE Manager Autoinstall Screenshots

as you might know, we published the SUSE Manager yesterday.
It was fun to work on that project and I learned really a lot.
Anyway, I read many announcement texts in the press and from Novell but I did not see any pictures. People love pictures. So here they come (most screenshots about autoinstallation - I guess you know why ;) ).

Overview page:

AutoYaST/Kickstart Profiles overview:
Edit an AutoYaST profile:

Overview of your systems (machines and virtual machines):
Reinstall a physical machine with AutoYaST/Kickstart:

Install a virtual machine on a physical host with AutoYaST:


Configure bare metal installations (assign an AutoYaST XML file to an ip address range):
that's it for now!
Have fun - Uwe

Thursday, September 30, 2010

AutoYaST and Image Creation/Installation

In openSUSE 11.3 I enhanced the AutoYaST image installation feature a bit and I added a nice useable UI to configure it.
It's still quite beta because I was not able to test it the way I should have but I think that if you are interested in that topic, it's worth a look already.
Let's start immediately and create an AutoYaST image with the UI.

Step 1 - make the openSUSE Installation Source available


taylor:~ # mount /dev/dvd /mnt

I simply mount the openSUSE 11.3 DVD here to the /mnt directory.

Step 2 - start the AutoYaST UI


taylor:~ # yast2 autoyast

When the UI is started, go to the software selection configuration. You'll be asked where the installation source is you want to use.
As you can see in the screenshot, I set the installation source to the mounted DVD by "file:///mnt/".

Hint: You can't create 64bit images on a 32bit system but 32bit images on a 64bit system

Step 3 - select your software for the image


I selected the base pattern and the kernel I want (don't forget the kernel. Linux is no fun without a kernel).




Select okay to return to the main UI when you have selected all the software you want to have in the image.
You probably want to configure anything non image related now, like root password, partitioning, ...

Step 4 - Create the Image





Choose "Image Deployment" in the AutoYaST UI and configure the location of the image. That's where AutoYaST can find it during the installation process.
I want to do a network installation and I'll put the image on my webserver and so I type the http address here.
As you can see in the screenshot, you can also create an ISO. Then you don't have to specify a name and the location, because a DVD ISO will be created that contains the image and the autoyast XML file plus everything you need to do an installation from the ISO by booting it.
Creating an ISO is probably easier in the beginning if you want to play with this feature.

Step 5 - Choose the location to store the image


I'll store it to /srv/www/htdocs/ because that's the document root of my webserver. Like mentioned in step 4, I'll fetch the image from my webserver.



If you create an ISO, you have to choose where to save the ISO now.

Step 6 (optional) - make changes to the image





AutoYaST will now create the image and you can do changes to it when all patterns and packages are installed. You can see that in the screenshot.
So if you want to put any files into the image, you can copy them now to the place shown in the popup, which is a directory that contains the system that will later be dumped to you harddisk. You can even chroot into that directory and let scripts run if you want.
This step is optional, so if you don't want to add files or anything, you can simply press "ok" here to compress the image.

Now you are done with the image creation. Let's take a look at what we have in the XML file now:

...
<software>
<image>
<image_location>http://taylor.suse.de/</image_location>
<image_name>my_image</image_name>
<run_kickoff config:type="boolean">true</run_kickoff>
<script_location>file:///usr/lib/YaST2/bin//fetch_image.sh</script_location>
<script_params config:type="list">
<listentry>http://taylor.suse.de//my_image.tar.gz</listentry>
</script_params>
</image>
<instsource>file:///mnt/</instsource>
<packages config:type="list">
<package>kernel-desktop</package>
</packages>
<patterns config:type="list">
<pattern>apparmor_opt</pattern>
<pattern>base</pattern>
<pattern>yast2_install_wf</pattern>
<pattern>sw_management</pattern>
<pattern>apparmor</pattern>
</patterns>
...


The XML file is prepared for an installation of the image. The fetch_image.sh is part of AutoYaST since openSUSE 11.3 and will fetch and unpack the image after the partitioning is done. That's why we can use "file:///" here, because autoyast will find it as it's part of the autoyast2-installation RPM.
You can replace that script by anything you want that can fetch and unpack the image. So if you have a complete different image type, you can write your own script to fetch and unpack the image. Of course if you have a different kind of image, you can't use the AutoYaST UI anymore to create it. AutoYaST will always create a tar.gz file that contains the installed system.

Installing images via AutoYaST has three major benefits compared to the RPM installation step:

  • multiple times faster

  • post-configuration can be done in the image instead of after the installation

  • very easy switching between image installation and RPM installation (with rules, even dynamically when starting the installation)


You can install images without losing any of the AutoYaST functionality. Ask-dialogs, all kind of scripts (even pre-scripts), complex partitioning and so on is still possible because only the slow RPM installation step is skipped and replaced by putting an image to the harddisk while you have all kinds of flexibility of how that image is created.

As mentioned in the beginning of this article, I had not enough time to test this through but if you are interested in it feel free to play with it and report feedback to me if anything fails or can be enhanced :)

Have fun!

ciao, Uwe

Wednesday, July 7, 2010

AutoYaST goes Twitter

well, it's not that it can read XML files from a twitter feed now ;) but after this blog, starting from today, AutoYaST goes one further step to web 2.0 and has it's own twitter account.
It's not for great hints or enhanced support or so. It's just a little look behind the curtain of my life with AutoYaST ... for those who care ;)
And it seems you can't do any bigger project these days without something like a blog, twitter or facebook or ... so ... here it is.

ciao, Uwe

Tuesday, April 20, 2010

AutoYaST and it's Tools


"Al: Didn't you study the manual at all?
Tim: A real man doesn't need a manual. "


Because my last article was for the experts, this is more for the AutoYaST-newbies again.
It's not about AutoYaST itself but about the tools that orbit around it.

  • ayast_setup
    This tool is part of the autoyast2 RPM.
    Bubli wrote an excellent tutorial already so I'll just sum things up a little here.
    With ayast_setup you can reconfigure an already installed and running system without reinstalling it. All you need is an AutoYaST XML file and then call:
    yast2 ayast_setup setup filename=/tmp/my.xml

    The XML file will be read by AutoYaST and applied to your currently running system except (and that's good - you want it that way, believe me) all 1st stage configuration like partitioning, bootloader, pre- and chrootscripts and software selection. So if you use a XML file with partitioning information, your system will not get repartitioned.
    If you want to install packages, you have to use the <post-packages> section because the normal <software> section is evaluated during 1st stage only too.

  • yast2 clone_system
    This tool is also part of the autoyast2 RPM.
    This is kind of the opposite of ayast_setup. At the end of the normal installation, you have the option to clone the freshly installed system for AutoYaST but if you missed that opportunity, you can do that later in the running system with the clone_system client.
    Since openSUSE 11.3 you can call it like this:
    yast2 clone_system help

    and you'll get a list of "known modules" that can be cloned like this:
    known modules:
    bootloader dns-server
    firewall host
    http-server inetd
    iscsi-client kerberos
    lan ldap mail nfs
    ...

    and you can clone them like this:
    yast2 clone_system modules clone=lan,partitioning,software

    This will create an AutoYaST XML file in /root/autoinst.xml with the networking, partitioning and software section. If you don't specify any modules to clone, the same XML file will be created like with the "Clone this System" checkbox at the end of a normal installation.
    The "modules" parameter is new on openSUSE 11.3 and will not work on SLES11. On SLES11 you can only do the default cloning by calling
    yast2 clone_system

    Some customers are even doing remote-cloning with screen and ssh like this:
    ssh --batch root@myhost "screen -D -m yast clone_system &"


  • ayast_probe
    This tool is part of the autoyast2-installation RPM.
    It's not very useful in a running system but can become handy during the installation.
    When you use a rules.xml file, you can do things like (pseudocode) "if installed_product == 'SLES11' and memsize > 1024 use big_software.xml". The real syntax can be found
    here in the documentation.
    The question is, what are reasonable values of installed_product or memsize?
    /usr/lib/YaST2/bin/y2base ayast_probe ncurses
    shows you.


  • yast2 autoyast
    This tool is part of the autoyast2 RPM.
    If you start to look at AutoYaST for the first time, you'll probably get in touch with this tool immediately. It's the AutoYaST userinterface to create a XML file. Every module like networking, samba-client, partitioning, software configuration and so on has a UI here so you don't have to deal with XML code.
    But the AutoYaST UI can do more. You can clone single modules like you can do with the clone_system client by just pressing a single button (I painted that red in the screenshot, where the nfs-client is selected and would be cloned).
    You can apply the config of one module to the currently running system like with ayast_setup but with just a single button press again (green in the screenshot for the nfs-client config).
    And last but not least you can check your XML file for syntax errors.
    It's nearly impossible to create an invalid XML file with the UI and if you are not sure about certain XML parameters, the UI can be of a big help for you.



While the tools above were all 100% AutoYaST related and are only useful in combination with something autoyastish, the following tools are used by people who never heared of AutoYaST too.

  • xsltproc
    xsltproc is part of the libxslt RPM.
    This tool is used to apply XSLT files on a XML file.
    "What???!" - well, you only have to know that AutoYaST uses a XSLT file to merge multiple XML files into one big file. So when you use AutoYaST Rules or AutoYaST Classes your single XML files will be merged to a big one with the help of /usr/share/autoinstall/xslt/merge.xslt.
    It can be very useful to test the merging before you start the actual installation to make sure everything comes out as you planned it:
    /usr/bin/xsltproc --novalid \
    --param replace "'false'" \
    --param dontmerge1 "'package'" \
    --param with "'a.xml'" \
    --output out.xml \
    /usr/share/autoinstall/xslt/merge.xslt \
    b.xml

    a.xml and b.xml will be merged to out.xml. So take a look at out.xml to see if the merging led to the expected result.
    The dontmerge parameter is explained here. In short, you need that parameter if you want to merge two XML files that have the same sections. Like two XML files both with a <software> section.

  • create_update_source.sh and createrepo
    create_update_source.sh is part of the inst-source-utils RPM, createrepo is part of the createrepo RPM
    Both tools are for creating RPM repositories. If you create such a repo and add the location to your XML file, AutoYaST can install the RPMs from that repo too. So if you want to add own RPMs to your installation, don't change the actual SUSE Installation source, but create a new repo and add your RPM's there.
    How to do that is explained here.
    Even if you only want to install RPM's that are on openSUSE or SLES, you can use these tools. You can create a repo with all online-updates that were released and AutoYaST will install those updates then instead of the original RPM's.


I'd say those are the most important tools around AutoYaST - have fun using them for "more power" ;-)

ciao, Uwe

Tuesday, November 17, 2009

Interactive AutoYaST Rules

This article describes a new feature of AutoYaST in openSUSE 11.3 (a backport for 11.2 is available too).

The rules.xml file describes how AutoYaST creates the complete XML profile out of single XML snippet files. Like for example "if the main memory is more than 2GB, use kde.xml, else use windowmaker.xml", "if you find more than one harddisk, use lvm.xml, else use simple_partitioning.xml" ... and so on ...
That's available since ages in AutoYaST what's new now is, that you can present all XML snippets you have to the users so they can select which ones to use on their own.
Confused but curious? Then read on ....

A while ago I read a feature request on the AutoYaST mailinglist that it would be cool to have the <rules> visible and selectable during installation and I was thinking: "Sounds like a good idea. So why not?". So here it is.
People love pictures so lets start with a screenshot:

On the screenshot you can see a dialog where you can choose between two rules where the first one is pre-selected and the second one is greyed out because it conflicts with the first one (I'll explain later what that conflict means).
Lets take a look at the interesting part of the rules.xml file now to see how to create such a dialog.

<rules config:type="list">
...
<rule>
<custom1>
<script>
<![CDATA[
echo -n 100
]]>
</script>
<match>100</match>
<match_type>exact</match_type>
</custom1>
<result>
<profile>rules/kde.xml</profile>
<continue config:type="boolean">true</continue>
</result>
<dialog>
<element config:type="integer">0</element>
<question>KDE Desktop</question>
<title>Desktop Selection</title>
<conflicts config:type="list">
<element config:type="integer">1</element>
</conflicts>
<dialog_nr config:type="integer">0</dialog_nr>
<timeout config:type="integer">30</timeout>
</dialog>
</rule>
<rule>
<custom1>
<script>
<![CDATA[
echo -n 100
]]>
</script>
<match>101</match>
<match_type>exact</match_type>
</custom1>
<result>
<profile>rules/gnome.xml</profile>
<continue config:type="boolean">true</continue>
</result>
<dialog>
<element config:type="integer">1</element>
<dialog_nr config:type="integer">0</dialog_nr>
<question>Gnome Desktop</question>
<conflicts config:type="list">
<element config:type="integer">0</element>
</conflicts>
</dialog>
</rule>
<rule>
...
</rule>
...
</rules>

That's not a complete rules.xml but only the interesting part with the two rules that created the dialog you see in the screenshot.
Here comes the description of the single XML elements:

  • <dialog_nr config:type="integer">0</dialog_nr>

    That's a uniq id for the a popup dialog. All rules with the same dialog_nr are presented on the same popup dialog. This element is optional and the default for a missing dialog_nr is always "0". If you have one popup only anyway, you don't need to specify the dialog_nr.

  • <element config:type="integer">0</element>

    element needs to be a uniq id. Even if you have more than one dialog, you must not use the same id twice like an element-id "1" on dialog 1 and and element-id "1" on dialog 2 too. That's different than with <ask> dialogs, where you can have the same <element> id on multiple dialogs. I'll explain later why this is.

  • <title>Software Selection</title>

    that's a text string at the top of the dialog. A caption for that dialog if you want so and it's optional. If you configure multiple titles for one dialog, the last one is used.

  • <question>KDE Software Selection</question>

    That's the text string behind the checkbox. If you don't configure a question, the name of the XML file that is triggered by this rule will be shown instead (in our example above, that would be "rules/kde.xml" and "rules/gnome.xml"). If you know what's in kde.xml and gnome.xml you maybe don't need the <question> but I'd prefer a short explaining text over just a filename.

  • <timeout config:type=""integer">30</timeout>

    if you don't answer the dialog in "timeout" seconds, AutoYaST will continue.
    As soon as you touch one checkbox or button, the timeout stops for this popup and you have to press "okay" to continue. The next dialog can have a new timeout then.

  • <conflicts config:type="list">

    here you can specify a list of element id's that conflict with this XML file. If you select this XML file, the conflicting one(s) will be deselected and disabled. Be careful what you configure here, you can create deadlocks. An element can conflict with another element on a different dialog and that's the reason why element id's have to be uniq.


Whether a question is pre-selected or not is defined by the result of the rule. In my example above, I configured a rule that matches always (100 = 100) and a rule that matches never (101 = 100). Without dialogs, such a rule file would not make a lot of sense because gnome.xml would never be used but here I use them to do the default pre-selection.
So again, if a rule matches, the file (kde.xml in our example) is pre-selected.
That means, if you add dialogs to your already existing rules.xml that has no dialogs yet and you set a timeout, your autoinstallation process will be the same like before, except that you'll see a popup dialog for "timeout" seconds. The rules work like before and you can see which ones have matched in the popups.

To sum things up:

All dialog configuration is done in the rules.xml file. Each <rule> can have one <dialog> which represents one checkbox on a dialog popup. You can have multiple dialog popups and you can have multiple rules (checkboxes) on one dialog popup.


This feature is officially implemented for openSUSE 11.3 but since openSUSE 11.2 is brand new and out for just a few days now, I made a driverupdate_11.2.tar.bz2 to make the feature available for openSUSE 11.2 too. If you want to try it, download and extract the file and copy the "driverupdate" file to the root of your installation source to get that feature on openSUSE 11.2.
Feedback is appreciated.

Thanx to Stacey Murphy and Martin Vogt for the idea.


have fun creating your own rules ;)
Uwe

Thursday, October 22, 2009

Meet and Greet with AutoYaST

Bubli said that it might be a good idea to write an article of a very basic step by step instruction for AutoYaST and I had to agree with that. So this is more for people who don't ask questions like "can I use the 'ask' feature for 'rules' in AutoYaST?" ;)

So if you answer those questions with YES, then this article is for you:
  • you have never used AutoYaST
  • you just have a vague idea of what it is
  • you always thought it's too complicated and too much work for "just taking a quick look at it"
if you nodded three times, read on, I wrote this especially for you

What do we need for this tutorial?
  • an openSUSE boot CD/DVD like the openSUSE 11.2 DVD
  • a USB stick and a way to read/write to that stick (like an installed Windows or Linux system)
  • a physical machine for the test run (needs a DVD/CD drive and a USB port). The machine CAN be installed but you'll have the chance to abort the process before anything happened, so nothing will have changed then except that you'll know more about AutoYaST :-)
First of all you have to save the small AutoYaST XML snippet below in a file onto the USB stick. It doesn't matter which filesystem you have on the USB stick. It can be a Linux filesystem like for example ext4 but it can also be fat32 too, as long as openSUSE can mount the stick for reading.
Here is the file we want to use:

<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns"·
xmlns:config="http://www.suse.com/1.0/configns">
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<user_password>s3cr3t</user_password>
<username>root</username>
</user>
</users>
</profile>
copy that file to the USB stick and name it for example "my.xml". You can name it like you want but I'll refer to it by "my.xml". Later we will take a closer look to the XML file but for now we just want to see AutoYaST in action.
Put the SUSE DVD into the machine and plug the USB stick in too. Now boot from that DVD until you see the bootmenu:
Move the cursor to "Installation" and then type "autoyast=usb:///my.xml" to the prompt, like I did on the screenshot. That "autoyast=...." parameter triggers the automatic installation instead of the manual installation. Of course "usb:///..." is just an example and tells AutoYaST to look for the XML file on all USB devices.

After a while, yast will show up and will present you the so called "proposal screen" that you have to confirm if you are happy with the settings. That screen can be seen during the manual installation too, so it'll be familiar to you. You can do all kind of changes now.

To get a real "free-hand" installation you can turn that confirmation screen off in the AutoYaST XML file but the default is to show it and for this tutorial it's a good idea to take that break to see what AutoYaST will do. Nothing has happened so far to your machine. We could turn off the computer now and your system would be the same like before you booted AutoYaST.

Since we did not specify any partitioning in the AutoYaST XML file, AutoYaST will calculate a reasonable partition plan that you can see on the proposal screen now. It might look different on your hardware than on mine in the screenshot because it depends on your hardware and what kind of partitions you already have on the harddisk.

If you look at the software proposal on the screen, you can see that it's quite minimalist. It will only install 526 MB of software, which is just the base pattern and does not even include a X Window system. We can change that in our my.xml file of course but lets click "Install" for now on the bottom right, to start the installation (or turn off the machine if you don't want to apply any changes).

AutoYaST will partition the harddisk now and will install the software, which looks like during a manual installation.
While AutoYaST is doing it's job, we can take a look at the XML file again.
Every AutoYaST profile starts with the same header:

<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns"
xmlns:config="http://www.suse.com/1.0/configns">

and ends with the same footer:

</profile>

Everything between the <profile> elements is your configuration.
In our my.xml file it's only the configuration of the root user with the password "s3cr3t". Actually not even that would be needed for an installation but without a root user, you can not login at the end.
You probably want to configure an own software selection too because we already saw that the system which is installing right now is very small.
The partitioning is something many people want to customize too, to have control on how exactly it looks like in the end and to be able to configure more complex setups like LVM or RAID.

So that would add a <software> and <partitioning config:type="list"> section to the profile like this:

<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns"
xmlns:config="http://www.suse.com/1.0/configns">
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<user_password>s3cr3t</user_password>
<username>root</username>
</user>
</users>
<software>
...
</software>
<partitioning config:type="list">
...
</partitioning>
</profile>

Since this text is for unexperienced AutoYaST users, I want to recommend to use the AutoYaST UI to configure a profile instead of a texteditor. You need to install the autoyast2 package for that and then you can start the UI by typing "yast2 autoyast" on the command line or by clicking on "Miscellaneous" and then on "Autoinstallation" in the YaST2 control center.

In the meantime our automatic installation should have rebooted and AutoYaST has finished the so called "2nd stage installation" where some post configuration happens. There is not so much to see there and AutoYaST will terminate without user interaction when it's finished. At the end you'll see the login prompt where you can login with username "root" and password "s3cr3t". I think you deserved a delicious piece of cheesecake now ;-)

That's it. The very basic steps of using AutoYaST to install a system. Maybe there will be more articles like this in the future, making the installation more and more complex because this were really just the basics.

Some important links:
AutoYaST Homepage
Archive of the AutoYaST mailinglist
Subscription to the AutoYaST mailinglist

thanks for flying AutoYaST - have fun ;)

P.S.: if you want to skip the confirmation screen, add this to your XML file between the <profile> tags:

<general>
<mode>
<confirm config:type="boolean">false</confirm>
</mode>
</general>

Tuesday, July 7, 2009

More Timeouts for AutoYaST

Run, Lola, Run!
a famous german movie

Today I want to introduce you some new timeouts you can configure in AutoYaST.
On openSUSE 11,2 you can use timeouts in two new places.

  • The feedback popups of your scripts can timeout now if you want

  • The ask-dialogs can timeout now too


So even with feedback and ask-questions, you can now have a non-stop installation.
How does it work? Lets start with the feedback dialogs:

<script>
<source>
<![CDATA[
echo "this feedback will timeout"
]]>
</source>
<feedback config:type="boolean">true</feedback>
<feedback_type>message</feedback_type>
<debug config:type="boolean">false</debug>
</script>
...
<report>
<messages>
<log config:type="boolean">false</log>
<show config:type="boolean">true</show>
<timeout config:type="integer">5</timeout>
</messages>
</report>

This is an ordinary AutoYaST script which makes use of the feedback mechanism and there is nothing special with it except for the new feedback_type. This type can be "message", "warning" or "error" and if you are experienced with AutoYaST, you might notice that these are the same values that you can configure timeouts for in the <report> section.
Your scripts will timeout like you configure it in the report section if you specify a feedback_type for them.
Without that feedback_type, the old behaviour of a blocking popup is used.

On ask dialogs it works a bit different:

<ask>
<title>Password: root</title>
<path>users,0,user_password</path>
<question>Password for root</question>
<password config:type="boolean">true</password>
<default>lousypassword</default>
<timeout config:type="integer">20</timeout>
</ask>

You can configure the timeout in seconds for each dialog and if the user does not answer the dialog in time, it will continue with the assumption that the default value is wanted.
Without that <timeout ...>, the old behaviour of a blocking ask-dialog is used.

Run, AutoYaST, Run!

au revoir, Uwe

Thursday, June 18, 2009

One string to rule them all ...

... one string to find them
Lord of the Rings (almost)

On openSUSE 11.2 I did a little change with the handling of how AutoYaST looks for the profile on devices. Currently you have to do it this way:

autoyast=device://sde2/mydir/myprofile.xml

to find the profile on /dev/sde2 in the path /mydir/myprofile.xml.
On openSUSE 11.2 you can use one string to find a profile on every device AutoYaST can find. So with:

autoyast=device:///mydir/myprofile.xml

AutoYaST will look for the profile on every device it can mount and will stop looking when the profile is found. Take care that you use three slashes if you want to use that feature. The old syntax with naming the device still works of course.
Actually that can even make the autoyast=usb://myprofile.xml superfluously because USB devices are found and mounted too with the new feature. I'll still keep the old USB syntax for a while but I might change the code underneath the veil to use the new "devices://" code.

Ciao! - Uwe

Wednesday, June 10, 2009

Two AutoYaST Features by One Char

and the star char is - The Slash!

Feature 1:
On openSUSE 11.2, if you add a "/" at the end of a filename in the <files> section, AutoYaST will create a directory:


<files config:type="list">
<config_file>
<file_path>/myData/</file_path>
<file_permissions>644</file_permissions>
</config_file>
...
</files>


Maybe nothing which makes the crowd go wild but might be useful from time to time and saves you from writing a script just for that.

Feature 2:
That's a bit more impressive than the first. If you use a "/" at the beginning of a <package> or <pattern>, you tell AutoYaST to interpret it as a regular expression like this:


<software>
<patterns config:type="list">
<pattern>/.*_server</pattern>
</patterns>
<packages config:type="list">
<pattern>/kde4.*</pattern>·
</packages>
</software>


Beware of using <package>/.*</package> because that will select every package and some of them conflict.

happy slashing ;) - Uwe

Tuesday, June 2, 2009

AutoYaST and LVM striping

A less known fact of the AutoYaST LVM configuration is, that it can do striping too. The reason for that being less known might be, that I just documented it a few weeks ago, even though that feature was available since ages.
If you now say "I want that!!! What is it good for?" you can read this article. In a nutshell, with striping you spread the harddisk IO across multiple physical devices which increases the IO performance but also the risk of data loss, so never use that without a RAID system below.

How to use that in AutoYaST? Just configure the number of physical devices and the blocksize in KB like this:


<drive>
<device>/dev/data_vg</device>
<is_lvm_vg config:type="boolean">true</is_lvm_vg>
<type config:type="symbol">CT_LVM</type>
<partitions config:type="list">
<partition>
<filesystem config:type="symbol">ext3</filesystem>
<lv_name>my_data_lv</lv_name>
<mount>/data</mount>
<stripes config:type="integer">2</stripes>
<stripesize config:type="integer">4</stripesize>
<size>10G</size>
</partition>
</partitions>
<pesize>4M</pesize>
<use>all</use>
</drive>

That's the same like you would do without striping, except for those two keys:

<stripes config:type="integer">2</stripes>

which is the number of physical devices you use. And:

<stripesize config:type="integer">4</stripesize>

which is the size of a block in KB. So after writing 4kb the physical device will be switched.
That's all you need to activate striping on a logical volume.


happy striping - Uwe

Thursday, April 30, 2009

Keep what you got

Let's say the docs present a simplified view of reality...
Larry Wall

Recently I got a bugreport against SLES11 by a customer who uses an undocumented a secret feature of AutoYaST that is quite fancy. It's hidden in the <networking> section and that option can not be configured with the UI. It's called:

<keep_install_network config:type="boolean">false</keep_install_network>

unfortunately that feature is broken on openSUSE 11.1 and SLES11 (that's why there was a bugreport) but will be fixed for openSUSE 11.2 and maybe on SP1 for SLES11.
What does it do? Well, actually you can take it literally. A networking section like this ...

<networking>
<keep_install_network config:type="boolean">true</keep_install_network>
</networking>

... will keep the network configuration that was created by linuxrc by doing an installation of the system over a network. linuxrc will raise the network then to connect the installation source and with that boolean set to true in the XML file, AutoYaST will copy that network configuration into the installed system. So if the network configuration during the installation is the same you want in the running system, you don't have to configure it in the XML file. Just set that boolean to true and you'll keep your installation network in the running system.

Thanx to Bubli and Michal for supporting me with that bug.

au revoir - Uwe

Friday, April 3, 2009

A new kind of Script

I love flying. I've been to almost as many places as my luggage.
Bob Hope

Since openSUSE 11.2 (not in SLES11) you can use a new kind of script called "postpartitioning-script". That script runs between the pre-scripts and the chroot-scripts after the partitioning is done by autoyast and the system is mounted to /mnt. The fstab is written too but nothing is installed yet, so the system is quite empty currently (and can not be called "system" actually at that stage).
You can mount something into the system for example that was not specified in the XML file but is required during the installation.
The script definition in the XML file is very similar to the other scripts:

<postpartitioning-scripts config:type="list">
<script>
<filename>postpart.sh</filename>
<interpreter>shell</interpreter>
<debug config:type="boolean">false</debug>
<feedback config:type="boolean">true</feedback>
<source><![CDATA[
touch /mnt/a_test
echo Hi
]]>
</source>
</script>
</postpartitioning-scripts>


have a nice weekend, Uwe

Friday, March 20, 2009

imag(in)e AutoYaST

"Come to the edge.
We might fall.
Come to the edge.
It’s too high!
COME TO THE EDGE!
And they came,
and he pushed,
and they flew."

Christopher LOGUE

Since openSUSE 11.1 you can use the deploy_image element to use the pre-defined images of openSUSE. I have written an article about that a few weeks ago already. It's very easy to use and can speed up your installation remarkable but it's a bit inflexible.
Today I want to show you an experimental feature of AutoYaST that is available since a few releases and is a lot more flexible and a lot faster too. I did an installation of a kde4 system and measured the time from the proposal screen until the reboot happened and here are the numbers:



kde4 system with RPMs only1051 RPMs19 minutes
kde4 system with pre defined images1051 RPMs13 minutes
kde4 system with a kiwi image1031 RPMs3,5 minutes

All systems were about 2,8GB in size.

What you have to do for that is to create an image that AutoYaST dumps on the harddisk instead of installing RPMs. You specify it like
this in the AutoYaST XML file:

<software>
<image>
<script_location>http://10.10.0.162/image.sh</script_location>
<run_kickoff config:type="boolean">true</run_kickoff>
</image>
</software>

The kickoff is needed to configure the bootloader.

You can't configure any packages or patterns anymore, because all software has to be in your image. Here comes the image.sh I have used for my test:

#!/bin/sh
# if you don't want to deal with the fstab,
# you can also remove that file from your image
# so the one created by autoyast is not overwritten
# by your image extraction
mv /mnt/etc/fstab /tmp/
wget -O - http://10.10.0.162/kiwi_image.tgz 2>/dev/null| tar xfz - -C /mnt
mv /tmp/fstab /mnt/etc

as you can see, the script AutoYaST will run fetches an image from a HTTP server and pipes it into tar, which will extract it into the /mnt directory. The /mnt directory is the directory where your freshly partitioned and formated system is mounted to during the installation.
So the last question to answer is, how to create such an image? Well, the way you create an image is up to you because AutoYaST can do all kind of things in the script but in my case, I have used kiwi. Install the following packages:

kiwi-desc-usbboot
kiwi-desc-vmxboot
kiwi-pxeboot-prebuild
kiwi-instsource
kiwi-pxeboot
kiwi-tools
kiwi-desc-xenboot
kiwi-doc
kiwi-config-openSUSE-11.1
kiwi-desc-isoboot
kiwi
kiwi-instsource-plugins-openSUSE-11-1
kiwi-desc-oemboot
kiwi-desc-netboot

not all of them are needed but it can't hurt to install them all. Then do (as root):

cp -a /usr/share/doc/packages/kiwi/examples/suse-11.1/suse-oem-preload .

and edit the XML file in that directory. All I did was changing the location of my installation source, removed the example user (I let autoyast configure the users) and changed the patterns to install to "kde4". Then call:

kiwi --prepare ./suse-oem-preload --root /space/kiwi_image

This will take a while and kiwi will install the complete system into that directory. When it's done, all you have to do is to tar that directory into the kiwi_image.tgz tarball and put it on your webserver. Of course you can do all kind of changes to that before you tar it (like removing /etc/fstab, which is created by AutoYaST anyway)

Try it out, create yourself a nice image ;)
Keep in mind that this is still an experimental feature but a nice one to play with :)
Feedback is appreciated.

ahoj Uwe

Friday, March 13, 2009

The minimum profile

"All The Small Things" - Blink 182

On SLES9 the smallest AutoYaST profile had to contain a partitioning and a software section (well, and a user section with a root user if you wanted to login). On SLES10 the software section was no longer required because AutoYaST has chosen a very small system to install (only the base pattern) if no software section was there.
Now, on openSUSE 11.1/SLES11 not even the partitioning section is required anymore. If you don't provide the partitioning information, AutoYaST will ask the storage code of YaST2 what it would suggest in a manual installation to the user and that suggestion is used by AutoYaST too then. Those suggestions are often quite conservative and YaST tries to keep other Linux/Windows partitions intact.

So on openSUSE 11.1 / SLES11 the smallest profile looks like this:


<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<users config:type="list">
<user>
<encrypted config:type="boolean">false</encrypted>
<user_password>myrootpassword</user_password>
<username>root</username>
</user>
</users>
</profile>


well, actually it looks like this:


<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
</profile>


but you can not login then.

You might say, "that's nice but where is the sense in a totally unconfigured system?" and you are right. There is not so much use in it. All I wanted to show with this article is, that you can try out AutoYaST without configuring a full blown XML file. Now you can start to fill that XML file with flesh step by step, section by section. Put it on an USB stick for example and add autoyast=usb:///my.xml to the boot menu of an openSUSE 11.1/SLES11 DVD and that's it. You just fired up an autoinstallation.

bye bye, Uwe

P.S.: don't forget to buy the latest Diary of Dreams album that is released today ;)

Monday, February 23, 2009

DBus Interface of Amarok2

"Without music, life would be a mistake." - Friedrich Nietzsche

This time I want to write a short article about something completely different than AutoYaST or anything in that area.
Since I switched to KDE4 with amarok2, my little now-playing scripts for amarok and xchat did not work anymore. The interface to query amarok for the data was changed from dcop to dbus and so I had to google a bit and rewrite the eMail-signature script for kmail and write a new little script for xchat too.
So, how to squeeze the information out of the new amarok2? It's quite easy:
qdbus org.kde.amarok /Player GetMetadata

and that's it. qtbus is part of the libqt4 package and you'll get an output of everything that is interesting and that you can parse easily. Here is my little xchat2 script for example:

#!/usr/bin/perl

use strict;

Xchat::register("wumprock","1.0","Amarok xchat info");
IRC::print("Wumprock 1.0 for XChat \cB\cC3loaded\cC0 :)");
IRC::add_command_handler("curplay", "cmd_amacurplay");

sub cmd_amacurplay {
my $META = `qdbus org.kde.amarok /Player GetMetadata`;

my ($ARTIST) = ( $META =~ /artist: (.*)/ ? $1 : "-" );
my ($TITLE) = ( $META =~ /title: (.*)/ ? $1 : "not playing" );
my ($ALBUM) = ( $META =~ /album: (.*)/ ? $1 : "-" );
IRC::command("/me is now playing '$TITLE' by '$ARTIST'");
}


You can use /cur_play then in xchat to let everyone who cares (and not) know what you are listening to.

I have a smilar script for kmail to, so I can add the "now playing:" line under my signature but it looks quite the same and so I'll not paste it here.·

happy listening - Uwe

Tuesday, February 17, 2009

Static Text in Ask dialogs with openSUSE 11.2

With openSUSE 11.2 you can use a new feature of the famous ask-dialogs in AutoYaST. You can add static text to a dialog that requires no user interaction.
That makes it possible for you to put some explanation between widgets or you can create a popup that contains only a text and has to be confirmed like "press okay to start the installation".


<ask>
<question></question>
<type>static_text</type>
<dialog config:type="integer">1</dialog>
<element config:type="integer">1</element>
<default><![CDATA["I know a man who gave up smoking, drinking, sex,
and rich food. He was healthy right up to the time
he killed himself."

Johnny Carson
]]>
</default>
</ask>





happy autoyasting - Uwe

Monday, February 9, 2009

AutoYaST and SLP on openSUSE 11.2

Tell it to me and I will forget.
Show it to me and I might remember.
Make me do it and I will know.

Konfucius

Since openSUSE 11.2 AutoYaST supports the SLP. With autoyast=slp you can tell AutoYaST to query via SLP where it can find the profile. So for example, you can burn a DVD with "autoyast=slp" in the isolinux.cfg file and you can use that DVD in different network topologys then because the location of the autoyast profile is configured on the SLP server in the network. Here is a little example section from my /etc/slp.reg file:

# autoyast
service:autoyast:http://192.168.0.1/my_autoyast.xml,en,65535

AutoYaST will fetch the my_autoyast.xml file then from 192.168.0.1 via http. Of course it's not necessary that the SLP server is running on 192.168.0.1 too.
Another cool feature you get when using SLP is that you can choose between different profiles. If AutoYaST gets more than one profile location from the SLP server it pops up a dialog box to let you choose the right profile:



# /etc/slp.reg
# simple
service:autoyast:http://10.10.0.162/part1.xml,en,65535

# lvm
service:autoyast:http://10.10.0.162/part3.xml,en,65535

have a nice week

bye, Uwe

Monday, February 2, 2009

Why to Confirm? (Part 2)

"Anyone who has never made a mistake has never tried anything new." - Albert Einstein

Last week I started with an article about debugging the autoinstallation process. This week I want to publish the second part of it.

Debug scripts
If something with your self written scripts seems to go wrong, you can turn on the debugging of that scripts with the

<script>
<debug config:type="boolean">true</debug>
<feedback config:type="boolean">true</feedback>
...
</script>

options. If you don't turn on the feedback option, you won't see a popup but you'll still find the logs of your scripts in the /var/adm/autoinstall/logs/ directory. With feedback turned on, you'll see the log in a popup too that has to be confirmed.

Debugging the ask-dialogs
When you use the ask-dialogs and you want to test it without booting into the installation system, you should extract the complete <ask> part from the profile and store it in an own XML file. You can test the dialogs now with:

yast2 ayast_setup setup filename=/tmp/my_ask.xml

That requires that all <stage> entries in an ask-question are set to "cont" (the default is "initial"). If the <stage> is missing or set to "initial", you won't see anything with the help of "ayast_setup" because those dialogs are only raised up in stage one.
Be aware of the fact that all second stage parts of this XML file are really executed. So if there are some post-scripts in your XML for example, those will be executed too and depending on what you do in your scripts, you might end up with a slightly rearranged system :-)
ayast_setup is a very cool part of AutoYaST that can not only be used to debug your ask-sections (or any other second stage section), but also to configure a complete system with an AutoYaST profile from inside the running system (here is a nice article about it).


Problems with rules
If you use the rules feature to create a profile dynamically, you have some options for debugging too. If you want to see the values of the pre-defined rules (like "memsize", "karch", "mac" ....) you can run the client:

/usr/lib/YaST2/bin/y2base ayast_probe ncurses

You can run it in the installation system (by switching to the console via CTRL+ALT+F2 for example) or in an already installed system too (yast2 ayast_probe).
If you are using custom rules based on a shell script written by you, you can run those scripts to see how they behave in the installation environment. They are stored in /tmp/YaST2-...../rule_.... files. You can grep for that tmp dir via

grep 'Writing rule script into' /var/log/YaST2/y2log

That requires that yast has started at least once and autoyast has fetched the XML profile.
If you don't have problems with the rules scripts, but with the merging, you can merge the XML files like AutoYaST would do it to view the result:

/usr/bin/xsltproc --novalid --param replace "'false'" \
--param dontmerge1 "'package'" \
--param with "'a.xml'" --output out.xml \
/usr/share/autoinstall/xslt/merge.xslt base.xml

The dontmerge parameter can be specified in your rules.xml too (see also the merging documentation).

remote logging
if you want to transfer your logfiles (including y2log messages) to a loghost, you can simply pass the parameter "loghost=10.10.0.162" to your linuxrc parameter list. Of course you need network for that (netsetup=1) and your loghost has to accept log messages from the network (for syslog-ng that requires a udp(ip("0.0.0.0") port(514)); in the config file).

If you want to use a serial console for remote logging, pass the following to your linuxrc parameter list:
earlyprintk=ttyS0,115200 console=ttyS0,115200

115200 might be too much for your system so you might have to reduce it and ttyS0 is hardware dependent of course (might be ttyS1 or so on your system). On the remote system you might want to use screen like screen /dev/ttyS0 115200 then.

Still stuck?
If you are still stuck, you can always write a mail to the AutoYaST mailinglist (you have to subscribe to that list if you want to send mails to it).
It's always a good idea to read the FAQ too.

have fun debugging :-)

ciao, Uwe Gansert