Mastering Yast2 Firstboot

Firstboot on Yast2, wow… it’s a powerful paradigm for those that are going redistribute *SuSE based images.

The YaST firstboot utility is a special kind of configuration workflow that can be run after the basic system is installed. It is started on the first boot of the system and guides a user through a series of steps that allow for easier configuration of their desktops. http://en.opensuse.org/YaST_Firstboot

Setup

To get started with YaST Firstboot and generate your first addition to the workflow, you can do the following.

Type zypper install yast2-firstboot

To confirm, type Y

Setup the license and welcome directories

Type mkdir /etc/firstboot

Type mkdir /etc/firstboot/welcome

Type mkdir /etc/firstboot/license

Type chmod -R 755 /etc/firstboot

Edit /etc/sysconfig/firstboot

Change FIRSTBOOT_LICENSE_DIR=”” to FIRSTBOOT_LICENSE_DIR=”/etc/firstboot/license”

Change FIRSTBOOT_WELCOME_DIR=”” to FIRSTBOOT_WELCOME_DIR=”/etc/firstboot/welcome”

*** You can launch yast2.  You can click on System > /etc/sysconfig > Firstboot.

Upload your Welcome Message file and your license files to the corresponding directories

Modify the Workflow

Edit /etc/YaST2/firstboot.xml

I like to comment out the ac_step with printers.

<!–ac_step>
<text_id>ac_label_2</text_id>
<icon>yast-hwinfo</icon>
<type>proposals</type>
<ac_items config:type=”list”>
<ac_item>printer</ac_item>
</ac_items>
</ac_step–>

I then change the license agreements

<module>
<label>License Agreements</label>
<enabled config:type=”boolean”>false</enabled>
<name>firstboot_licenses</name>
</module>

I enable the license view for Novell/SuSE
<module>
<label>License Agreement</label>
<enabled config:type=”boolean”>true</enabled>
<name>firstboot_license_novell</name>
</module>

I then enable the License file for the custom image
<module>
<label>License Agreement</label>
<enabled config:type=”boolean”>true</enabled>
<name>firstboot_license</name>
</module>

I then edit the Networking proposal, so I can set custom networking details.

<module>
<label>Network</label>
<name>inst_proposal</name>
<enabled config:type=”boolean”>true</enabled>
<proposal>firstboot_network</proposal>
</module>

I then add a custom network proposal, the label is what appears on the left during the FirstBoot wizard

<module>
<label>QuickStart</label>
<name>quickstart</name>
<enabled config:type=”boolean”>true</enabled>
</module>

Creating the QuickStart Proposal

For our purposes, you’ll create a shell for your QuickStart proposal.

Mount your OpenSuSE DVD

Type zypper install yast2-devtools yast2-testsuite

Confirm the installation, type Y

Change to home folder, cd ~

Type /usr/bin/y2tool create-new-package config quickstart “Paul Bastide” “nomail@bastide.org”

Command

The create package command has created a YCP language project, it’s pretty straightforward to read through the files in the quickstart folder

Change directory into quickstart

Build and deploy the quickstart proposal,  make -f Makefile.cvs && make && make install

You’ll want to run through the log output and validate it is compiled and installed

you can launch it using yast2 quickstart (note, you can get a Graphical output if you have a Windowing environment, eg export DISPLAY=:0.0 )

quickstart-panel

To trigger firstboot on next restart, type touch /var/lib/YaST2/reconfig_system

Once, the reboot and the corresponding workflow has been completed the file will be removed.

Reboot and Test

When you are all done, you can page through your wizard and validate it’s operation.

0-2

0-4

0-3

To wrap it all up, you package the image, and ship it.  Note, you can also refer to the control.xml for more more details on the final message / finish  message.

Good Luck and I hope this helps with your wizard.

Debugging YaST2 FirstBoot

I ran into a few issues with the workflow that spanned beyond the obvious, double wizard prompts, so I needed to add debugging.

Edit /boot/grub/menu.lst

Add Y2DEBUG=1 to the end of the kernel line

Save the file

type touch /var/lib/YaST2/reconfig_system

Restart the Server

Run through your FirstBoot workflow

Navigate to /var/log/YaST2/

Open y2log

Review the log file for any errors or issues in your workflow

Issues

Issues I ran into included double prompting of the configuration wizard, I found that running through the wizard a second time after reconfig_system fixed the issue.

Activating a Script on Network Change

I needed to figure out how to launch a script to find the ip when the network was started and up on SuSE Linux. After doing some research I found out that you can add scripts to the ifup.d and ifdown.d folders.

I created a file a script

 
cd /etc/sysconfig/networking/scripts 
touch ifup.quickstart
vim ifup.quickstart 
# contents are below

Then I went ahead and added a symoblic link to /etc/sysconfig/networking/ifup.d

cd /etc/sysconfig/networking/ifup.d
ln -s /etc/sysconfig/networking/scripts/ifup.quickstart quickstart

Every time the interface is started up, it checks to see if the ip changed for the given hostname, and makes the modifications automatically.

This file is here is the one I created to do the edits to the hosts file.

Non-Standard Hostnames in the QuickStart

Do you need a new hostname?  Such as HOSTNAME_NEW=quickstart.sdkdemo.com

Open a new Terminal Session

SSH root@quickstart.sdkdemo.com

type whoami and make sure you see root…. otherwise type sudo -s

If hostname –long  doesn’t show the DNS name you want, type hostname ${HOSTNAME_NEW}

The name is then changed for the time of the session.