Installation[edit]

The guide I am using is available at http://www.josefsipek.net/docs/s390-linux/hercules-s390.html

Requirements[edit]

Install hercules, either from a package manager or from source.

Create the directory where z/linux will reside. I will be putting it in my home directory.

1 cd ~
2 mkdir zlinux
3 cd zlinux
4 mkdir rdr dasd prt

Images[edit]

Download the images from http://ftp.debian.org/debian/dists/stable/main/installer-s390/current/ into rdr/.

Create a configuration file at ~/zlinux/s390.cnf with:

 1 CPUSERIAL 000069        # CPU serial number
 2 CPUMODEL  9672          # CPU model number
 3 MAINSIZE  256           # Main storage size in megabytes
 4 XPNDSIZE  0             # Expanded storage size in megabytes
 5 CNSLPORT  3270          # TCP port number to which consoles connect
 6 NUMCPU    2             # Number of CPUs
 7 LOADPARM  0120....      # IPL parameter
 8 OSTAILOR  LINUX         # OS tailoring
 9 PANRATE   SLOW          # Panel refresh rate (SLOW, FAST)
10 ARCHMODE  ESAME         # Architecture mode ESA/390 or ESAME
11 
12 # .-----------------------Device number
13 # |     .-----------------Device type
14 # |     |       .---------File name and parameters
15 # |     |       |
16 # V     V       V
17 #---    ----    --------------------
18 
19 # console
20 001F    3270
21 
22 # terminal
23 0009    3215
24 
25 # reader
26 000C    3505    ./rdr/kernel.debian ./rdr/parmfile.debian ./rdr/initrd.debian autopad eof
27 
28 # printer
29 000E    1403    ./prt/print00e.txt crlf
30 
31 # dasd
32 0120    3390    ./dasd/3390.LINUX.0120
33 0121    3390    ./dasd/3390.LINUX.0121
34 
35 # tape
36 0581    3420
37 
38 # network                               s390     realbox
39 0A00,0A01  CTCI -n /dev/net/tun -t 1500 10.1.10.2 10.1.10.1


Create the disks

1 cd ~/zlinux/dasd
2 dasdinit -lfs -linux 3390.LINUX.0120 3390-3 LIN120  # for /
3 dasdinit -lfs -linux 3390.LINUX.0121 3390-3 LIN121  # for /home

Networking[edit]

Ensure your tun0 interface can talk out. We will make a NAT using IPTables:

1 iptables -t nat -A POSTROUTING -o eth0 -s 10.1.10.0/24 -j MASQUERADE
2 iptables -A FORWARD -s 10.1.10.0/24 -j ACCEPT
3 iptables -A FORWARD -d 10.1.10.0/24 -j ACCEPT
4 echo 1 > /proc/sys/net/ipv4/ip_forward
5 echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp

Starting the Installation[edit]

Start hercules as root

1 hercules -f s390.cnf
2 ipl c


 1 Configure the network device
 2 ----------------------------
 3 
 4 Please choose the type of your primary network interface that you will need for
 5 installing the Debian system (via NFS or HTTP). Only the listed devices are
 6 supported.
 7 Network device type:
 8   1. ctc: Channel to Channel (CTC) or ESCON connection
 9   2. qeth: OSA-Express in QDIO mode / HiperSockets
10   3. iucv: Inter-User Communication Vehicle - available for VM guests only
11 Prompt: '?' for help>
12 Command ==> .1


1 The following device numbers might belong to CTC or ESCON connections.
2 CTC read device:
3   1. 0.0.0a00      2. 0.0.0a01
4 Prompt: '?' for help>
5 Command ==> .1


1 The following device numbers might belong to CTC or ESCON connections.
2 CTC write device:
3   1. 0.0.0a00      2. 0.0.0a01
4 Prompt: '?' for help>
5 Command ==> .2
1 Protocol for this connection:
2   1. S/390 (0)  *!  2. Linux (1)      3. OS/390 (3)
3 Prompt: '?' for help, default=1>
4 Command ==> .1
1 Configure a network using static addressing
2 -------------------------------------------
3 
4 The IP address is unique to your computer and consists of four numbers
5 separated by periods.  If you don't know what to use here, consult your network
6 administrator.
7 IP address:
8 Prompt: '?' for help>
9 Command ==> .10.1.10.2
1 The point-to-point address is used to determine the other endpoint of the point
2 to point network.  Consult your network administrator if you do not know the
3 value.  The point-to-point address should be entered as four numbers separated
4 by periods.
5 Point-to-point address:
6 Prompt: '?' for help>
7 Command ==> .10.1.10.1
1 The name servers are used to look up host names on the network. Please enter
2 the IP addresses (not host names) of up to 3 name servers, separated by spaces.
3 Do not use commas. The first name server in the list will be the first to be
4 queried. If you don't want to use any name server, just leave this field blank.
5 Name server addresses:
6 Prompt: '?' for help, default=10.1.10.1>
7 Command ==> .10.1.1.8


1 Please enter the hostname for this system.
2 
3 The hostname is a single word that identifies your system to the network. If
4 you don't know what your hostname should be, consult your network
5 administrator. If you are setting up your own home network, you can make
6 something up here.
7 Hostname:
8 Prompt: '?' for help, default=debian>
9 Command ==> .zlinux
1 Command ==> The domain name is the part of your Internet address to the right of your host
2 name.  It is often something that ends in .com, .net, .edu, or .org.  If you
3 are setting up a home network, you can make something up, but make sure you use
4 the same domain name on all your computers.
5 Domain name:
6 Prompt: '?' for help>
7 Command ==> .home.steamr.com


 1 Generating SSH host key
 2 
 3 Continue installation remotely using SSH
 4 ----------------------------------------
 5 
 6 You need to set a password for remote access to the Debian installer. A
 7 malicious or unqualified user with access to the installer can have disastrous
 8 results, so you should take care to choose a password that is not easy to
 9 guess. It should not be a word found in the dictionary, or a word that could be
10 easily associated with you, like your middle name.
11 
12 This password is used only by the Debian installer, and will be discarded once
13 you finish the installation.
14 Remote installation password:
15 Command ==> .password


1 Please enter the same remote installation password again to verify that you
2 have typed it correctly.
3 Re-enter password to verify:
4 Command ==> .password


 1 Start SSH
 2 
 3 To continue the installation, please use an SSH client to connect to the IP
 4 address 10.1.10.2 and log in as the "installer" user. For example:
 5 
 6    ssh installer@10.1.10.2
 7 
 8 The fingerprint of this SSH server's host key is:
 9 91:99:19:9f:5c:03:1e:74:56:48:b0:e4:4b:a3:3a:c4
10 
11 Please check this carefully against the fingerprint reported by your SSH
12 client.
13  Press enter to continue!


Make sure Networking Works[edit]

Now that the installer is ready, we need to set up the networking.

ip a

if you don't see an IP on your tun0 device, you will need to define it manually.

ifconfig tun0 10.1.10.1
route add 10.1.10.2 gw 10.1.10.1

Once that's all set up, you should be able to SSH to the installer at installer@10.1.10.2

Install Debian[edit]

SSH to the IP, and you should begin the installation without issue. If you can't download the release data for any reason, try to SSH to the installer again and spawn a shell. From there, you can troubleshoot any networking issues you might have. For me, I ran into an issue with DNS not working due to it being on an unknown subnet.

You should go through the installation steps as you would normally would with a debian install. Eventually, you will hit a stage named " Configure direct access storage devices (DASD)". You will need to put / in DASD 0.0.0120 and /home in DASD 0.0.0.121. You do not need to format the disks.

Zlinux1.png
Zlinux2.png

Everything afterwards should be quite straight forward.

Stopping / Starting the VM[edit]

You can poweroff or shutdown the guest like you would usually.

To boot the VM, run:

lpc 120

which will boot from your /root partition.