AutomatedInstallsWithPreseed

Differences between revisions 48 and 49
Revision 48 as of 2019-05-31 08:24:57
Size: 16193
Editor: fheimes
Comment:
Revision 49 as of 2023-04-19 11:38:50
Size: 16271
Editor: fheimes
Comment:
Deletions are marked like this. Additions are marked like this.
Line 151: Line 151:
If the PARMFILE.ubuntu and ubuntu.exec files are going to be modified on a workstation (and not - as sown below - on z/VM CMS), simple LF must be used instead of CR/LF and the files need to be transferred in ASCII mode, rather than BINARY mode in combination with 'site fix 80', which is required for the kernel.ubuntu and initrd.ubuntu files. If the PARMFILE.ubuntu and ubuntu.exec files are going to be modified on a workstation (and not - as sown below - on z/VM CMS), simple LF must be used instead of CR/LF and the files need to be transferred in ASCII mode, rather than BINARY mode in combination with 'site fix 80', which is required for the kernel.ubuntu and initrd.ubuntu files. The format of the parm file can either be in fixed record format or variable.

Automated Ubuntu Server Installations on s390x with preseed

One of the Debian installers (d-i) advanced options is the automated install mode via preseed - a combination of special boot parameters and a preseed file.

The (d-i) installer on s390x runs in netboot mode and has two stages - the initial stage (before networking has been started in the installer, usually run at the console) and the second stage that is usually run via ssh.

Automating the installation can be done in multiple ways:

  • Pass preseed keys or aliases via parmfile: e.g. debian-installer/locale=en_US domain=myhostname
  • Append complete preseed.cfg to the initrd.ubuntu
  • Preseed networking information via parmfile, and use url= parameter to fetch the rest of the config over the network

Depending on your setup, you may want to preseed some or all keys one one of the above methods, or combination of methods.

For details information on d-i preseeding please see the installation guide at https://help.ubuntu.com/lts/installation-guide/index.html

Some hints and examples are available below.

In the paramfile the format of the keys is simple space separated key=value pairs, e.g.: ` priority=critical locale=en_US preseed/url=http://example.com/preseed.cfg ... `

In the preseed files as fetched by preseed/url, preseed/file, or appended to the initrd.ubuntu the formatting is slightly more verbose - standard debconf: ` d-i debconf/priority string critical d-i debian-installer/locale string en_US ... `

Aliases

Because the boot prompt can become quite long, there are short forms available, called aliases, at least for some parameters, like 'locale' instead of 'debian-installer/locale' or 'url' instead of 'preseed/url'. The boot parameters as well as their aliases form key/value pairs with an equal sign '=' as link.

Alias

Normal

priority

debconf/priority

language

debian-installer/language

country

debian-installer/country

locale

debian-installer/locale

theme

debian-installer/theme

auto

auto-install/enable

classes

auto-install/classes

file

preseed/file

url

preseed/url

domain

netcfg/get_domain

hostname

netcfg/get_hostname

interface

netcfg/choose_interface

protocol

mirror/protocol

suite

mirror/suite

modules

anna/choose_modules

recommends

base-installer/install-recommends

tasks

tasksel:tasksel/first

desktop

tasksel:tasksel/desktop

dmraid

disk-detect/dmraid/enable

keymap

keyboard-configuration/xkb-keymap

preseed-md5

preseed/file/checksum

Please find a table with all aliases here.
All parameters need to be in a single line for an LPAR installation. For an z/VM guest installation they need to be placed in the PARMFILE - more on that later.

z Systems specific boot parameter

Especially for the initial stage, which is quite system dependent, there are several mainframe-specific parameters available.
These have the prefix: "s390-..." (don't care about the missing 'x', it also works on s390x, means 64-bit)
With the help of these you can overcome/answer even the initial questions.

Some example 's390-' boot parameters are:

  1. Network device type
    s390-netdevice/choose_networktype=qeth

  2. OSA-Express QDIO / Hipersockets device
    s390-netdevice/qeth/choose=0.0.0600-0.0.0601-0.0.0602

  3. Layer2 or Layer3 mode
    s390-netdevice/qeth/layer2=true

  4. Relative port
    s390-netdevice/qeth/port=0

There is not much documentation about these 's390-' parameters, the best way to look them up is therefore the full list of debconf templates available here:

Especially the following templates:

The following tables show the most relevant s390-specific boot parameters:

Table: s390-netdevice parameters

Key

Value

Description

s390-netdevice/choose_networktype

selection; choices: ctc, qeth, iucv, virtio

Network device type

s390-netdevice/ctc/protocol

selection, choices: S/390 (0), Linux (1), OS/390 (3); default: S/390 (0)

Protocol for this connection

s390-netdevice/qeth/choose

selection, choices: {choices}

OSA-Express QDIO or Hipersockets device

s390-netdevice/qeth/port

string, default: 0

Relative Port

s390-netdevice/qeth/layer2

boolean, default: false

Device in layer2 mode

s390-netdevice/iucv/peer

string

Name of VM peer

For further details see: Template: s390-netdevice

Table: s390-dasd

Key

Value

Description

s390-dasd/dasd

string

one or more DASD devices using comma ',' to separate multiple entries

complete dasd device number, incl. leading zeros, separated by dots '.'

s390-dasd/auto_format

boolean

format DASD device automatically in case it is not low-level formatted

s390-dasd/force_format

boolean

force DASD device format even in case it was already low-level formatted

For further details see: Template: s390-dasd

Table: s390-zfcp

Key

Value

Description

s390-zfcp/zfcp

string

one or more SCSI devices using comma ',' to separate multiple entries

each entry consists of a zfcp host adapter, optionally followed by the WWPN and LUN, like:

0.0.1234,0.0.5678:0x2005000e11159c32:0x1234567800000000

For further details see: Template: s390-zfcp

The preseed commands of the second stage can either specified as boot parameters (they don't have the 's390-'), at least partly, or in a preseed config file, like "url=http://<your_preseed_server>/preseed.cfg". The preseed configuration file can be located on a ftp server, a http server or it can be included in the root directory of the initrd. If there was already a ftp server prepared for an ftp-based installation, the same system can be used as preseed server, which would ensure that the preseed file can be found during boot and install time at the same system. In case the Ubuntu servers have no direct connection to the internet, the public update server can't be directly used, hence the install and preseed system may even act a local update server. In case of a full automated installation with dynamic network some additional resources are obviously needed, like DHCP and DNS.

Here is an example of a boot parameter set:
ro locale=en_US s390-netdevice/choose_networktype=qeth s390-netdevice/qeth/choose=0.0.C000-0.0.C001-0.0.C002 s390-netdevice/qeth/layer2=true s390-netdevice/qeth/port=0 netcfg/get_ipaddress=10.245.236.12 netcfg/get_netmask=255.255.255.0 netcfg/get_gateway=10.245.236.1 netcfg/get_nameservers=10.245.236.1 netdevice/qeth/layer2=true netcfg/confirm_static=true netcfg/disable_dhcp=true netcfg/vlan_id=1234 netcfg/use_autoconfig=1 netcfg/get_hostname=ZLIN12 netcfg/get_domain=domain.com network-console/password=0123456789 network-console/password-again=0123456789 url=http://install-server/ubuntu1604/s390x/preseed.cfg

It's worth to consider using the cio_ignore parameter to hide some of the devices from Linux, which may speedup the boot and install process significantly - especially in LPAR.
Here is a brief overview: http://linuxmain.blogspot.de/2011/10/using-cioignore-under-zvm.html
Keep in mind that the boot parameters are case sensitive (like 'locale=en_US')! A common locale, especially for the early install stage is btw. 'locale=C'.
Consider to put 'auto=true priority=critical' in front of 'url=...’ parameter as well: https://help.ubuntu.com/16.04/installation-guide/s390x/apbs02.html#preseed-auto
IPv6 addresses of servers hosting preseed configuration files are possible.

z/VM guest preseed installation

In case of a z/VM guest installation and now with the required boot parameters for preseed in mind the standard PARMFILE can now either be modified, or the existing PARMFILE copied into a new one with doing some modifications afterwards. In the latter case the EXEC file needs to be copied and modified as well: the 'PUNCH' statement needs to point to the new name of the PARMFILE.

Have a look at the relevant files located in the xenial-server-s390x.iso file's boot folder: kernel.ubuntu and initrd.ubuntu but especially parmfile.ubuntu and ubuntu.exec .

If the PARMFILE.ubuntu and ubuntu.exec files are going to be modified on a workstation (and not - as sown below - on z/VM CMS), simple LF must be used instead of CR/LF and the files need to be transferred in ASCII mode, rather than BINARY mode in combination with 'site fix 80', which is required for the kernel.ubuntu and initrd.ubuntu files. The format of the parm file can either be in fixed record format or variable. In this case it's recommended to open the files after the transfer to CMS with xedit to verify the format (EBCDIC) and line-ending (LF). The following steps show a sample procedure.

The file name slightly change if transferred from the workstation to z/VM CMS:

Workstation

Mainframe

initrd.ubuntu

INITRD UBUNTU A

kernel.ubuntu

KERNEL UBUNTU A

parmfile.ubuntu

PARMFILE UBUNTU A

ubuntu.exec

UBUNTU EXEC A

(The drive letter 'A' may be different on other machines.)

Upload these files as usual to the ftp server - if not already done. Using ASCII mode for parmfile.ubuntu and ubuntu.exec and BINARY mode with 'site fix 80' for kernel.ubuntu and initrd.ubuntu.
Now copy the parameter and exec file:
COPYfile PARMFILE UBUNTU A PARMFILE UBUAUTO A
COPYfile UBUNTU EXEC A UBUAUTO EXEC A
edit file 'UBUAUTO EXEC A':
xedit UBUAUTO EXEC A
and modify the line:
'PUNCH PARMFILE  UBUNTU   * (NOHEADER'
to:
'PUNCH PARMFILE  UBUAUTO  * (NOHEADER'

Now the content of the 'PARMFILE UBUAUTO A' file, which is btw empty by default, needs to be expanded with the boot parameters, taking the z/VM reader's 80 byte limit into account.
xedit PARMFILE UBUAUTO A
An example PARMFILE UBUAUTO may look like this:

ro locale=en_US auto=true priority=critical cio_ignore=01ff-0fff                
url=ftp://server/preseed/preseed.cfg s390-netdevice/choose_networktype=qeth     
s390-netdevice/qeth/layer2=true s390-netdevice/qeth/port=0                      
s390-netdevice/qeth/choose=0.0.C000-0.0.C001-0.0.C002                           
netcfg/get_ipaddress=10.245.236.12 netcfg/get_netmask=255.255.255.0             
netcfg/get_gateway=10.245.236.1 netcfg/get_nameservers=10.245.236.1             
netdevice/qeth/layer2=true netcfg/confirm_static=true                           
netcfg/use_autoconfig=1 netcfg/disable_dhcp=true netcfg/vlan_id=1234            
hostname=ZLIN42 domain=domain.com network-console/start=note                    
network-console/password=password network-console/password-again=password       

The parmfile is limited to 11 lines only, each 80 characters long.
(The precise limit is 11 lines with each * 80 characters plus additional 10 characters.)
Hence it's recommended to try specifying more than just one parameter per line, separate parameters by single spaces and use as much (shortened) aliases as possible (see above). But do not specify a single parameter (incl. it's value) across multiple lines!
The case of the parameter as well as the sequence do not matter.
(With this specification the above parmfile can be further shortened ... and if there is really a need for more characters, one can even completely omit the specification of the second install password: 'network-console/password-again=password'.)

A general sample preseed file can be found here. For a lean pressed file for KVM guest installation please have a look at this.

The output of the command 'mkpasswd -m sha-512' can be used as value for the preseed key 'passwd/user-password-crypted password'.

And finally this console log shows the console output of a fully automated preseed installation, starting with the ubuauto exec file up to a final login per console, that takes less than 5 min (incl. format, package installation and reboot).

These changes can also be done with the help of the 'FILEList' command, which is a simple file management tool.
If a command is typed beginning with upper case and at some character position with lower case, like 'COPYfile', it will be sufficient to use the upper case part to execute the command 'copy', but the full name and long version of the command is still 'copyfile'.

Another interesting source of information on using preseed on IBM z Systems is the IBM Live Virtual Class Fully Automated Installation of Ubuntu Server 16.04 with preseed presented and demonstrated by Thorsten Diehl and available, including the disk configuration file examples for two DASDs with LVM (2dasds-lvm), two FCP SCSI LUNs with LVM (2zfcp-lvm), a single DASD (1dasd), a qcow2 image file (qcow2) and a single FCP SCSI disk (1zfcp).

S390X/InstallationGuide/AutomatedInstallsWithPreseed (last edited 2023-04-19 11:38:50 by fheimes)