Frequently Asked Question

What is PID 1 and why does the kernel panic if it dies?

PID 1 is the first user-space process the kernel starts after it has finished booting: it is the ancestor of every other process on the system. Historically this was /sbin/init from System V or BSD; on almost every modern Linux distribution it is systemd. PID 1's job is to bring up the rest of user space (mounting filesystems, starting services, opening login terminals) and to act as the universal adoptive parent for any process whose own parent dies, including reaping zombies on their behalf.

Because PID 1 is hard-wired into the kernel's expectations, there is no fallback ancestor, if it ever exits the kernel cannot recover and triggers a panic with "Attempted to kill init!". This is also why container images need a sensible PID 1: if you run a Python script as the only process in a container, it inherits PID 1 and becomes responsible for signal handling and child reaping it was never written to do. Tools like tini and dumb-init exist for exactly this reason.

Further reading and video