Skip to content

initrd: install perf in ukl-base and fail non-destructively on missing binary - #39

Open
borkluce wants to merge 1 commit into
unikernelLinux:mainfrom
borkluce:fix-initrd-missing-binary
Open

initrd: install perf in ukl-base and fail non-destructively on missing binary#39
borkluce wants to merge 1 commit into
unikernelLinux:mainfrom
borkluce:fix-initrd-missing-binary

Conversation

@borkluce

@borkluce borkluce commented Aug 30, 2026

Copy link
Copy Markdown

Problem

The initrd build aborts and produces a near-empty (~25 KB) image when a binary listed in buildinitrd.sh is not present in the ukl-base build container. In practice this happens with perf: the ukl-base image (Fedora 36) does not install it, but buildinitrd.sh lists it in sbinfiles and also assumes a ./perf exists in the repo. When copy() cannot find perf, it runs rm -rf $WDIR and exits, leaving an incomplete initrd. The build appears to finish, but the kernel then panics at boot with Unable to mount root fs, with nothing linking the panic back to the missing binary.

Changes

  • initrd/ukl-base/Dockerfile: add perf to the dnf install list so the binary required by buildinitrd.sh is present in the container.
  • initrd/buildinitrd.sh: on a missing binary, print a clear error naming it and pointing to the fix, and stop calling rm -rf $WDIR. The working directory is now preserved on failure, so the problem is diagnosable instead of surfacing as an unexplained boot panic much later.

Testing

  • Rebuilt the ukl-base image with the updated Dockerfile: it builds successfully and now includes perf (perf version 6.2.6).
  • bash -n buildinitrd.sh passes (no syntax errors).
  • Removing perf from sbinfiles was my original workaround and produced a correct (~8 MB) initrd that booted normally; adding perf to the image achieves the same while keeping the tool available.

Encountered while integrating an application into UKL. Happy to adjust the approach — e.g. mark non-essential tools as optional instead — if preferred.

Closes #38

…g binary

The ukl-base image did not install perf, but buildinitrd.sh lists it as
required, so the build aborted and deleted its working directory, leaving
an empty initrd and an unexplained 'Unable to mount root fs' panic at boot.

- Add perf to the ukl-base Dockerfile so the required set is present.
- On a missing binary, print a clear error naming it and pointing to the
  fix, and no longer 'rm -rf $WDIR', so the failure is diagnosable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant