Environment
- UKL commit
f66efb6c (Linux 6.3.0)
- Default build path (
initrd/create-initrd.sh, which builds inside the ukl-base Docker image)
Summary
The initrd build aborts and produces a near-empty (~25 KB) image whenever a binary listed in buildinitrd.sh is not present in the build container. Concretely, this happens with perf: the ukl-base image does not install it, but buildinitrd.sh treats it as required. 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.
Root cause (with references)
The initrd is built inside the ukl-base container (initrd/create-initrd.sh → docker exec ... ./buildinitrd.sh). That image is Fedora 36 and installs its tools here (initrd/ukl-base/Dockerfile):
RUN dnf -y install sed elfutils-libelf-devel bc hostname perl dropbear \
msr-tools wget dnf-plugins-core bzip2 curl xz cpio shadow-utils procps-ng iproute \
pciutils net-tools openssh-server less ethtool
perf is not in this list. However, buildinitrd.sh requires it:
21 cp ./perf /usr/sbin/
33 sbinfiles="halt dropbear ip rdmsr wrmsr lspci perf ethtool"
Line 21 assumes a ./perf exists in the repo (it does not), and line 33 lists perf among the required sbinfiles. When copy() cannot find perf, it hits its failure branch:
15 echo "Missing required file: $1 for directory $2"
16 rm -rf $WDIR
17 exit 1
So the build deletes its working directory and exits with an incomplete initrd. The echo is easily missed in a verbose/parallel build, and rm -rf $WDIR removes any evidence, so the only symptom the user actually sees is an unexplained kernel panic much later.
Steps to reproduce
- Build the initrd via the standard path (
create-initrd.sh) using the provided ukl-base image.
- Observe a ~25 KB initrd.
- Boot the kernel →
Unable to mount root fs
Workaround
Removing perf from sbinfiles (line 33) produces a correctly populated initrd (~8 MB) and the kernel boots normally. perf was not required for my workload.
Suggested fix (any of):
- Add
perf to the ukl-base Dockerfile so the required set is actually present; or
- Mark non-essential tools like
perf as optional in buildinitrd.sh (warn and skip instead of aborting); and
- Regardless, make the failure non-destructive and explicit: don't
rm -rf $WDIR before the user can inspect it, and abort with an unmissable message naming the missing binary. The current silent-ish failure followed by a much later Unable to mount root fs is very hard to diagnose.
Offer
I hit this while integrating an application into UKL and traced it to the missing perf. I'd be glad to open a PR — either adding perf to the image, or making the missing-binary handling optional and non-destructive — if that's welcome.
Environment
f66efb6c(Linux 6.3.0)initrd/create-initrd.sh, which builds inside theukl-baseDocker image)Summary
The initrd build aborts and produces a near-empty (~25 KB) image whenever a binary listed in
buildinitrd.shis not present in the build container. Concretely, this happens withperf: theukl-baseimage does not install it, butbuildinitrd.shtreats it as required. The build appears to finish, but the kernel then panics at boot withUnable to mount root fs, with nothing linking the panic back to the missing binary.Root cause (with references)
The
initrdis built inside theukl-basecontainer (initrd/create-initrd.sh→docker exec ... ./buildinitrd.sh). That image is Fedora 36 and installs its tools here (initrd/ukl-base/Dockerfile):perfis not in this list. However,buildinitrd.shrequires it:Line 21 assumes a
./perfexists in the repo (it does not), and line 33 listsperfamong the requiredsbinfiles. Whencopy()cannot findperf, it hits its failure branch:So the build deletes its working directory and exits with an incomplete initrd. The
echois easily missed in a verbose/parallel build, andrm -rf $WDIRremoves any evidence, so the only symptom the user actually sees is an unexplained kernel panic much later.Steps to reproduce
create-initrd.sh) using the providedukl-baseimage.Unable to mount root fsWorkaround
Removing
perffromsbinfiles(line 33) produces a correctly populated initrd (~8 MB) and the kernel boots normally.perfwas not required for my workload.Suggested fix (any of):
perfto theukl-baseDockerfile so the required set is actually present; orperfas optional inbuildinitrd.sh(warn and skip instead of aborting); andrm -rf $WDIRbefore the user can inspect it, and abort with an unmissable message naming the missing binary. The current silent-ish failure followed by a much laterUnable to mount root fsis very hard to diagnose.Offer
I hit this while integrating an application into UKL and traced it to the missing
perf. I'd be glad to open a PR — either addingperfto the image, or making the missing-binary handling optional and non-destructive — if that's welcome.