run_init
Execute init program for new root
TLDR
Run a script in the init script context
Run a script with arguments
Run a script and specify the init script context explicitly
Display the context that would be used without running the script
SYNOPSIS
run_init new_root [old_root_mountpoint]
PARAMETERS
new_root
The path to the directory that will become the new root filesystem.
old_root_mountpoint
(Optional) The path within the new_root where the original root filesystem will be moved. If omitted, the old root might be unmounted or handled implicitly.
DESCRIPTION
run_init is a utility primarily found in embedded systems, initramfs/initrd environments, or BusyBox installations. Its core function is to facilitate the transition from a temporary root filesystem (like an initramfs) to the final, persistent root filesystem.
It achieves this by performing operations similar to pivot_root, which involves moving the current root filesystem to a new location within the new root (e.g., /old_root), then making the new filesystem the actual root, and finally executing the init process from the new root filesystem. This command is crucial during the Linux boot sequence, especially when the kernel loads an initial ramdisk to set up the environment before switching to the disk-based root. It ensures that services can be properly started from the new root without needing to reboot. It is rarely invoked directly by users on a running system.
CAVEATS
run_init is not a standard command found in most userland usr/bin directories on typical desktop or server Linux distributions. It's often a component of BusyBox or a custom script used during system boot. Incorrect usage can lead to an unbootable system or data loss.
It requires root privileges to operate and typically involves critical filesystem manipulation. Therefore, it should only be used in controlled boot environments or by experienced system administrators. Its exact behavior can vary slightly between different implementations.
USAGE CONTEXTS
This command is almost exclusively used during the boot process of a Linux system, particularly when an initramfs or initrd is employed. It allows the kernel to load a minimal set of drivers and utilities from RAM, resolve dependencies for mounting the actual root filesystem (e.g., encrypted root, network-mounted root), and then cleanly transition to that final root filesystem and its designated init process. It's rarely invoked manually on a running system, though it can be used for advanced system recovery or custom boot setups.
HISTORY
The concept behind run_init dates back to the early days of Linux initramfs and initrd (initial RAM disk) development. As systems became more complex, especially with modular kernels and diverse hardware, a temporary root filesystem was needed to load essential drivers before accessing the real root filesystem.run_init (or similar scripts/utilities) emerged as a way to perform the final switch from this temporary environment to the persistent root, ensuring a smooth transition of process control to the system's actual init program. BusyBox, a popular utility collection for embedded Linux, provides a widely used run-init applet, standardizing its usage in many minimalist environments.
SEE ALSO
pivot_root(8), chroot(1), init(8), busybox(1), initramfs(7)


