Skip to content

Improve error report for failed hook execution #292

@cmainas

Description

@cmainas

When a hook fails its execution in urunc, the container is unable to start and an error like the following one will be shown:

WARN[0000] cannot set cgroup manager to "systemd" for runtime "io.containerd.urunc.v2" 
FATA[0000] failed to create shim task: OCI runtime create failed: failed to execute CreateRuntime hooks: failed to execute hook '/usr/local/bin/nerdctl internal oci-hook createRuntime': exit status 1

The above error message does not provide enough information on why the hook failed its execution and therefore it is hard to solve it.

However, when running a container with other container runtimes, if a hook fails its execution the error report seems much more useful. For example in the same setup as above:

FATA[0011] failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running createRuntime hook #0: exit status 1, stdout: , stderr: time="2025-09-30T07:32:24Z" level=warning msg="Container failed starting. Removing allocated network configuration."
time="2025-09-30T07:32:24Z" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): failed to locate iptables: exec: \"iptables\": executable file not found in $PATH" 

Therefore, we need to improve the error report of a failed hook also showing the error logs of the hook.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreRelated to urunc's internalsdevInvolves developmentenhancementNew feature or requestfeatureIssues created from the urunc teamgood first issueGood for newcomers

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions