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