Skip to content

--mpi on an AL2 --ami dies at the jq hostfile step (jq not installed); no SPAWN_COMPLETE, so the cohort bills until TTL #1483

Closed

Description

@scttfrdmn

Summary

On an Amazon Linux 2 --ami, every --mpi launch fails silently. The bootstrap dies before mpirun ever runs, and no completion record is written, so --on-complete never fires and both members sit until the TTL (or the idle timeout). spawn launch still reports success, because spored verifies fine.

The cause is that the MPI user data builds the hostfile with jq (pkg/userdata/mpi.go, jq -r ".[] | \"\(.ip) slots=$SLOTS\"" /etc/spawn/job-array-peers.json > /tmp/mpi-hostfile). jq is preinstalled on AL2023 but not on AL2, and nothing installs it: the MPI fragment only does yum install -y openmpi openmpi-devel. Under the bootstrap's set -e, exit 127 ends the script right after the peers-file wait.

This affects v0.154.0 and fix/1481-mpirun-root (PR #1482) the same way. The --allow-run-as-root fix for #1481 is correct, but it is unreachable on stock AL2 until this is fixed. The amazonlinux:2 container reproduction in #1481 ran mpirun directly, so it never went through this line.

Evidence (EC2, us-east-1, arm64 AL2 ami-04c8b521a97d3e2a4 from /aws/service/ami-amazon-linux-latest/amzn2-ami-kernel-5.10-hvm-arm64-gp2, 2x c7g.medium, 2026-11-02)

Both members, with v0.154.0 and with the PR #1482 build (2463472), at /var/log/cloud-init-output.log:

/var/lib/cloud/instance/scripts/part-001: line 160: jq: command not found
cloud-init[1212]: util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [127]

Afterwards there was no /tmp/mpi-hostfile content, no /run/spawn/mpi-ready, no /var/log/spawn-command.log, no /tmp/SPAWN_EXITCODE and no /tmp/SPAWN_COMPLETE (on the PR build, also no /etc/spawn/mpi-rank on either member). rpm -q jq gave package jq is not installed, and yum info jq showed 1.6 available from amzn2-core. The instances stayed running, with spawn:ttl-deadline 1h out.

After yum install -y jq and re-running the rest of part-001 from the SLOTS= line (with /etc/profile.d/mpi.sh sourced, as the script does):

So jq is the only blocker left on AL2 once #1482 is in.

Cost angle

The failure point sits after the peers-file wait, which has its own bounded failure path that writes SPAWN_COMPLETE, but before the peer-SSH wait, which also has one. The jq line has none. So an AL2 MPI cohort is not torn down by --on-complete and bills until the TTL or idle timeout.

Possible fixes

  • Install jq alongside openmpi in the MPI fragment (command -v jq || yum install -y jq), or
  • drop the jq dependency: the peers file is spawn's own fixed-format JSON (see pkg/provider/peers_file.go), so awk/sed, or a tiny spored subcommand, could emit the hostfile;
  • either way, a failure to build the hostfile should write a failed SPAWN_COMPLETE, like the neighbouring waits do, so --on-complete still fires.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:mpibug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions