BusyBox Init for Bare-Minimum Systems

Updated

October 30, 2026

BusyBox Init for Bare-Minimum Systems

If your distribution targets micro-appliances, recovery shells, or embedded systems with strict storage limitations (e.g., less than 16 MB of total storage), BusyBox Init provides a complete PID 1 solution compiled directly into the BusyBox binary.

+-----------------------------------------------------------+
|                     BusyBox Init Flow                     |
|                                                           |
|  PID 1 (/sbin/init -> busybox)                            |
|       |                                                   |
|       +---> Reads configuration: /etc/inittab             |
|       +---> Runs `sysinit` actions (mount -a)             |
|       +---> Runs `respawn` actions (getty on tty1)        |
|       +---> Handles signals: SIGUSR1 (halt), SIGTERM      |
+-----------------------------------------------------------+

The /etc/inittab Configuration

BusyBox init does not use traditional SysV runlevels (0-6). Instead, it reads /etc/inittab where each line follows the format:

<id>::<action>:<process>
  • <id>: The controlling tty device (e.g., tty1, ttyS0), or empty for non-interactive processes.
  • <action>:
    • sysinit: Executed first during system startup before anything else.
    • wait: Executed and waited on before continuing.
    • once: Started once in the background without waiting.
    • respawn: Restarted immediately if it ever terminates (ideal for shells and login prompts).
    • shutdown: Executed when the system is halted or rebooted.
    • ctrlaltdel: Executed when the user presses Ctrl+Alt+Del on the keyboard.

A Production Bare-Minimum /etc/inittab

# /etc/inittab — Minimal BYOL Appliance Init
# 1. System initialization script
::sysinit:/etc/init.d/rcS

# 2. Virtual console login shells (automatically restarted if logged out)
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2

# 3. Serial console (for headless QEMU or cloud instances)
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100

# 4. Keyboard reboot hook
::ctrlaltdel:/sbin/reboot

# 5. Shutdown script (unmounting disks cleanly)
::shutdown:/etc/init.d/rcK

The Companion Initialization Script (/etc/init.d/rcS)

#!/bin/sh
# /etc/init.d/rcS — Early boot mounts and setup
echo "[rcS] Initializing system pseudo-filesystems..."
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev

# Populate device nodes
echo "[rcS] Starting mdev..."
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s

# Set hostname and bring up loopback network
hostname -F /etc/hostname
ifconfig lo 127.0.0.1 up

With this configuration, your operating system boots in less than 200 milliseconds and consumes less than 4 megabytes of total RAM!