Kernel panic running without /etc/passwd

I have a really minimal container based on a scratch image. It has one statically linked executable that is run as the entrypoint. I switch to a uid using USER 1000 in the Dockerfile, but this causes fly’s init process to panic.

I’m getting: Error: UserNotFound("1000")

Docker and Podman will happily run a container without an /etc/passwd file as long as the USER command specified a uid and not a username. I’m not sure how Fly can support this as Fly creates a full VM out of this image, while containers are definitely not VMs.

Can the docs explicitly mention that Fly expects a container image to have a valid /etc/passwd file.

Also if we’re keeping track, this is the second time I’ve stumbled in to a kernel panic!

The issue stems from here: init-snapshot/ at 48cf36ff7ac6229df66bf1de2b1e2b1c233b2e51 · superfly/init-snapshot · GitHub. User::from_name calls getpwnam_r which reads the /etc/passwd file.

That’s true. Seems like an oversight!

If the provided user is numeric, we should just use it as-is.

@jerome I’ve done the absolute neanderthal thing of including a minimal /etc/passwd in my image. Let me know if you guys fix this so I can get rid of that eventually.

As mentioned in the other thread, I believe I fixed this with my latest push. Please try again “like an homosapien”, without a /etc/passwd file.

@jerome this is the fastest I’ve had an issue go from report to prod deploy. Thank you for that. It works!

1 Like