Skip to content

fix: write runtime pidfile when provided#439

Merged
cmainas merged 1 commit intourunc-dev:main-pr439from
sidneychang:check-urunc-podman
Feb 6, 2026
Merged

fix: write runtime pidfile when provided#439
cmainas merged 1 commit intourunc-dev:main-pr439from
sidneychang:check-urunc-podman

Conversation

@sidneychang
Copy link
Contributor

@sidneychang sidneychang commented Feb 3, 2026

Ensure the PID is written to the runtime-provided --pid-file after container creation. This allows supervisors like conmon to track and reap the container process correctly, preventing early cleanup or EOF failures. This change also ensures that Podman can reliably start urunc containers.

Description

In the current code, there is a --pid-file flag, but in reality, we are not actually writing to the specified pid-file. This causes issues when starting urunc with Podman, preventing it from starting properly.

Related issues

#114

How was this tested?

  • Configure Podman to Use urunc
    I tested using the method described in Check integration of urunc with podman #114 and configured Podman to use urunc as the runtime. I executed the following command to modify the Podman container configuration:
sudo tee /etc/containers/containers.conf >/dev/null <<EOT
[engine]
runtime = "/usr/local/bin/urunc"
EOT
  • Configure the QEMU Path for urunc
    To ensure urunc can locate the QEMU binary, the QEMU path needs to be set in the config.toml file for urunc. The configuration should look like this:
[monitors.qemu]
path = "/usr/bin/qemu-system-x86_64"

Run urunc with Podman
After configuring the runtime and QEMU path, I attempted to run the urunc container using Podman:

podman run --rm -d harbor.nbfc.io/nubificus/urunc/nginx-qemu-unikraft-initrd:latest

result:
image

LLM usage

Using Codex to debug the cause of the issue#114

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

@netlify
Copy link

netlify bot commented Feb 3, 2026

Deploy Preview for urunc ready!

Name Link
🔨 Latest commit 8498ff4
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/6985749855cc790008cd362c
😎 Deploy Preview https://deploy-preview-439--urunc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@sidneychang sidneychang force-pushed the check-urunc-podman branch 2 times, most recently from 32401ed to 9622e2a Compare February 5, 2026 09:08
Copy link
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

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

Thank you a lot @sidneychang for this fix!

I think we can make the patch even smaller. We can simply add the pid file apth as an extra argument in unikontainers.Create https://github.com/sidneychang/urunc/blob/9622e2a938b1a911f176eee2d6a0fa00e92ae09b/cmd/urunc/create.go#L257

Inside Create if the pid file path is not specified we can simply use the default value otherwise the argument passed.

@sidneychang
Copy link
Contributor Author

Thank you a lot @sidneychang for this fix!

I think we can make the patch even smaller. We can simply add the pid file apth as an extra argument in unikontainers.Create https://github.com/sidneychang/urunc/blob/9622e2a938b1a911f176eee2d6a0fa00e92ae09b/cmd/urunc/create.go#L257

Inside Create if the pid file path is not specified we can simply use the default value otherwise the argument passed.

I agree with this approach, and I actually considered something similar. My only hesitation was whether we still need to always write the pid file to the existing default path filepath.Join(u.State.Bundle, initPidFilename), or if, once an explicit pid file path is provided, we should skip writing to the default location entirely and only write to the provided path.

@cmainas
Copy link
Contributor

cmainas commented Feb 5, 2026

Thank you a lot @sidneychang for this fix!
I think we can make the patch even smaller. We can simply add the pid file apth as an extra argument in unikontainers.Create https://github.com/sidneychang/urunc/blob/9622e2a938b1a911f176eee2d6a0fa00e92ae09b/cmd/urunc/create.go#L257
Inside Create if the pid file path is not specified we can simply use the default value otherwise the argument passed.

I agree with this approach, and I actually considered something similar. My only hesitation was whether we still need to always write the pid file to the existing default path filepath.Join(u.State.Bundle, initPidFilename), or if, once an explicit pid file path is provided, we should skip writing to the default location entirely and only write to the provided path.

I see, but we should respect the cli arguments. Also, looking a bit in the runc code for reference I see that:

@sidneychang
Copy link
Contributor Author

Thank you a lot @sidneychang for this fix!
I think we can make the patch even smaller. We can simply add the pid file apth as an extra argument in unikontainers.Create https://github.com/sidneychang/urunc/blob/9622e2a938b1a911f176eee2d6a0fa00e92ae09b/cmd/urunc/create.go#L257
Inside Create if the pid file path is not specified we can simply use the default value otherwise the argument passed.

I agree with this approach, and I actually considered something similar. My only hesitation was whether we still need to always write the pid file to the existing default path filepath.Join(u.State.Bundle, initPidFilename), or if, once an explicit pid file path is provided, we should skip writing to the default location entirely and only write to the provided path.

I see, but we should respect the cli arguments. Also, looking a bit in the runc code for reference I see that:

That makes sense — we should indeed respect the CLI arguments.
I did some testing and found that the default pid file path is effectively the same as the pidfile path passed by containerd (Docker / Kubernetes). This further confirms that the original default path was primarily chosen to align with the containerd ecosystem.
Based on this, I updated the code to retain the existing default pid file path as a fallback when no pidfile is explicitly provided, and to prefer the CLI-provided pidfile path whenever it is specified. If this approach looks reasonable, I think the change should be safe to merge.

Ensure the PID is written to the runtime-provided --pid-file after
container creation. This allows supervisors to track and
reap the container process correctly, preventing early cleanup or EOF
failures. This change also ensures that Podman can reliably start urunc
containers.

Signed-off-by: sidneychang <2190206983@qq.com>
@urunc-bot urunc-bot bot changed the base branch from main to main-pr439 February 6, 2026 13:19
Copy link
Contributor

@cmainas cmainas left a comment

Choose a reason for hiding this comment

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

Thank you @sidneychang for this fix!

@cmainas cmainas merged commit 7b6e818 into urunc-dev:main-pr439 Feb 6, 2026
50 of 51 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 6, 2026
Ensure the PID is written to the runtime-provided --pid-file after
container creation. This allows supervisors to track and
reap the container process correctly, preventing early cleanup or EOF
failures. This change also ensures that Podman can reliably start urunc
containers.

PR: #439
Signed-off-by: sidneychang <2190206983@qq.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
urunc-bot bot pushed a commit that referenced this pull request Feb 6, 2026
Ensure the PID is written to the runtime-provided --pid-file after
container creation. This allows supervisors to track and
reap the container process correctly, preventing early cleanup or EOF
failures. This change also ensures that Podman can reliably start urunc
containers.

PR: #439
Signed-off-by: sidneychang <2190206983@qq.com>
Reviewed-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Approved-by: Charalampos Mainas <cmainas@nubificus.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check integration of urunc with podman

2 participants