Linux systemd Process
Linux systemd Process
🔧 What is systemd
?
When the Linux Kernel completes its initialization, it starts the systemd or the init process as the first userspace program (PID 1)
systemd
is an init system and a system and service manager for Linux operating systems. It is responsible for initializing the user space and managing all other processes after the system boots. It is designed to provide parallelization, faster boot times, and centralized service management.
🧬 systemd
in Boot Process
- BIOS/UEFI: Initializes hardware and selects the boot device.
- Bootloader (e.g., GRUB): Loads the Linux kernel into memory and hands over control.
- Linux Kernel: Initializes hardware and mounts the root filesystem, then runs
/sbin/init
(linked to/lib/systemd/systemd
). - systemd: Becomes
PID 1
, initializes user space, starts services, and manages system state.
🧱 systemd Features
Some of the features are as follows:
Feature | Description |
---|---|
Service Management | Starts, stops, restarts services with unit files (*.service ) |
Parallelization | Starts services in parallel based on dependencies |
Socket Activation | Starts services when their sockets are accessed |
Journal Logging | Built-in logging system (journald ) |
Target Units | Replaces traditional runlevels (e.g., graphical.target ) |
Resource Control | Uses cgroups to manage system resources |
🔍 Example Commands
Some of the example command are as follows:
# Show system boot status
systemctl status
# List all services
systemctl list-units --type=service
# Start a service
sudo systemctl start nginx.service
# Enable a service at boot
sudo systemctl enable sshd.service
📂 systemd Unit Types
*.service
– System services*.socket
– Sockets*.target
– Groups of services (like runlevels)*.mount
– File system mount points*.timer
– Scheduled tasks (like cron jobs)*.device
,*.path
– Devices and paths
systemd
is the first user-space process started by the Linux kernel. It is PID 1 and essential for bootstrapping the rest of the system. It provides powerful tools to manage services and the overall boot process efficiently.