Skip to content

fix(vm): harden build-libkrun.sh for x86_64 and resolve PATH-shadowing issues#806

Merged
vince-brisebois merged 1 commit intomainfrom
drew/x86-vm-testing
Apr 10, 2026
Merged

fix(vm): harden build-libkrun.sh for x86_64 and resolve PATH-shadowing issues#806
vince-brisebois merged 1 commit intomainfrom
drew/x86-vm-testing

Conversation

@vince-brisebois
Copy link
Copy Markdown
Collaborator

Summary

Fix the VM build pipeline (build-libkrun.sh) to work reliably on x86_64 Linux, resolving PATH-shadowing issues where mise shims and venvs override system python3/cargo/libclang, adding a KVM access pre-check with an actionable error message, and hardening supporting scripts (sync-vm-rootfs.sh, compress-vm-runtime.sh) against missing tools.

Related Issue

N/A

Changes

  • tasks/scripts/vm/build-libkrun.sh: Replace fragile pip install pyelftools fallback with ensure_python3_with_pyelftools_for_libkrunfw() that detects PATH-shadowed python3 and falls back to /usr/bin/python3. Add ensure_cargo_for_libkrun() to find Cargo >= 1.85 (edition 2024) via mise or ~/.cargo/bin when the distro cargo is too old. Add ensure_libclang_for_libkrun() to robustly locate libclang.so / libclang-*.so across Debian, Fedora, and multiarch layouts. Pin libkrun to v1.17.4 and build with cargo build --release directly instead of make NET=1 BLK=1. Build init/init when present. Remove kernel.c / ABI_VERSION export (no longer needed for cross-platform builds).
  • crates/openshell-vm/src/lib.rs: Add VmError::KvmAccess variant and check_kvm_access() pre-check on Linux — libkrun panics with an opaque error when /dev/kvm is inaccessible; this turns it into a clear, actionable error message suggesting usermod -aG kvm.
  • tasks/scripts/vm/sync-vm-rootfs.sh: Guard the helm package step behind a command -v helm check so the script doesn't fail on machines without Helm installed.
  • tasks/scripts/vm/compress-vm-runtime.sh: Add a fast-path that skips compression when .zst artifacts already exist (e.g. from vm:setup download), decompressing them into the work directory for bundle-vm-runtime.sh instead.
  • crates/openshell-vm/runtime/kernel/openshell.kconfig: Enable CONFIG_POSIX_MQUEUE and CONFIG_POSIX_MQUEUE_SYSCTL (required by runc to mount /dev/mqueue in containers).
  • deploy/docker/Dockerfile.images: Add openshell-prover and openshell-vm crate stubs to the Docker build skeleton so cargo build succeeds in the container.
  • architecture/custom-vm-runtime.md and crates/openshell-vm/runtime/README.md: Update docs to reflect removal of kernel.c cross-compilation flow — each platform now builds its own libkrunfw natively.
  • vm-setup-fixes.patch: Snapshot patch file capturing the full set of fixes (for reference/backport).

Testing

  • mise run pre-commit passes
  • Unit tests added/updated
  • E2E tests added/updated (if applicable)

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (if applicable)

@vince-brisebois vince-brisebois requested a review from a team as a code owner April 10, 2026 21:09
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot bot commented Apr 10, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

All contributors have signed the DCO ✍️ ✅
Posted by the DCO Assistant Lite bot.

Copy link
Copy Markdown
Collaborator

@drew drew left a comment

Choose a reason for hiding this comment

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

Need to sign DCO

Image

also should squash all these commits so the ubuntu user isn't in the commit history and triggering the dco.

…krun.sh

Signed-off-by: Vincent Caux-Brisebois <vcauxbrisebo@nvidia.com>
@vince-brisebois
Copy link
Copy Markdown
Collaborator Author

I have read the DCO document and I hereby sign the DCO.

@vince-brisebois vince-brisebois merged commit d8cf795 into main Apr 10, 2026
9 of 10 checks passed
@vince-brisebois vince-brisebois deleted the drew/x86-vm-testing branch April 10, 2026 22:48
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