Skip to content

exec: use exit code 255 for exec failures, same paused error as runc - #2245

Merged
giuseppe merged 2 commits into
containers:mainfrom
kolyshkin:exec-exit-code-255
Sep 11, 2026
Merged

giuseppe merged 2 commits into
containers:mainfrom
kolyshkin:exec-exit-code-255

Conversation

@kolyshkin

Copy link
Copy Markdown
Collaborator
  1. exec: use exit code 255 for exec failures

    On success, crun exec exits with the exit code of the executed process. On failure of crun exec itself (e.g. no such container, no such executable), it exits with 1, and so the caller cannot tell it apart from the executed process exiting with 1.

    Use exit code of 255 for crun exec failures, like runc does since v1.1.0 (see runc exec: fail with exit code of 255 opencontainers/runc#3073), which is the same convention as used by e.g. ssh. Add a test case.

    Note that podman (via conmon) does not rely on the crun exec exit code, as it gets the error details from conmon.

  2. exec: use the same paused container error as runc

    When the container is paused, crun exec fails with the container `ID` is paused, while runc uses cannot exec in a paused container. Use the latter (appending the container ID), as some tools and tests check for it.

Found by the "runc exec [exit codes]" and "runc exec should refuse a paused container" runc integration tests (see #2238).

On success, crun exec exits with the exit code of the executed process.
On failure of crun exec itself (e.g. no such container, no such
executable), it exits with 1, and so the caller cannot tell it apart
from the executed process exiting with 1.

Use exit code of 255 for crun exec failures, like runc does since
v1.1.0 (see opencontainers/runc#3073), which is the same convention as
used by e.g. ssh.

Note that podman (via conmon) does not rely on crun exec exit code, as
it gets the error details from conmon.

Found by the "runc exec [exit codes]" runc integration test.

Signed-off-by: Kir Kolyshkin <[email protected]>
When the container is paused, crun exec fails with

  the container `ID` is paused

while runc uses

  cannot exec in a paused container

Use the latter (appending the container ID), as some tools and tests
(e.g. "runc exec should refuse a paused container" runc integration
test) check for it.

Signed-off-by: Kir Kolyshkin <[email protected]>

@giuseppe giuseppe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@giuseppe
giuseppe merged commit e9208f6 into containers:main Sep 11, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants