6 The Auto-Installation Process #
6.1 Introduction #
After the system has booted into an automatic installation and the control file has been retrieved, YaST configures the system according to the information provided in the control file. All configuration settings are summarized in a window that is shown by default and should be deactivated if a fully automatic installation is needed.
By the time YaST displays the summary of the configuration, YaST has only probed hardware and prepared the system for auto-installation. Nothing has been changed in the system yet. In case of any error, you can still abort the process.
A system should be automatically installable without the need to have any graphic adapter or monitor. Having a monitor attached to the client machine is nevertheless recommended so you can supervise the process and to get feedback in case of errors. Choose between the graphical and the text-based Ncurses interfaces. For headless clients, system messages can be monitored using the serial console.
6.1.1 X11 Interface (graphical) #
This is the default interface while auto-installing. No special variables are required to activate it.
6.1.2 Serial console #
     Start installing a system using the serial console by adding the
     keyword console (for example
     console=ttyS0) to the command line of the kernel.
     This starts linuxrc in console mode and later YaST in serial
     console mode.
    
6.1.3 Text-based YaST Installation #
     This option can also be activated on the command line. To start
     YaST in text mode, add textmode=1 on the
     command line.
    
Starting YaST in the text mode is recommended when installing a client with less than 64 MB or when X11 should not be configured, especially on headless machines.
6.2 Choosing the Right Boot Medium #
There are different methods for booting the client. The computer can boot from its network interface card (NIC) to receive the boot images via DHCP or TFTP. Alternatively a suitable kernel and initrd image can be loaded from a flash disk or a bootable DVD-ROM.
    YaST will check for autoinst.xml in the root
    directory of the boot medium or the initrd upon start-up and switch to
    an automated installation if it was found. In case the control file is
    named differently or located elsewhere, specify its location on the
    kernel command line with the parameter
    AutoYaST=URL.
   
6.2.1 Booting from a Flash Disk #
For testing/rescue purposes or because the NIC does not have a PROM or PXE you can build a bootable flash disk to use with AutoYaST. Flash disks can also store the control file.
      To create a bootable flash disk, copy either the
      SUSE Linux Enterprise Server ISO image of DVD1 or the Mini CD ISO image to the
      disk using the dd command (the flash disk must not be
      mounted, all data on the device will be erased):
     
dd if=PATH_TO_ISO_IMAGE of=USB_STORAGE_DEVICE bs=4M
6.2.2 Booting from DVD-ROM #
You can use the original SUSE Linux Enterprise Server DVD-ROM number one in combination with other media. For example, the control file can be provided via a flash disk or a specified location on the network. Alternatively, create a customized DVD-ROM that includes the control file.
6.2.3 Booting via PXE over the Network #
Booting via PXE requires a DHCP and a TFTP server in your network. The computer will then boot without a physical medium. For instructions on setting up the required infrastructure, see 第 10 章 “远程安装”.
If you do installation via PXE, the installation will run into an endless loop. This happens because after the first reboot, the machine performs the PXE boot again and restarts the installation instead of booting from the hard disk for the second stage of the installation.
There are several ways to solve this problem. You can use an HTTP server to provide the AutoYaST control file. Alternatively, instead of a static control file, run a CGI script on the Web server that provides the control file and changes the TFTP server configuration for your target host. This way, the next PXE boot of the machine will be from the hard disk by default.
Another way is to use AutoYaST to upload a new PXE boot configuration for the target host via the control file:
<pxe>
  <pxe_localboot config:type="boolean">true</pxe_localboot>
  <pxelinux-config>
    DEFAULT linux
    LABEL linux
    localboot 0
  </pxelinux-config>
  <tftp-server>192.168.1.115</tftp-server>
  <pxelinux-dir>/pxelinux.cfg</pxelinux-dir>
  <filename>__MAC__</filename>
</pxe>
     This entry will upload a new configuration for the target host to the
     TFTP server shortly before the first reboot happens. In most
     installations the TFTP daemon runs as user
     nobody. You need to make sure
     this user has write permissions to the
     pxelinux.cfg directory. You can also configure the
     file name that will be uploaded. If you use the “magic”
     __MAC__ file name, the file name will be the MAC
     address of your machine like, for example
     01-08-00-27-79-49-ee. If the file name setting is
     missing, the IP address will be used for the file name.
    
To do another auto-installation on the same machine, you need to remove the file from the TFTP server.
6.3 Invoking the Auto-Installation Process #
6.3.1 Command Line Options #
     Adding the command line variable autoyast causes
     linuxrc to start in automated mode. linuxrc searches for a
     configuration file, which should be distinguished from the main control
     file in the following places:
    
- in the root directory of the initial RAM disk used for booting the system, 
- in the root directory of the boot medium 
The configuration file used by linuxrc can have the following keywords (for a detailed description of how linuxrc works and other keywords, see Appendix C, Advanced Linuxrc Options):
| Keyword | Value | 
|---|---|
| 
           | 
          Initiate an automatic upgrade using AutoYaST, see Section 4.10, “Upgrade”.
          For some use cases, you need the  | 
| 
           | Location of the control file for automatic installation, see AutoYaST Control File Locations for details. | 
| 
           | 
          Location of the control file for automatic installation.
          Similar to  | 
| 
           | Configure and start the network. Required if the AutoYaST is to be fetched from a remote location. See Section C3, “Advanced Network Setup” for details. | 
| 
           | Kernel modules to load | 
| 
           | 
          Location of the installation directory, for example
           | 
| 
           | 
          Installation mode, for example  | 
| 
           | Server (NFS) to contact for source directory | 
| 
           | Directory on NFS Server | 
| 
           | Even with <confirm>no</confirm> in the control file, the confirm proposal comes up. | 
These variables and keywords will bring the system up to the point where YaST can take over with the main control file. Currently, the source medium is automatically discovered, which in some cases makes it possible to initiate the auto-install process without giving any instructions to linuxrc.
     The traditional linuxrc configuration file (info)
     has the function of giving the client enough information about the
     installation server and the location of the sources. Usually, this file
     is not required, but it is needed in special network environments
     where DHCP and BOOTP are not used or when special kernel modules need
     to be loaded.
    
All linuxrc keywords can be passed to linuxrc using the kernel command line. The command line can also be set when creating network bootable images or it can be passed to the kernel using a specially configured DHCP server in combination with Etherboot or PXE.
     The command line variable autoyast can be used in
     the format described in the following list.
    
- Format of URIs
- The - autoyastsyntax for the URIs for your control file locations can be confusing. The format is SCHEMA://HOST/PATH-TO-FILE. The number of forward slashes to use varies. For remote locations of your control file, the URI looks like this example for an NFS server, with two slashes:- autoyast=nfs://SERVER/PATH.- It is different when your control file is on a local file system. For example, - autoyast=usb:///profile.xmlis the same as- autoyast=usb://localhost/profile.xml. You may omit the local host name, but you must keep the third slash.- autoyast=usb://profile.xmlwill fail because- profile.xmlis interpreted as the host name.
- When no control file specification is needed
- For upgrades, no - autoyastvariable is needed for an automated offline upgrade.- For new installations, - autoyastwill be started if a file named- autoinst.xmlis in one of the following three locations:- The root directory of the installation flash disk (e.g. USB stick). 
- The root directory of the installation medium. 
- The root directory of the initial RAM disk used to boot the system. 
 
- autoyast=file:///PATH
- Looks for control file in the specified path, relative to the source root directory, for example - file:///autoinst.xmlwhen the control file is in the top-level directory of any local file system, including mounted external devices such as a CD or USB drive. (This is the same as- file://localhost/autoinst.xml.)
-  autoyast=device://DEVICE/FILENAME
- Looks for the control file on a storage device. Do not specify the full path to the device, but the device name only (e.g. - device://vda1/autoyast.xml). You may also omit specifying the device and trigger- autoyastto search all devices, for example:- autoyast=device://localhost/autoinst.xml, or- autoyast=device:///autoinst.xml.
- autoyast=nfs://SERVER/PATH
- Looks for the control file on an NFS server. 
- autoyast=http://[user:password@]SERVER/PATH
- Retrieves the control file from a Web server using the HTTP protocol. Specifying a user name and a password is optional. 
- autoyast=https://[user:password@]SERVER/PATH
- Retrieves the control file from a Web server using HTTPS. Specifying a user name and a password is optional. 
- autoyast=tftp://SERVER/PATH
- Retrieve the control file via TFTP. 
- autoyast=ftp://[user:password@]SERVER/PATH
- Retrieve the control file via FTP. Specifying a user name and a password is optional. 
- autoyast=usb:///PATH
- Retrieve the control file from USB devices ( - autoyastwill search all connected USB devices).
- autoyast=relurl://PATH
- Retrieve the control file from the installation source: either from the default installation source or from the installation source defined in - install=INSTALLATION_SOURCE_PATH.
- autoyast=cifs://SERVER/PATH
- Looks for the control file on a CIFS server. 
- autoyast=label://LABEL/PATH
- Searches for a control file on a device with the specified label. 
Several scenarios for auto-installation are possible using different types of infrastructure and source media. The simplest way is to use the source media (DVD number one) of SUSE Linux Enterprise Server. But to initiate the auto-installation process, the auto-installation command-line variable should be entered at system boot-up and the control file should be accessible for YaST.
In a scripting context, you can use a serial console for your virtual machine, that allows you to work in text mode. Then you can pass the needed parameters from an expect script or equivalent.
The following list of scenarios explains how the control file can be supplied:
- Using the Original SUSE Linux Enterprise Server DVD-ROM
- When using the original DVD-ROM (DVD #1 is needed), the control file needs to be accessible via flash disk or network: - Flash Disk. Access the control file via the - autoyast=usb://PATHoption.- Network. Access the control file via the following commands: - autoyast=nfs://..,- autoyast=ftp://..,- autoyast=http://..,- autoyast=https://..,- autoyast=tftp://.., or- autoyast=cifs://...
- Using a Custom DVD-ROM
- In this case, you can include the control file directly on the DVD-ROM. When placing it in the root directory and naming it - autoinst.xml, it will automatically be found and used for the installation. Otherwise use- autoyast=file:///PATHto specify the path to the control file.- When using a DVD-ROM for auto-installation, it is necessary to instruct the installer to use the DVD-ROM for installation instead of trying to find the installation files on the network. This can be done by adding the - instmode=cdoption to the kernel command line (this can be automated by adding the option to the- isolinux.cfgfile on the DVD).
- Using a Network Installation Source
- This option is the most important one because installations of multiple machines are usually done using SLP or NFS servers and other network services like BOOTP and DHCP. The easiest way to make the control file available is to place it in the root directory of the installation source naming it - autoinst.xml. In this case it will automatically be found and used for the installation. The control file can also reside in the following places:- Flash Disk. Access the control file via the - autoyast=usb://PATHoption.- Network. Access the control file via the following commands: - autoyast=nfs://..,- autoyast=ftp://..,- autoyast=http://..,- autoyast=https://..,- autoyast=tftp://.., or- autoyast=cifs://...
      To disable the network during installations where it is not needed or
      unavailable, for example when auto-installing from DVD-ROMs, use the
      linuxrc option netsetup=0 to disable the network
      setup.
     
autoyast and
      autoyast2 Options
     
      The options autoyast and autoyast2
      are very similar but differ in one important point:
     
- When you use - autoyast=http://..., you need to provide linuxrc with the network configuration.
- When you use - autoyast2=http://..., linuxrc tries to configure the network for you.
     If autoyast=default is defined, YaST will look
     for a file named autoinst.xml in the following
     three places:
    
- the root directory of the flash disk, 
- the root directory of the installation medium, 
- the root directory of the initial RAM disk used to boot the system. 
     With all AutoYaST invocation options, excluding
     default, it is possible to specify the location of
     the control file in the following ways:
    
- Specify the exact location of the control file: - autoyast=http://192.168.1.1/control-files/client01.xml 
- Specify a directory where several control files are located: - autoyast=http://192.168.1.1/control-files/ - In this case the relevant control file is retrieved using the hex digit representation of the IP as described below. 
If only the path prefix variable is defined, YaST will fetch the control file from the specified location in the following way:
- First, it will search for the control file using its own IP address in uppercase hexadecimal, for example - 192.0.2.91 -> C000025B.
- If this file is not found, YaST will remove one hex digit and try again. This action is repeated until the file with the correct name is found. Ultimately, it will try looking for a file with the MAC address of the client as the file name (mac should have the following syntax: - 0080C8F6484C) and if not found a file named- default(in lowercase).
As an example, for 192.0.2.91, the HTTP client will try:
C000025B C000025 C00002 C0000 C000 C00 C0 C 0080C8F6484C default
in that order.
     To determine the hex representation of the IP address of the client,
     use the utility called /usr/bin/gethostip available
     with the syslinux package.
    
# /usr/bin/gethostip 10.10.0.1 10.10.0.1 10.10.0.1 0A0A0001
6.3.2 Auto-installing a Single System #
The easiest way to auto-install a system without any network connection is to use the original SUSE Linux Enterprise Server DVD-ROMs and a flash disk. You do not need to set up an installation server nor the network environment.
     Create the control file and name it autoinst.xml.
     Copy the file autoinst.xml to the flash disk.
    
6.3.3 Combining the linuxrc info file with the AutoYaST control file #
     If you choose to pass information to linuxrc using the
     info file, it is possible to integrate the
     keywords in the XML control file. In this case the file needs to be
     accessible to linuxrc and needs to be named info.
    
     Linuxrc will look for a string (start_linuxrc_conf
     in the control file which represents the beginning of the file. If it
     is found, it will parse the content starting from that string and will
     finish when the string end_linuxrc_conf is found.
     The options are stored in the control file in the following way:
    
....
  <install>
....
    <init>
      <info_file>
<![CDATA[
#
# Do not remove the following line:
# start_linuxrc_conf
#
install: nfs://192.168.1.1/CDs/full-i386
textmode: 1
autoyast: file:///info
# end_linuxrc_conf
# Do not remove the above comment
#
]]>
      </info_file>
    </init>
......
  </install>
....
     Note that the autoyast keyword must point to the
     same file. If it is on a flash disk, then the option
     usb:/// needs to be used. If the
     info file is stored in the initial RAM disk, the
     file:// option needs to be used.
    
6.4 System Configuration #
The system configuration during auto-installation is the most important part of the whole process. As you have seen in the previous chapters, almost anything can be configured automatically on the target system. In addition to the pre-defined directives, you can always use post-scripts to change other things in the system. Additionally you can change any system variables, and if required, copy complete configuration files into the target system.
6.4.1 Post-Install and System Configuration #
The post-installation and system configuration are initiated directly after the last package is installed on the target system and continue after the system has booted for the first time.
Before the system is booted for the first time, AutoYaST writes all data collected during installation and writes the boot loader in the specified location. In addition to these regular tasks, AutoYaST executes the chroot-scripts as specified in the control file. Note that these scripts are executed while the system is not yet mounted.
     If a different kernel than the default is installed, a hard reboot will
     be required. A hard reboot can also be forced during auto-installation,
     independent of the installed kernel. Use the reboot
     property of the general resource (see
     Section 4.1, “General Options”).
    
6.4.2 System Customization #
Most of the system customization is done in the second stage of the installation. If you require customization that cannot be done using AutoYaST resources, use post-install scripts for further modifications.
You can define an unlimited number of custom scripts in the control file, either by editing the control file or by using the configuration system.