<device> guessing in AutoYaST

You probably already know, if you configure the partitioning in AutoYaST and you don’t put a <device…> entry into your <drive> section, AutoYaST will guess the device you want to use during runtime. That can be useful if you want to use the same AutoYaST XML file for systems that have for example either /dev/sda or /dev/hda devices.

AutoYaST is not bad in guessing the correct device but if it failed in that, you had to write a pre-script to do your own device detection code.
With openSUSE 12.2 and SLES11 SP2 you can support the guessing code a bit by telling AutoYaST to ignore some certain devices.
Here is an example:

...
<partitioning config:type="list">
  <drive>
    <initialize config:type="boolean">true</initialize>
    <skip_list config:type="list">
      <listentry>
        <skip_key>driver</skip_key>
        <skip_value>usb-storage</skip_value>
      </listentry>
    </skip_list>
    <partitions config:type="list">
      <partition>
    ...

you can see, the <drive> section in the XML was enhanced by a <skip_list config:type=”list”> to ignore all devices that make use of the usb-storage driver.
So if you have a USB stick plugged in, AutoYaST will ignore that stick when trying to find a device to work with.
Another example:

<drive>
  <skip_list config:type="list">
    <listentry>
      <skip_key>size_k</skip_key>
      <skip_value>1048576</skip_value>
      <skip_if_less_than config:type="boolean">true</skip_if_less_than>
    </listentry>
    </listentry>
  </skip_list>
  ...

this example will ignore all devices that are smaller than 1GB (1048576 kB) in size.
If you want to ignore devices bigger than 100GB, do it like this

    <listentry>
      <skip_key>size_k</skip_key>
      <skip_value>104857600</skip_value>
      <skip_if_more_than config:type="boolean">true</skip_if_more_than>
    </listentry>

You might wonder how you should know the keys/values for your harddisk like size_k or usb-storage for the driver key.
Just run yast2 ayast_probe and you’ll see all possible keys + their current value.

It’s only a little enhancement but it might save you from writing your own script to do the job.

have fun

ciao – Uwe

SUSE Studio Images in SUSE Manager

Today our SUSE Appliance Workshop week ended, so I want to write down a little bit of what we did this week. “We” means a teammate of mine (Johannes Renner) and I continued our work on the SUSE Studio integration into SUSE Manager. We started that with a slightly bigger team at the workshop 6 month ago but with the end of this AWS, we have reached a state where we want to present it to the public (that’s you ;) ).

As you might already know, you can create virtual machines with SUSE Manager by installing them with AutoYaST or Kickstart on a virtual host.
We thought, we have this really great SUSE Studio, where you can build VM images very quickly, so why not using SUSE Manager to deploy those Studio images? So here is what we did.

First of all, we added a page to enter your SUSE Studio credentials.
Studio Credential Page in SUSE ManagerEach organization in SUSE Manager can have its own credentials.

When you did that, you can see all the images you have created in SUSE Studio. In my case there are only two of those.
You can select those images and SUSE Manager will download them from Studio then. We are still in a prototype phase and it might happen that this interface will be dropped later because actually it’s not really needed. I’ll show you on the next page why.

When you have downloaded all the images you want to deploy, you can choose the virtual host in your systems list. That’s the physical machine where you want to deploy the image to (ug-nb.suse.de in the screenshot below).
As you can see, you can select now the images you want to deploy to your virtual host. You can also see, that we already downloaded images that are no longer available in the Studio Screenshot above. If SUSE Manager has downloaded them, they are still available there, even if they are deleted in SUSE Studio.
We have the idea to show all SUSE Studio images here directly and start the download when you select one to deploy. That would make the image-download interface shown above superfluous.
As I already said, the complete UI is still a prototype.

Once you have scheduled the deployment, the client (ug-nb.suse.de) can pick up the job with the usual SUSE Manager tools. The client will download and extract the image then and will tell libvirt to boot it immediately …
To make that image automatically register against the SUSE Manager, we have added a little snippet to the SUSE Studio image:

As you can see, the AutoYaST XML file is only used to download and execute the bootstrap script from the SUSE Manager. That script is part of every SUSE Manager and can be seen/changed in /srv/www/htdocs/pub/bootstrap.
This AutoYaST XML snippet is the only special thing you should do to use Studio images in SUSE Manager. If you don’t do it, you can still deploy the machine but SUSE Manager will not know it and hence can not manage it if you don’t register it.
You can register it later manually of course if you want.

When you register the new VM to SUSE Manager, you can work with it like with every other machine. There is no difference now between a SUSE Studio based VM or a VM installed by AutoYaST/Kickstart.

That’s it. If you have used SUSE Studio already, you know that creating an image is really very easy. Now, with just a few more clicks, you are able to deploy and manage them with SUSE Manager too.
This feature is not public yet because, as I mentioned above, we want to redesign the UI a bit and the backend needs some polishing too.

At the end I want to thank all the people who made that workshop possible! It was a great week again!

This is probably my last blog entry for this year, so have a nice xmas and a happy new year :)

ciao, Uwe

SLES Migration with SUSE Manager

With SLES11 SP2 we support unattended migrations/upgrades from SLES10 and SLES11 to SLES11 SP2. I wrote a little blog post about that a while ago.
Today I want to show you how to use that feature with SUSE Manager, so I’ll write down some steps to take for doing an unattended migration of a SLES10 system to SLES11 SP2 by using the SUSE Manager Web Interface.

Step 1 – be uptodate

make sure your SUSE Manager and the client you want to migrate has installed all available updates, including the SUSE Manager tools. I know it sounds like a phrase but this time it’s serious. You’ll run into bugs or missing features if you don’t have the latest packages.

Step 2 – sync the SP2 channels

SP2 is not an extra base-channel but the SLES11 SP1 base-channel will be enhanced by two new child channels.

  • SLES11 SP2 core
  • SLES11 SP2 updates

if you open a terminal and run:
mgr-ncc-sync -l
you’ll see something like this:

[P] sles11-sp1-pool-i586
    [.] sle11-hae-sp1-pool-i586
    [.] sle11-hae-sp1-updates-i586
    [.] sle11-hae-sp2-pool-i586
    [.] sle11-hae-sp2-updates-i586
    [.] sle11-sdk-sp1-pool-i586
    [.] sle11-sdk-sp1-updates-i586
    [X] sle11-sdk-sp2-core-i586
    [.] sle11-sdk-sp2-updates-i586
    [.] sle11-smt-updates-i586
    [.] sle11-sp1-debuginfo-pool-i586
    [.] sle11-sp1-debuginfo-updates-i586
    [.] sle11-webyast-sp1-pool-i586
    [.] sle11-webyast-sp1-updates-i586
    [.] sles11-extras-i586
    [P] sles11-sp1-suse-manager-tools-i586
    [P] sles11-sp1-updates-i586
    [P] sles11-sp2-core-i586
    [P] sles11-sp2-updates-i586

so, subscribe to the channels via
mgr-ncc-sync -c sles11-sp2-core-i586
mgr-ncc-sync -c sles11-sp2-updates-i586
and they will be added automatically as a child channel to sles11-sp1-pool-i586 in your SUSE Manager.

SLES11 SP2 Channels

SLES11 SP2 Channels

Because the SP2 channels are just children of the SP1 base-channel, you can migrate from SP1 to SP2 very easily by just adding the new child channels to the Activation Key and do a “zypper dup”. That will do an online migration (without reboot) of SP1 to SP2. unfortunately the sentence before might be wrong. In theory it should work but problems were reported with that step, so I need to try it on my own. Anyway, this blog post is about migrating with AutoYaST and not with zypper ;)
This blog post is about offline migration. That means the machine will reboot to do the upgrade – it’s not happening in the running system and the upgrade is controlled by YaST/AutoYaST, not a script doing zypper calls.

Step 3 – create an Autoinstall distribution

like with all distributions you want to autoinstall, we need to create a SLES11 SP2 distribution in the SUSE Manager. So mount the SLES11 SP2 DVD and then, in the SUSE Manager web UI, click on “Systems” -> “Autoinstallation” -> “Distributions” and then the create new distribution link in the upper right.
You’ll see a mask like the one in the screenshot.

SLES11 SP2 Autoinstall Tree

SLES11 SP2 Autoinstall Tree


In my screenshot I mounted the DVD to /media/sles11-sp2-dvd. If you remember, in step 2 we synced the SP2 channels as child channels of the SP1 base-channel. That’s why we choose the SP1 base-channel here, even if we upgrade to SP2.

Step 4 – create an Activation Key for your SP2 systems

We need to switch from the old SLES10 base channel to the new SP2 base channel and so we need a key that is bound to that channel.

Create Activation Key


don’t forget to add all the required channels to the key by clicking on Child Channels in the Activation Key menu bar.
Channels for Activation Key

Channels for Activation Key

Step 5 – upload an AutoYaST profile for the upgrade

as base I used the XML file from my blog post about the unattended upgrade process with just a few enhancements:

  • I added all child channels as an add-on
  • I added a chroot-script to fix the grub-config
  • I added an init-script SNIPPET to do the registration at the
    end of the installation automatically
<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
  <scripts>
  <chroot-scripts config:type="list">
    <script>
    <source><![CDATA[
sed -i '/^title kick/,/initrd/d' /boot/grub/menu.lst
sed -i 's/^default .*/default 0/' /boot/grub/menu.lst
]]>
    </source>
    <filename>fix_menu_lst.sh</filename>
    <debug config:type="boolean">true</debug>
    <chrooted config:type="boolean">true</chrooted>
    </script>
  </chroot-scripts>
  <init-scripts config:type="list">
$SNIPPET('spacewalk/register_sles')
  </init-scripts>
  </scripts>
  <add-on>
    <add_on_products config:type="list">
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sles11-sp1-suse-manager-tools-i586/sles11-sp2-i586-ks2</media_url>
        <name>susemanager tools</name>
        <product>SM Tools</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sles11-sp1-updates-i586/sles11-sp2-i586-ks2</media_url>
        <name>SLES11-SP1-updates</name>
        <product>SLES11 SP1 updates</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sles11-sp2-core-i586/sles11-sp2-i586-ks2</media_url>
        <name>SLES11-SP2-Core</name>
        <product>SLES11 SP2 Core</product>
        <product_dir>/</product_dir>
      </listentry>
      <listentry>
        <ask_on_error config:type="boolean">true</ask_on_error>
        <media_url>http://$redhat_management_server/ks/dist/child/sles11-sp2-updates-i586/sles11-sp2-i586-ks2</media_url>
        <name>SLES11-SP2-updates</name>
        <product>SLES11 SP2 updates</product>
        <product_dir>/</product_dir>
      </listentry>
    </add_on_products>
  </add-on>
  <upgrade>
    <only_installed_packages config:type="boolean">false</only_installed_packages>
    <stop_on_solver_conflict config:type="boolean">true</stop_on_solver_conflict>
  </upgrade>
  <software>
    <packages config:type="list">
      <package>autoyast2-installation</package>
    </packages>
    <patterns config:type="list">
      <pattern>base</pattern>
    </patterns>
  </software>
  <backup>
    <sysconfig config:type="boolean">true</sysconfig>
    <modified config:type="boolean">true</modified>
    <remove_old config:type="boolean">false</remove_old>
  </backup>
  <networking>
    <keep_install_network config:type="boolean">true</keep_install_network>
    <start_immediately config:type="boolean">true</start_immediately>
  </networking>
<general>
  $SNIPPET('spacewalk/sles_no_signature_checks')
  <mode>
    <confirm config:type="boolean">true</confirm>
  </mode>
</general>
</profile>

The ‘spacewalk/register_sles’ SNIPPET makes use of a variable called registration_key and so you want to set it to the key created in step 4. My SLES11 SP2 key is called sles11-sp2-i586-key so I set the variable to that.

Autoinstall Key Variable

Autoinstall Key Variable


You can take a closer look at the SNIPPET if you click on the Kickstart Snippets link on the left. Of course you can use your own SNIPPETS if you like – the ‘spacewalk/register_sles’ is just an example.

Step 6 – add the autoupgrade=1 parameter

autoupgrade parameter

autoupgrade parameter

to tell the installer that this will be an upgrade, you need to put autoupgrade=1 to your kernel parameter list. Do that in the Kernel Options field of the profile, like I did in the screenshot.
I have a patch ready that will do that step automatically but it’s probably not yet in the code you are using because it’s still experimental at the current state.

Step 7 – you are done

everything is prepared to do the upgrade now, so you can choose the
system you want to upgrade and go to:
“Provisioning” -> “Autoinstallation” -> “Schedule”
choose the XML profile you have uploaded in step 5

Start Migration Process

Start Migration Process


click on Schedule Autoinstallation and Finish at the bottom of that page.

The next time the machine asks the SUSE Manager server for jobs, it’ll receive a reinstallation job. It will fetch the kernel and the initrd and will write a new /boot/grub/menu.lst with a config that will load the new kernel+initrd the next time it boots – so no PXE boot is required.
A shutdown of the machine is initiated as well, that’ll take effect 3 minutes after the job was fetched.

A drawback of this method online and offline is, that you’ll lose the history of the machine in SUSE Manager. There is no way to prevent that at the moment but we’ll look into it to enhance that part of the migration but for the moment, it is like it is.

That’s all you need to know to do a migration from an old SLES to the new SLES11 SP2 with SUSE Manager.

I’d also recommend you to read the blog post about the unattended upgrade in general, so you learn more about that process.

ciao, Uwe

AutoYaST Installation Workflow

FlowchartI wanted to create a flowchart of the autoinstallation process since quite a while. Last week I visited a customer and the question “When do all the scripts actually run?” came up. So I decided that it’s really time now to go through the boring time consuming process of drawing a new chart. So here it is.
It only reflects the autoinstallation and even there some steps are missing (to keep the flowchart at a reasonable size) but I tried to cover everything that is important to know. I think 99% of the people should find every step they need to know about in the chart – at least that was my intention :)
If anything is missing, wrong or confusing – let me know please. Either in the comments, on the mailinglist or via email to me.
AutoYaST Workflow

You can click on the image for the large version and you can find a PDF version here too.

I hope this is helpful but if you are new to AutoYaST and the chart scares you, I can tell you that you don’t have to know or understand every step. You can do a complete autoinstallation with almost no knowledge about what’s going on under the hood as you can see here.

P.S.: the flowchart was created with openSUSE 11.4 and SLES11-SP2 on my mind but it’s almost correct for older versions too. I’ll try to keep it uptodate in the future and the latest version can always be found on my SUSE homepage.

have fun – Uwe

Unattended Upgrade with AutoYaST

Today I want to introduce a new feature of SLES11 SP2. Usually you use AutoYaST to do fresh installations of a system including formatting the partitions and do all kind of new-system configuration in your AutoYaST XML.
With SLES11 SP2 you’ll have the option of doing unattended upgrades of a previously installed systems too.
Imagine you have a running SLES10 SP4 and want to upgrade it now to SLES11 SP2 with AutoYaST, what are the steps to do that?
First, you need an AutoYaST XML file with the upgrade configuration like the one below:

<?xml version="1.0"?>
<!DOCTYPE profile>
<profile xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
  <upgrade>
    <only_installed_packages config:type="boolean">false</only_installed_packages>
    <stop_on_solver_conflict config:type="boolean">true</stop_on_solver_conflict>
  </upgrade>
  <software>
    <packages config:type="list">
      <package>autoyast2-installation</package>
      <package>apparmor-profile-editor</package>
    </packages>
    <patterns config:type="list">
      <pattern>base</pattern>
    </patterns>
    <remove-packages config:type="list"/>
    <remove-patterns config:type="list"/>
  </software>
  <backup>
    <sysconfig config:type="boolean">true</sysconfig>
    <modified config:type="boolean">true</modified>
    <remove_old config:type="boolean">false</remove_old>
  </backup>
  <networking>
    <keep_install_network config:type="boolean">true</keep_install_network>
    <start_immediately config:type="boolean">true</start_immediately>
  </networking>
</profile>

On the first sight it looks like a normal AutoYaST configuration but there is no partitioning or bootloader section and the complete configuration for the second stage is not needed. You already have a running and configured system and you just want to upgrade so there is nothing to configure in the system but if you want, you can add second stage configuration like in a normal autoinstallation, so post-scripts, ask-dialogs and all kind of system configuration is still possible.

There are some new sections you don’t know from a normal autoinstallation like upgrade where you can configure the behavior of the upgrade process in case of resolver errors for example.
The XML above is already complete and can be passed to the installer with the usual autoyast=….. parameter when you start the installation, like you already know from normal autoinstallations with AutoYaST.

Besides setting the autoyast=…. parameter, there is another way to pass the XML file to the installer by putting it into the /root/autoupg.xml place of your running SLES10 installation that you want to upgrade. Then you don’t need to specify autoyast=…. anymore.

The last step is to tell the SLES11 installer that you want to do an upgrade by adding the new autoupgrade=1 parameter. That’s all. Your autoupgrade configuration is done.

When you boot the installation media (DVD, PXE, grub,…) with autoupgrade=1 autoyast=http://myserver/my_upgrade.xml you will start the upgrade process. The installer will look then for the root partition of your SLES10 system and will upgrade the system.
You’ll see a proposal screen like this where you can do changes:

AutoUpgrade Screen

Autoupgrade proposal screen


If you don’t get resolver errors, you can automatically skip that screen with the usual confirm parameter you already know from autoinstallations:

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

Then you’ll have a real non-interactive upgrade.

After the upgrade finishes, YaST writes the /root/autoupg-updated.xml file, which contains the profile with applied changes done in the proposal screen. This is especially useful in case of mass upgrades of machines with the same package selection — conflict resolutions from one machine can easily be applied on other machines, which will then get conflicts resolved automatically and the upgrade itself will be non-interactive.

If there are more SLES systems installed on the machine, you’ll always be asked which one to upgrade, there is no way to select it before upgrade starts.

That’s it for the moment. There is no documentation of that feature yet in the AutoYaST Documentation but that will come of course (just in case you are wondering ;) ).

I want to thank Jiri Srain who did the implementation of that wonderful feature.

Now you have another reason to look forward to SLES11 SP2! :)

have fun, Uwe