Sunday, October 4, 2015

Root on LVM on Debian s390x, new Hercules

Two s390x changes landed in Debian unstable today:
With this it should be possible to install Debian on s390x with root on LVM. I'd be happy to hear feedback about installations with any configuration, be it root on a single DASD or root on LVM. Unless you set both mirror/udeb/suite and mirror/suite to unstable you'll need to wait until the changes are in testing, though. (The debian-installer build does not matter as zipl-installer is not part of the initrd and sysconfig-hardware is part of the installation.)

Furthermore I uploaded a new version of Hercules - a z/Architecture emulator - to get a few more years of maintenance into Debian. See its upstream changelog for details on the changes (old 3.07 → new 3.11).

At this point qemu at master is also usable for s390x emulation. It is much faster than Hercules, but it uses newfangled I/O subsystems like virtio. Hence we will need to do some more patching to make debian-installer just work. One patch for netcfg is in to support virtio networking correctly, but then it forces the user to configure a DASD. (Which would be as wrong if Fibre Channel were to be used.) In the end qemu and KVM on s390x look so much like a normal x86 VM that we could drop most of the special-casing of s390x (netcfg-static instead of netcfg; network-console instead of using the VM console; DASD configuration instead of simply using virtio-blk devices; I guess we get to keep zIPL for booting).


  1. Well, Debian on S390x/KVM Is problematic unless you have an actual zSeries in your garage, which is great if your work pays for one, but if you are trying to learn to support zLinux by playing with Hercules, you can never figure out whether it is a Hercules problem, a QEMU problem, or an issue with Debian S390X.

    I ran into 2 problems - keep in mind that this is encountered on Hercules OR qemu-system-s390x on Debian 8/x64.

    a) The Debian installer does not seem to work with virtio networking by default and expects qeth (I think you filed that bug) - however, I was able to work around that by using the stretch initrd/kernel, wget to grab the latest netcfg, and using udpkg -i to patch. Once you do that it'll let you set the hostname, config ssh for remote install and grab the installer environment (which is fine).

    The problem is that once you proceed to this point the installer will complain about a kernel/module mismatch, and run into sharlib some point the entire installer will fail and you would not be able to go any further - I actually used expert mode to force the Debian 9 installer to install 8, but the installer environment will still segfault somewhere down the line. This one I am attributing to the haphazard nature of running qemu-system-s390x to emulate a mainframe. The networking works, the console works, but it's most likely some oddity with zSeries arch emulation.

    The exact command I used to start it on my Debian8/x64 command line was:

    sqemu-system-s390x -m 512 -kernel kernel.debian8 -initrd initrd.debian8 -drive file=linux.disk,format=raw -devXice virtio-net-s390,netdev=net0 -netdev tap,id=net0

    b) If you run it using KVM inside, say, a Hercules emulated S390X instance, it would seemingly start, but then you'll run into 2 issues;

    1) The emulated console goes seemingly nowhere
    - I have no idea whether I need to create a virtual 3270 in Hercules and send the commands there, or whether Debian actually tries to open a console on my virtual serial port in QEMU. Have to try both, I guess.

    2) Hercules s390x uses a CTCI device to do networking, so if to get VM networking to work, you can't use a tap device (since you cannot use brctl to bridge a CTCI device with a tap device. One is P-P and the other is regular ethernet)

    - This would probably require user mode networking

    Anyways, here's the command line I used to start qemu-kvm within a Debian8/s390x instance within Hercules. Let me know if you have any success bringing up Debian within KVM on an actual zSeries machine.

    qemu-system-s390x -machine type=s390-virtio,accel=kvm -drive file=testvm1.img -m 256 -kernel kernel.debian8 -initrd initrd.debian8 -netdev user,id=network0 -device virtio-net-s390,netdev=network0 -device virtio-serial -chardev vc,id=tty -device virtconsole,chardev=tty -device virtconsole -curses

    1. I backported the qeth/virtio fix to stable, fwiw, so in the next point release it should be fixed there. I'd just suggest to install testing for the time being, rather than stable. You can also try to give it more memory and see if the segfault goes away. Although I thought that 512M RAM would be enough. If not, please file a bug and cc debian-s390. I thought the main problem with qemu & virtio was disk handling at this point.

      You don't need to bridge for VM networking to work, you could just NAT/MASQUERADE the guest.

      And KVM on an actual machine went much better than my initial tries of qemu emulation (which failed to initialize virtio back then). But emulation subsequently worked for me with a bleeding edge qemu built from git.

  2. BTW, I should also mention that lvm will not work as it stands - there is a module mismatch on kernel/initrd for both Jessie and testing which would not disallow the installer to load parted-lvm and move forward.

    1. That's because a new alpha of debian-installer was just released. (Sort of, it's only part of the story on a rolling release.) You need to download a new installer for this to work, I think. has release candidates, weekly and daily builds.