I have recently tried building initramfs images with genimage inside a container. This seemingly just worked, but when I later tried using the initramfs it turned out to be empty.
After a bit of investigation I found out that I have missed this message on stderr while building the initramfs:
INFO: cpio(install.img): cmd: "(cd '/var/tmp/ptxdist.LwUO9c/genimage.2MOKvB/root' && find . | cpio -H 'newc' -o | zstd -T0 -19) > '…/platform-x86_64/images/install.img'" (stderr):
/bin/sh: 1: cpio: not found
INFO: cmd: "rm -rf "/var/tmp/ptxdist.LwUO9c/genimage.2MOKvB"/*" (stderr):
finished target install.img
The generated install.img was just 13 bytes in size and if I had to guess just consisted of the zstd file header. Installing the cpio package in the container fixed the problem.
It would be preferable if the genimage call failed in this case.
I guess this piece of code should be modified to contain something like set -o pipefail:
|
ret = systemp(image, "(cd '%s' && find . | %s -H '%s' %s -o %s %s) > '%s'", |
|
mountpath(image), |
|
get_opt("cpio"), |
|
format, extraargs, comp[0] != '\0' ? "|" : "", comp, |
|
imageoutfile(image)); |
I have recently tried building initramfs images with genimage inside a container. This seemingly just worked, but when I later tried using the initramfs it turned out to be empty.
After a bit of investigation I found out that I have missed this message on stderr while building the initramfs:
The generated
install.imgwas just 13 bytes in size and if I had to guess just consisted of thezstdfile header. Installing thecpiopackage in the container fixed the problem.It would be preferable if the
genimagecall failed in this case.I guess this piece of code should be modified to contain something like
set -o pipefail:genimage/image-cpio.c
Lines 32 to 36 in ff7da92