Running GNU/Linux Debian s390 under a i386

Posted by enerv on Tue 2 Jan 2007 at 06:07

Using the hercules emulator it is possible to have your system emulate an IBM mainframe! Here we'll give a brief overview of using the emulator to install a pre-made image of Woody, giving you a Debian GNU/Linux S390 system.

Installing the emulator with a fresh installation of Sarge is as simple as:

aptitude install hercules
mkdir /etc/hercules
cd /etc/hercules

wget wget

Now edit the file /etc/hercules/hercules.cnf and comment out the following line :

000C    3505    bf/vmrdr/kernel.debian bf/vmrdr/parmfile.debian bf/vmrdr/initrd.debian autopad eof

Uncomment these two lines:

0A00    3088 CTCI       /dev/net/tun 2000
0A01    3088 CTCI       /dev/net/tun 2000

Now change the line:

0300    3390    debian.3390

to read:

0300 3390  /etc/hercules/Debian-3.0r1.3390

Now that the configuration file has been updated we can execute hercules:

slut:/etc/hercules# hercules

Once the system has started started enter into the console:

iodelay 800
ipl 0300

This should now start to run the system. When HERCULES asks you for login and password just type (using a dot):


You are logged into the a Debian GNU/Linux s390 machine! All commands that you will use in this system console needs a dot before the syntax (eg.: .cat /proc/cpuinfo). It's because the emulator needs to "translate" the syntax this way. On the other hand Hercules will run the commands without the dot.

If you want to use the internet connection of your host system you will need to use the nat table in your iptables firewall. For example run these commands:

iptables -t nat -A POSTROUTING -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward

Once the system is booted you can carry out the rest of your work using the installed telnet server, via the IP address we added to /etc/hercules/hercules.cnf file we edited.

In our case:


Now you will finish the Debian installation. Remember that you need to edit the /etc/resolv.conf file typing your nameservers.

Note: when you run through the installer second-stage over telnet you will need to edit the source.list file, since it will refer to "stable" and not "woody".

You also need to remember to save the configurations before you close Hercules:

savecore debian-current

Now you can test your packages in this arch (s390)! ;)

Let's HACK! ;)



Posted by Anonymous (84.85.xx.xx) on Tue 2 Jan 2007 at 18:20
Why not explain instead how to install Debian on hercules using Debian Installer? Works perfectly...

- Download the files for the "generic" image from the D-I project website
- Add a line to hercules.cnf:
000C 3505 kernel.debian parmfile.debian initrd.debian autopad eof
- Start hercules and use 'ipl c' to boot the installer

[ Parent | Reply to this comment ]

Posted by Anonymous (200.233.xx.xx) on Tue 2 Jan 2007 at 18:37
Yes, thank you anonymous :)

[ Parent | Reply to this comment ]

Posted by Anonymous (71.207.xx.xx) on Sat 13 Jan 2007 at 06:54
Following this guide, and the first comment by Anonymous, I was able to install s/390 etch via Debian Installer. The only problem seems to be that networking worked fine during the install but doesn't work after the first boot. Anybody know how to fix it?

[ Parent | Reply to this comment ]

Posted by Anonymous (62.47.xx.xx) on Mon 12 Feb 2007 at 11:50
i tried the (initial) tutorial on my gentoo linux box. it works.
i do not have networking either. yes, i do have tun/tap enabled in the kernel.
and i have an additional problem... i issued "ping" on the debian console...
i do not know how to abort it since i cannot do "CTRL-C" inside hercules...
hmm... i believe i will kill it this time, but for the future, how can i abort such things if i accidently issue a command that is not self-returning?

kind regards

[ Parent | Reply to this comment ]

Posted by Anonymous (212.159.xx.xx) on Fri 23 Mar 2007 at 20:50
I have the same problem as Alex. Networking doesn't work, running ".ifconfig -a" to the emulator gives only the loopback device, no eth0.

[ Parent | Reply to this comment ]

Posted by Anonymous (71.218.xx.xx) on Mon 14 May 2007 at 23:44
There is a bug in the layer2 config stuff I think. The way I fixed it on an actual mainframe (not maybe its not the same issue.), was to simply remove the line containing layer2 from /etc/sysconfig/scripts/hardware/hwup-ccw-group.
Once this was removed, I didn't get the corresponding error you see at boot time and the network started without issue. Until I made this change, I couldn't see the hsi0 device through an ifconfig -a either. The network also worked perfectly during the install, but failed on the subseqent boot. I believe there may be a place to set this in a config file rather than delete the line that sets it in setup script, but its location eludes me at this time. I hope this helps someone else! I'll try to submit a bug report when I get the time.

[ Parent | Reply to this comment ]

Posted by Anonymous (128.84.xx.xx) on Fri 27 Jul 2007 at 21:44
I spent many hours tracking this down. The problem is that hercules is sending 2 more bytes of data in its CTCI packets than Linux is expecting. See here:
for the message I sent to the hercules list that has a hackish fix.


[ Parent | Reply to this comment ]

Posted by Anonymous (71.218.xx.xx) on Wed 16 May 2007 at 07:57
To issue ctrl-c's in a 3270 type terminal.

from the IBM webpage:

"For the ping (and many other commands), the Ctrl-C (or, ^c) sequence provides the appropriate interrupt."

And don't forget you can limit ping attemps with the switch -c
example: ping -c 3
this issues 3 pings and then drop back to shell.

Hope that helps.

[ Parent | Reply to this comment ]

Posted by Anonymous (61.68.xx.xx) on Sat 8 Sep 2007 at 13:12
why don't you put a link on your home page that lets you download the 'MIXMASTER'?!? Its so much easier than searching your page and then learning that you have to go to ...or whatever.

[ Parent | Reply to this comment ]

Posted by Anonymous (61.68.xx.xx) on Sat 8 Sep 2007 at 13:14
you should put a download box for the "MIXMASTER" on your home page

[ Parent | Reply to this comment ]

Sign In







Current Poll

Will you stick to systemd as the default in Debian?

( 61 votes ~ 1 comments )