Skip to content

Commit

Permalink
rpm_ostree/installation.py: fix image deployment on s390x
Browse files Browse the repository at this point in the history
When user installs OS on s390x using some container image, it fails whith an error:
```
INFO:program:Running... ostree container image deploy --sysroot=/mnt/sysimage --image=quay.io/fedora/fedora-bootc:41-s390x
INFO:program:Error: Config file '/lib/s390-tools/zipl.conf': Cannot build automenu: no IPL entries available
INFO:program:Using config file '/lib/s390-tools/zipl.conf'
```

This happens, because `ostree` doesn't call `zipl` on installed deployment, but on `/` (without bubblewrapping).

This PR first sets bootloader to `none`, so `ostree` doesn't perform `post_bls_sync`, and than calls `zipl` direct from anaconda (similar to what we do in `coreos-assembler`).

Here is an eaxmple kickstart `ostree.ks`:
```
text
lang en_US.UTF-8
keyboard us
timezone --utc Etc/UTC
selinux --enforcing
rootpw --plaintext foobar
network --bootproto=dhcp --device=link --activate --onboot=on
zerombr
clearpart --all --initlabel
autopart --nohome --type=lvm
ostreecontainer --url quay.io/fedora/fedora-bootc:41-s390x
firewall --disabled
services --enabled=sshd
sshkey --username root YOUR_KEY_HERE
```

Using that config and kargs `inst.ks=http://172.23.236.43/ostree.ks inst.sshd` injected into Fedora 41 `boot.iso`,
installation succeeded:
```

Setting up the installation environment                                                                                    .
Configuring storage
Creating disklabel on /dev/vdb
Creating ext4 on /dev/vdb1
Creating lvmpv on /dev/vdb2
Creating ext4 on /dev/mapper/fedora_fedora-root
.
Running pre-installation scripts
.
Running pre-installation tasks
.
Installing the software
Deployment starting: quay.io/fedora/fedora-bootc:41-s390x
Deployment complete: quay.io/fedora/fedora-bootc:41-s390x
.
Configuring storage
.
Installing boot loader
.
Performing post-installation setup tasks
```

Issue: https://issues.redhat.com/browse/RHEL-63237
  • Loading branch information
nikita-dubrovskii committed Feb 7, 2025
1 parent 92febbe commit 1378642
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions pyanaconda/modules/payloads/payload/rpm_ostree/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
from subprocess import CalledProcessError

import blivet.util

from blivet import arch

import gi

from pyanaconda.anaconda_loggers import get_module_logger
Expand Down Expand Up @@ -602,6 +605,39 @@ def _set_kargs(self):

safe_exec_with_redirect("ostree", set_kargs_args, root=self._sysroot)

if arch.is_s390():
log.info(
f"ostree config --repo {self._sysroot}/ostree/repo set sysroot.bootloader zipl")
safe_exec_with_redirect(
"ostree",
["config",
"--repo=" + self._sysroot + "/ostree/repo",
"set", "sysroot.bootloader", "zipl"]
)

log.info(f"zipl -V")
bls_path = self._sysroot + "/boot/loader/entries/ostree-1.conf"
with open(bls_path, "r") as bls:
for line in bls.readlines():
if line.startswith("options "):
cmdline = line.split()[1]
if line.startswith("linux"):
kernel = self._sysroot + "/boot" + line.split()[1]
if line.startswith("initrd"):
initrd = self._sysroot + "/boot" + line.split()[1]

safe_exec_with_redirect(
"zipl",
["-V",
"-i",
kernel,
"-r",
initrd,
"-P",
f"\"{cmdline}\"",
"-t",
self._sysroot])


class DeployOSTreeTask(Task):
"""Task to deploy OSTree."""
Expand All @@ -626,6 +662,16 @@ def run(self):

self.report_progress(_("Deployment starting: {}").format(ref))

if arch.is_s390():
log.info(
f"ostree config --repo {self._physroot}/ostree/repo set sysroot.bootloader none")
safe_exec_with_redirect(
"ostree",
["config",
"--repo=" + self._physroot + "/ostree/repo",
"set", "sysroot.bootloader", "none"]
)

safe_exec_with_redirect(
"ostree",
["admin",
Expand Down

0 comments on commit 1378642

Please sign in to comment.