S390x: Difference between revisions

From Alpine Linux
No edit summary
(Changing Category name to S390x from IBM)
 
(27 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{TOC right}}


= The installer =
= Installation guide =
The Alpine s390x installer includes a kernel, an initramfs (initrd image), and a parameter file.
Visit: [[S390x/Installation]]
 
Installation on KVM and z/VM are supported.
 
Installation on LPAR is not supported at the moment.
 
== Kernel parameters (and parmfile) ==
The Alpine s390x installer requires following kernel parameters to work:
 
<code>ip=</code> : the networking information, each field is separated by a colon <code>:</code>
* 1st field: ip address of the guest VM where we are going to run the installer
* 2nd field: not used, leave blank or fill with <code>none</code>
* 3rd field: the gateway ip address
* 4th field: the netmask
* 5th field: not used, leave blank or fill with <code>none</code>
* 6th field: the network interface of the guest VM, default is <code>eth0</code> if left blank.
* 7th field: fill with <code>none</code> to use static IP configuration. Fill with <code>dhcp</code> if DHCP is used.
* 8th field: address of the DNS server
* 9th field: address of the 2nd DNS server
 
<code>alpine_repo=</code> : the location of the Alpine repository from which packages are downloaded.
 
:For stable release, use <code>http://dl-cdn.alpinelinux.org/alpine/latest-stable/main</code>
 
:For rolling release, use <code>http://dl-cdn.alpinelinux.org/alpine/edge/main</code>
 
<code>modloop=</code> : the remote location of the image containing kernel's modules, required for LVM and raid setup.
 
<code>ssh_key=</code> : the remote location of your SSH public key which is used to allow SSH connection into the installer. HTTPS, FTPS, HTTP, FTP are supported.
 
<code>ssh_pass=</code> : the password to login the installer via SSH.
 
:You can use either <code>ssh_key=</code> or <code>ssh_pass=</code> even though <code>ssh_key=</code> is recommended method.
 
:If neither of these fields are specified, the default password of blank is used (see below).
 
 
'''z/VM only'''
 
<code>dasd=</code> : the addresses of the DASD devices, either ECKD or FBA DASDs. Each device is separated with a comma.
 
<code>s390x_net=</code> : the network interface type and its subchannels. At the moment, only QETH layer 2 is supported, thus the name <code>qeth_l2</code> is used (see below).
 
 
 
= Pre-installation =
 
== KVM ==
On your running s390x host, download the kernel [http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/s390x/vmlinuz-vanilla] and initramfs [http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/s390x/initramfs-vanilla].
 
Create a virtual disk:
$ qemu-img create alpine_disk.qcow2 5G
 
Start qemu: (modify <code>ip=</code> <code>alpine_repo=</code> <code>ssh_key=</code> <code>ssh_pass=</code> for your needs)
 
$ qemu-system-s390x -M s390-ccw-virtio \
        -m 2048 -smp 2 -nographic -enable-kvm \
        -hda alpine_disk.qcow2 \
        -net nic -net tap,ifname=tap0,script=no'
        -kernel vmlinuz-vanilla \
        -initrd initramfs-vanilla \
        -append "ip=192.168.1.2::192.168.1.1:255.255.255.0:none:eth0:none:8.8.8.8 alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main modloop=http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/s390x/modloop-vanilla ssh_key=https://your-website.com/your-ssh-key.pub"
 
== z/VM ==
To ease out the process of downloading the images, punch the readers, ipl, etc., '''ZNETBOOT''' [https://github.com/trothr/znetboot] is used.
 
==== Create the parm file ====
On your workstation/laptop, create a file named <code>alpine.znetboot</code> in your home directory with contents below (modify <code>dasd=</code><code>s390x_net=</code> <code>ip=</code> <code>alpine_repo=</code> <code>ssh_key=</code> <code>ssh_pass=</code> for your needs)
 
(The first line is the line holder for a wide file since z/VM's default file width is 80 chars.)
 
<pre>
# ############################################################################ HOLDER FOR WIDE FILE #
 
ZNETBOOT_KERNEL=http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/s390x/vmlinuz-vanilla
ZNETBOOT_INITRD=http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/s390x/initramfs-vanilla
ZNETBOOT_PROGRESS=1M
 
dasd=0.0.04c0,0.0.05d1
s390x_net=qeth_l2,0.0.0560,0.0.0561,0.0.0562
 
ip=192.168.1.2::192.168.1.1:255.255.255.0:none:eth0:none:8.8.8.8
alpine_repo=http://dl-cdn.alpinelinux.org/alpine/edge/main
modloop=http://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/s390x/modloop-vanilla
ssh_key=https://your-website.com/your-ssh-key.pub
</pre>
 
 
==== Upload to z/VM system via 3270 client ====
[[File:X3270-1.png|right|300px|thumb|Figure 1.]]
On your workstation/laptop, download 2 files <code>znetboot.exec</code> [https://raw.githubusercontent.com/trothr/znetboot/master/znetboot.exec], and <code>curl.rexx</code> [https://raw.githubusercontent.com/trothr/znetboot/master/curl.rexx] to your home directory.
 
Open 3270 client and log in the z/VM system with your z/VM username and password.
 
Upload 3 files <code>alpine.znetboot</code>, <code>znetboot.exec</code>, <code>curl.rexx</code> to the z/VM environment using the 3270 client (this tutorial uses x3270). On the top left corner, click "File", then "File Transfer". (Figure 1.)
 
 
Do following steps : (Figure 2.) [[File:X3270-2.png|right|300px|thumb|Figure 2.]]
* On "Local File Name" box, enter '''alpine.znetboot'''
* On "Host File Name" box, enter '''alpine znetboot'''
* Choose '''Send to host'''
* Choose '''Host is VM/CMS'''
* Click '''Transfer File''' box
 
Repeat the same steps with <code>znetboot.exec</code> and <code>curl.rexx</code> files.
 
Beware the difference between '''the dot <code>.</code>''' and '''the space <code> </code>''' characters in the file names
 
 
==== Check the configuration files ====
On 3270 client, enter following commands to check if the configuration files are correctly transferred:
 
<code>xedit alpine znetboot</code>
 
<code>xedit znetboot exec</code>
 
<code>xedit curl rex</code>
 
 
==== Start ZNETBOOT ====
On 3270 client, type below command and wait till Figure 3.: [[File:X3270-3.png|right|300px|thumb|Figure 3.]]
 
<code>znetboot alpine</code>
 
 
 
= Installation =
If you install on KVM, steps in this part does not involve the interaction with console starting qemu. Everything is done in the terminal with SSH client.
 
If you install on z/VM, steps in this part does not involve the interaction with the 3270 client anymore. Everything is done in the terminal with SSH client.
 
Either installing in KVM or z/VM environments, from your workstation/laptop, you will be able to run:
$ ssh root@192.168.1.2 (change ip address to what you specified earlier)
 
Remaining steps are similar to installing Alpine on other architectures (x86, arm, ppc, etc.), either on KVM (using virtio/SCSI disks) or on z/VM with FBA DASDs. Installing on ECKD DASDs requires an additional step, as described below.
 
 
== Example ==
Below is the detailed walkthrough of installing Alpine on a single ECKD DASD using LVM and extend that LVM to the second ECKD DASD.
 
 
On SSH client/console, run:
# setup-alpine
 
<code>Select keyboard layout [none]:</code>
:press Enter for none
 
<code>Enter system hostname (short form, e.g. 'foo') [localhost]:</code>
:enter your hostname
 
<pre>
Available interfaces are: eth0.
Enter '?' for help on bridges, bonding and vlans.
Which one do you want to initialize? (or '?' or 'done') [eth0]:</pre>
:type 'eth0' or press Enter
 
<code>Ip address for eth0? (or 'dhcp', 'none', '?') [192.168.1.2]</code>
:enter ip address or 'dhcp'
 
<code>Netmask? [255.255.255.0]</code>
:enter netmask
<code>Gateway? (or 'none') [192.168.1.1]</code>
:enter gateway's ip address
 
<code>Do you want to do any manual network configuration? [no]</code>
:enter 'no' or press Enter
 
<code>DNS domain name? (e.g 'bar.com') []</code>
:enter domain name or press Enter for none
 
<code>DNS nameserver(s)? [8.8.8.8 ]</code>
:enter DNS nameserver
 
<code>Changing password for root</code>
:enter root password
 
<code>Which timezone are you in? ('?' for list) [UTC]</code>
:enter timezone or '?' for list of timezones
 
<code>HTTP/FTP proxy URL? (e.g. 'http://proxy:8080', or 'none') [none]</code>
:enter proxy or press Enter for none
 
<code>Enter mirror number (1-27) or URL to add (or r/f/e/done) [f]:</code>
:enter a number or 'r' or 'f' or 'e' or 'done' as described
 
<code>Which SSH server? ('openssh', 'dropbear' or 'none') [openssh]</code>
:enter SSH server or press Enter for openssh
 
<code>Which NTP client to run? ('busybox', 'openntpd', 'chrony' or 'none') [chrony]</code>
:enter 'busybox' or press Enter for chrony
 
''' (next step is the additional step for ECKD DASDs on z/VM)'''
<pre>
Available ECKD DASD(s) are:
  0.0.04c0 (3390/0c 3990/e9 IBM)
  0.0.05d1 (3390/0c 3990/e9 IBM)
Which ECKD DASD(s) would you like to be formatted using dasdfmt? (enter '?' for help) [all]</pre>
:enter 'all' or '0.0.04c0 0.0.05d1' (separated by a space) to format all/both DASDs
:enter '0.0.04c0' or '0.0.05d1' to format respective DASD
:enter '?' for help
 
<code>WARNING: Erase ECKD DASD 0.0.04c0? [y/N]:</code>
:enter 'y' to format
 
<pre>
Available disks are:
  dasda (2.5 GB IBM 0.0.04c0)
Which disk(s) would you like to use? (or '?' for help or 'none') [dasda]</pre>
:enter 'dasda' or press Enter
 
<pre>
The following disk is selected:
  dasda (2.5 GB IBM 0.0.04c0)
How would you like to use it? ('sys', 'data', 'lvm' or '?' for help) [?]</pre>
:enter 'lvm'
 
<pre>
The following disk is selected (with LVM):
  dasda (2.5 GB IBM 0.0.04c0)
How would you like to use it? ('sys', 'data' or '?' for help) [?]</pre>
:enter 'sys' to install Alpine on disk
 
<pre>
WARNING: The following disk(s) will be erased:
  dasda (2.5 GB IBM 0.0.04c0)
WARNING: Erase the above disk(s) and continue? [y/N]:</pre>
:enter 'y'
 
<code>Installation is complete. Please reboot.</code>
:the installation is finished
 
At this point, don't poweroff the installer right away. Follow below part for directions to have access to your new Alpine system.
 
 
== Copying SSH keys into new Alpine system ==
 
After the installer's done running, there are 2 ways to copy your SSH key into the new Alpine system:
* Option 1: mount the installed disk and copy the SSH keys while still at the installer's terminal
* Option 2: poweroff the installer, start the new Alpine system and directly add the SSH keys
::: if you install on KVM, boot the new Alpine system on qemu, and copy the SSH keys
::: if you install on z/VM, use the 3270 client to ipl the new Alpine system and copy the SSH keys
 
'''Option 1'''
 
If you use 'lvm' + 'sys' installation scheme above, do:
 
<code> # mount /dev/vg0/lv_root /mnt</code>
 
::If you use <code>ssh_key=</code> , do:
 
::<code> # cp -ar /root/.ssh /mnt/root</code>
 
::If you use <code>ssh_pass=</code> , do:
::<code> # mkdir /mnt/root/.ssh</code>
::<code> # wget https://your-website.com/your-ssh-key.pub -O /mnt/root/.ssh/authorized_keys</code>
::<code> # chmod 700 /mnt/root/.ssh</code>
::<code> # chmod 600 /mnt/root/.ssh/authorized_keys</code>
 
 
If you use 'sys' (without LVM) installation, do
 
<code> # mount /dev/dasda3 /mnt</code> (change dasda to dasdb or dasdc , etc. for whichever DASD you chose but 3rd partition should be the same - root partition)
 
::Then do accordingly for <code>ssh_key</code> or <code>ssh_pass</code> as described above block.
 
 
Then run <code> # poweroff</code>.
 
Go to "Login to new Alpine system"
 
'''Option 2'''
 
Run <code> # poweroff</code>.
 
If you use KVM, start qemu with new Alpine system (removing <code>-kernel</code>, <code>-initrd</code>, <code>-append</code> options)
 
If you use z/VM, open the 3270 client, login with your z/VM username and password. You may need to run <code> ipl cms</code>. Then run <code> ipl 04c0</code> (or whichever device you chose as root disk in earlier steps).
 
 
Wait for new Alpine system go up, then login as root user while in the qemu console (on KVM) or 3270 client (on z/VM). Then run:
::<code> # mkdir /root/.ssh</code>
::<code> # wget https://your-website.com/your-ssh-key.pub -O /root/.ssh/authorized_keys</code>
::<code> # chmod 700 /root/.ssh</code>
::<code> # chmod 600 /root/.ssh/authorized_keys</code>
 
Go to "Login to new Alpine system"
 
 
== Login to new Alpine system ==
On your workstation/laptop, use SSH client to login new Alpine system:
<code> # ssh root@192.168.1.2</code> (or whichever ip address you used)
 
 
== Extending LVM volume ==
At your new Alpine system, run
<pre>
# apk add -q util-linux e2fsprogs-extra
 
# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
dasda            94:0    0  2.3G  0 disk
├─dasda1        94:1    0  100M  0 part /boot
└─dasda2        94:2    0  2.2G  0 part
  ├─vg0-lv_swap 254:0    0  588M  0 lvm  [SWAP]
  └─vg0-lv_root 254:1    0  1.6G  0 lvm  /
dasdb            94:4    0  2.3G  0 disk
 
# dasdfmt -b 4096 -d cdl -yp /dev/dasdb
 
# fdasd -a /dev/dasdb
 
# pvcreate /dev/dasdb1
 
# vgextend vg0 /dev/dasdb1
 
# lvextend -l +100%FREE /dev/vg0/lv_root
 
# resize2fs /dev/vg0/lv_root
 
# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
dasda            94:0    0  2.3G  0 disk
├─dasda1        94:1    0  100M  0 part /boot
└─dasda2        94:2    0  2.2G  0 part
  ├─vg0-lv_swap 254:0    0  588M  0 lvm  [SWAP]
  └─vg0-lv_root 254:1    0  3.9G  0 lvm  /
dasdb            94:4    0  2.3G  0 disk
└─dasdb1        94:5    0  2.3G  0 part
  └─vg0-lv_root 254:1    0  3.9G  0 lvm  /
</pre>
 


= Docker with Alpine =
Running Alpine s390x containers on Docker: [[S390x/Docker]]


= Known Issues =
[[S390x/Known_Issues]]


= Tips =
= Tips =
If you want to disable swap partition, after finishing NTP client step, quit the installer by pressing <code>Ctrl + C</code>. Then run following command to complete remaining steps:


<code># setup-disk -s 0</code>
On a default Alpine installation, some firmware packages ({{Pkg|linux-firmware-*|arch=s390x}}) will get installed. On s390x, most of these are not needed.


In order to remove them, install the package {{Pkg|linux-firmware-none|arch=s390x}} by running:


{{Cmd|apk add linux-firmware-none}}


= Known Issues =
= See Also =
1. If you use <code>ssh_pass=secret</code> and while running the installer you change root password to <code>supersecret</code>, the new Alpine system will have password as <code>secret</code> instead. This is a known bug. However, you could always login to new system directly, either on qemu console or 3270 client console to change root password to <code>supersecret</code> after installation.
* [https://fwupd.org/ LVFS - Linux Vendor Firmware Service]
 
2. Installation on 2+ DASDs (both ECKD and FBA) on z/VM is not supported in the installer script at the moment. If you want to install/extend on more than 1 DASD, see "Extending LVM volume". However, installation on virtio disks on KVM are supported just like other architectures.


3. Only QETH layer 2 is supported at the moment on z/VM.
[[category:s390x]]

Latest revision as of 15:48, 15 October 2024

Installation guide

Visit: S390x/Installation

Docker with Alpine

Running Alpine s390x containers on Docker: S390x/Docker

Known Issues

S390x/Known_Issues

Tips

On a default Alpine installation, some firmware packages (linux-firmware-*) will get installed. On s390x, most of these are not needed.

In order to remove them, install the package linux-firmware-none by running:

apk add linux-firmware-none

See Also