Skip to content

--mpi-command as root fails on AL2: Open MPI 4.0.1 ignores OMPI_ALLOW_RUN_AS_ROOT #1481

Closed

Description

@scttfrdmn

Summary

On an Amazon Linux 2 AMI (--ami), I expect every --mpi-command to fail before any rank starts. Rank 0 runs mpirun as root and permits that only through OMPI_ALLOW_RUN_AS_ROOT=1 / OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 in /etc/profile.d/mpi.sh (pkg/userdata/mpi.go). AL2's openmpi package is Open MPI 4.0.1, which predates those variables and refuses to run as root unless --allow-run-as-root is on the command line.

Evidence (container, no AWS)

amazonlinux:2 + yum install -y openmpi gives mpirun (Open MPI) 4.0.1. With both variables set:

$ OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 mpirun --oversubscribe -np 2 bash -c 'echo hi'
mpirun has detected an attempt to run as root.
...
You can override this protection by adding the --allow-run-as-root
option to your cmd line.

Adding --allow-run-as-root makes it run. On amazonlinux:2023 (Open MPI 4.1.2) the variables alone work. Found while verifying #1479 / PR #1480, whose real-mpirun test has to pass the flag under root on AL2.

Scope

AL2023 is the default AMI, so this only affects a user-supplied AL2 image (or another distro on an Open MPI older than the variables). Not reproduced on EC2. Possible fix: pass --allow-run-as-root on rank 0's mpirun line, which every 4.x and 5.x release accepts. Or document AL2 as unsupported for --mpi.

Activity

  1. added
    bug
    area:mpi
    on Nov 1, 2026
  2. added this to the v0.155.0 milestone on Nov 2, 2026
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