"panic: runtime error: invalid memory address or nil pointer dereference" on FreeBSD
I'm getting an error while using podman that originates from Buildah on FreeBSD.
Reproducing the error
With the following Dockerfile:
FROM alpine
COPY "../../." "/website"
WORKDIR "/website"
RUN apk update
RUN apk upgrade
When I run podman build -f Dockerfile -t website --os=linux --progress=plain
The output is the following:
STEP 1/6: FROM alpine
STEP 2/6: COPY "../../." "/website"
--> Using cache e2a2cabaf05c671b5a35d89ec24124dd4522aedbc7918c9de8758e727eaf6dc7
--> e2a2cabaf05c
STEP 3/6: WORKDIR "/website"
--> Using cache 18a81ebc2ddc93ebc909e4741e5d3a262db34cf21767c84826697996892ef7f7
--> 18a81ebc2ddc
STEP 4/6: RUN apk update
error running container: did not get container start message from parent: EOF
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x221f085]
goroutine 13 [running]:
github.com/containers/buildah.(*Builder).runUsingRuntimeSubproc(_, _, {0x874473400, {0x0, 0x0}, 0x0, {0x8744c2c80, 0x7}, {0x2914180, 0x0, ...}, ...}, ...)
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/run_common.go:1256 +0x12e5
github.com/containers/buildah.(*Builder).Run(_, {_, _, _}, {0x874473400, {0x0, 0x0}, 0x0, {0x8744c2c80, 0x7}, ...})
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/run_freebsd.go:325 +0x20b1
github.com/containers/buildah/imagebuildah.(*StageExecutor).Run(_, {0x1, {0x8742fc610, 0x1, 0x1}, {0x0, 0x0, 0x0}, {0x0, 0x0}, ...}, ...)
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/imagebuildah/stage_executor.go:815 +0x1050
github.com/openshift/imagebuilder.(*Builder).Run(0x874004900, 0x874620f00, {0x90cd98, 0x8744eb860}, 0x0)
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/openshift/imagebuilder/builder.go:481 +0x527
github.com/containers/buildah/imagebuildah.(*StageExecutor).Execute(0x8744eb860, {0x907758, 0x874394cf0}, {0x8742723b0, 0x6})
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/imagebuildah/stage_executor.go:1495 +0x33d5
github.com/containers/buildah/imagebuildah.(*Executor).buildStage(0x874194680, {0x907758, 0x874394cf0}, 0x1?, {0x874481fb0, 0x1, 0x1}, 0x0)
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/imagebuildah/executor.go:570 +0x5c5
github.com/containers/buildah/imagebuildah.(*Executor).Build.func3.1()
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/imagebuildah/executor.go:934 +0x2b1
created by github.com/containers/buildah/imagebuildah.(*Executor).Build.func3 in goroutine 11
/wrkdirs/usr/ports/sysutils/podman/work/podman-5.1.1/vendor/github.com/containers/buildah/imagebuildah/executor.go:905 +0x305
https://github.com/containers/buildah/blob/6ceba8838d331eb26378cb37d9fc8ba98939aa92/imagebuildah/executor.go#L934
When I remove the RUN statements from the image, it builds and runs fine.
System information
Podman and buildah are the latest versions available on pkg
# podman --version
podman version 5.1.1
# buildah --version
buildah version 1.36.0 (image-spec 1.1.0, runtime-spec 1.2.0)
``` ` [email protected]
` `.....---.......--.``` -/ -------------
+o .--` /y:` +. OS: FreeBSD 14.1-RELEASE amd64
yo`:. :o `+- Uptime: 2 days, 14 hours, 2 mins
y/ -/` -o/ Packages: 122 (pkg)
.- ::/sy+:. Shell: zsh 5.9
/ `-- / Terminal: /dev/pts/0
`: :` CPU: Intel Xeon (Skylake, IBRS, no TSX) (2) @ 2.294
`: :` GPU: Virtio 1.0 GPU
/ / Memory: 2057MiB / 3957MiB
.- -.
-- -.
`:` `:`
.-- `--.
.---.....----.
It looks like this was fixed by https://github.com/containers/buildah/pull/5580, which landed in 1.37.0, though it might also require https://github.com/containers/buildah/pull/5594. Do you still encounter this problem with 1.37.0?
cc @dfr
A friendly reminder that this issue had no activity for 30 days.
I will try again when I have time to confirm this has been fixed.
The fix for this is incorporated into the FreeBSD packages for Buildah and Podman - I just tested with buildah-1.36.0_4 and podman-5.1.1_5 and did not encounter the nil pointer dereference. I plan to update the FreeBSD ports for Buildah and Podman to track the latest releases.