S390x: Difference between revisions

From Alpine Linux
No edit summary
(6 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{TOC right}}


= The boot media =
= Installation guide =
Visit: https://wiki.alpinelinux.org/wiki/S390x/Installation


For KVM, both ISO image and netboot media (kernel and initramfs) are supported.
= Docker with Alpine =
 
Running Alpine s390x containers on Docker: https://wiki.alpinelinux.org/wiki/S390x/Docker
For z/VM, netboot media is supported.
 
For LPAR, not yet supported.
 
Boot media are found at:
 
* http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/
 
 
== Kernel parameters (and parmfile) ==
The Alpine s390x boot media requires following kernel parameters to work:
 
<code>ip=dhcp</code> : use DHCP for network configuration.
 
<code>ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf:dns1:dns2</code> : use static IP configuration, each field is separated by a colon <code>:</code>
* <code>client-ip</code> ip address of the guest VM where we are going to run the installer
* <code>server-ip</code> not used, leave blank or fill with <code>none</code>
* <code>gw-ip</code>    the gateway ip address
* <code>netmask</code>  the netmask
* <code>hostname</code>  not used, leave blank or fill with <code>none</code>
* <code>device</code>    the network interface of the guest VM, default is <code>eth0</code> if left blank
* <code>autoconf</code>  not used, leave blank or fill with <code>none</code> or <code>off</code>
* <code>dns1</code>      address of the DNS server
* <code>dns2</code>      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/v3.8/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.
 
:The remote location of the <code>modloop</code> image is the same as the kernel and initramfs (see below).
 
<code>ssh_key=</code> : the remote location of your SSH public key which is used to allow SSH connection into the installer. It will be downloaded and copied into <code>/root/.ssh/authorized_keys</code> in the installer.
 
{{Note|Fetching public keys from HTTP, HTTPS and FTPS are supported. HTTP should only be used in local development network where you own the network.}}
 
{{Note|Alpine Linux security policies are against using passwords for root access via SSH as we consider using public-private key pairs is a much better approach.}}
 
 
'''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 ==
Create a virtual disk:
$ qemu-img create alpine_disk.qcow2 5G
 
==== Using iso image ====
Download latest iso image from : http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x
 
Start qemu:
 
$ qemu-system-s390x -M s390-ccw-virtio \
        -m 1024 -smp 2 -nographic -enable-kvm \
        -net nic -net tap,ifname=tap0,script=no' \
        -hda alpine_disk.qcow2 \
        -boot d -cdrom alpine-standard-3.8.2-s390x.iso
 
==== Using netboot media ====
Download the latest [http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/netboot-3.8.2/vmlinuz-vanilla kernel] and [http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/netboot-3.8.2/initramfs-vanilla initramfs].
 
Start qemu: (modify <code>ip=</code> <code>alpine_repo=</code> <code>ssh_key=</code> for your needs)
 
$ qemu-system-s390x -M s390-ccw-virtio \
        -m 1024 -smp 2 -nographic -enable-kvm \
        -net nic -net tap,ifname=tap0,script=no' \
        -hda alpine_disk.qcow2 \
        -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/v3.8/main modloop=http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/netboot-3.8.2/modloop-vanilla ssh_key=https://your-website.com/your-ssh-key.pub"
 
{{Note|If you have direct access to the qemu console, <code>ssh_key</code> might not be required.}}
 
 
== z/VM ==
To ease out the process of downloading the images, punch the readers, ipl, etc., [https://github.com/trothr/znetboot '''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> for your needs)
 
<pre>
ZNETBOOT_KERNEL=http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/netboot-3.8.2/vmlinuz-vanilla
ZNETBOOT_INITRD=http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/netboot-3.8.2/initramfs-vanilla
ZNETBOOT_PROGRESS=1M
 
alpine_repo=http://dl-cdn.alpinelinux.org/alpine/v3.8/main
modloop=http://dl-cdn.alpinelinux.org/alpine/v3.8/releases/s390x/netboot-3.8.2/modloop-vanilla
 
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
 
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 [https://raw.githubusercontent.com/trothr/znetboot/master/znetboot.exec <code>znetboot.exec</code>], and [https://raw.githubusercontent.com/trothr/znetboot/master/curl.rexx <code>curl.rexx</code>] 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''' (the file in your laptop/workstation, at '''~/alpine.znetboot''')
* On "Host File Name" box, enter '''alpine znetboot''' (the file will be in z/VM console)
 
{{Note|Beware the difference between '''the dot <code>.</code>''' and '''the space <code> </code>''' characters in the file names.}}
 
* Choose '''Send to host'''
* Choose '''Host is VM/CMS'''
* Choose either '''Fixed''' or '''Variable''' for '''Record Format'''
:Enter a number for LRECL and BLKSIZE, respectively
{{Note|Any line in '''alpine.znetboot''' that has more 80 chars (columns) will be splitted into more than 1 line when uploaded to z/VM (CMS) console via 3270. Count the number of characters/column of the longest line in your '''alpine.znetboot''' and fill it in LRECL. There is no restriction for BLKSIZE but 80 is preferred.}}
 
* Click '''Transfer File''' box
 
Repeat the same steps with <code>znetboot.exec</code> and <code>curl.rexx</code> files.
 
==== (Optional) 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>
 
or <code>filel</code> and put <code>xedit</code> on CMD column to edit respective file.
 
==== 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 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.
 
If you install on KVM, you can either SSH into the installer (below) or directly use the console starting qemu.
 
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.
 
 
After SSH-ing into the Alpine installer, 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. Go to [https://wiki.alpinelinux.org/wiki/S390x#Copying_SSH_keys_to_new_Alpine_system "Copying SSH keys to new Alpine system"] (below) to have SSH access to your new Alpine system.
 
 
== Copying SSH keys to new Alpine system ==
 
By default, Alpine disables root login with a password via SSH. SSH keys are used instead.
 
After the installer's done running (<code>Installation is complete. Please reboot.</code>), 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 (like in above example), do:
 
:<code> # mount /dev/vg0/lv_root /mnt</code>
 
:<code> # cp -ar /root/.ssh /mnt/root</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)
 
:<code> # cp -ar /root/.ssh /mnt/root</code>
 
{{Note|In 'sys' installation, 1st partition is boot, 2nd partition is swap, 3rd partition is root }}
 
 
Then run <code> # poweroff</code>.
 
Go to [https://wiki.alpinelinux.org/wiki/S390x#Login_to_new_Alpine_system "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 DASD 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 [https://wiki.alpinelinux.org/wiki/S390x#Login_to_new_Alpine_system "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 ==
After logging in to 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>


= Known Issues =
https://wiki.alpinelinux.org/wiki/S390x/Known_Issues


= s390-tools =
https://wiki.alpinelinux.org/wiki/S390x/s390-tools


= 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:
https://wiki.alpinelinux.org/wiki/S390x/Tips
 
<code># setup-disk -s 0</code>
 
{{Note|If you do 'sys' installation, there will be no swap partition anymore and 1st partition will be boot, 2nd partition will be root}}
 
 
 
= Known Issues =
1. Installation on 2 or more DASDs (either ECKD and FBA) on z/VM is not supported in the installer script (<code>setup-alpine</code>) at the moment. If you want to install/extend on more than 1 DASD, see [https://wiki.alpinelinux.org/wiki/S390x#Extending_LVM_volume "Extending LVM volume"]. However, installation on 2 or more virtio (SCSI) disks on KVM are supported just like other architectures.
 




= See more =
[[category:IBM]]
Running Alpine s390x containers on Docker: https://wiki.alpinelinux.org/wiki/S390x/Docker

Revision as of 06:42, 14 September 2019