Skip to content

container: tell the hook type and number on hook failure - #2248

Merged
giuseppe merged 1 commit into
containers:mainfrom
kolyshkin:hook-error-message
Sep 11, 2026
Merged

giuseppe merged 1 commit into
containers:mainfrom
kolyshkin:hook-error-message

Conversation

@kolyshkin

Copy link
Copy Markdown
Collaborator

When a hook fails, crun says

error executing hook `/bin/false` (exit code: 1)

which does not tell what hook it was, and a container can have many.

Add the hook type and its number (starting from 0, like runc does) to the message, making it

error running createRuntime hook #1: `/bin/false` (exit code: 1)

which is also similar to what runc says, as some tools and tests check for it.

Found by the runc integration tests (see #2238): "runc create [hook fails]", "runc create [second createRuntime hook fails]", "runc run [hook fails]".

When a hook fails, crun says

  error executing hook `/bin/false` (exit code: 1)

which does not tell what hook it was, and a container can have many.

Add the hook type and its number (starting from 0, like runc does) to
the message, making it

  error running createRuntime hook #1: `/bin/false` (exit code: 1)

which is also similar to what runc says, as some tools and tests
(e.g. "runc create [hook fails]" 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 6d47cc2 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