Complete 2025 guide to Systemd architecture: 6-layer hierarchy, kernel dependencies, security implementation, and D-Bus communication for Linux administrators.
⚙️ Systemd: Complete Architecture
6-Layer Hierarchy, Kernel Dependencies, openSUSE Security
This article covers systemd architecture in depth, kernel-level interactions, and security implications. Ideal for Linux administrators, developers, and system architects.
📑 Interactive Table of Contents
📖 Introduction
SystemD is neither a conductor nor a magician. It is a fundamental orchestrator within a layered architecture, ensuring coordinated management of services, system resources and communications distributed across eight architectural levels.
SafeITExperts has performed a complete mapping of this architecture and identified six interconnected functional layers (according to RedHat analysis). We have enriched this study by adding two additional essential layers to precisely define the operational boundaries: what SystemD actually assumes and what escapes its management.
✅Real roles of systemd
🎯 systemd is conductor for:
✅ Service startup/shutdown (nginx, docker, unbound, squid)
✅ System resource management (cgroups, memory/CPU limits)
✅ Service ordering at boot
✅ Socket/timer/event activation
❌systemd is NOT conductor for
🎯 systemd is NOT conductor for:
❌ Direct kernel → hardware communication (drivers)
❌ Kernel low-level operations (CPU scheduling, memory management)
❌ TCP/IP network protocols (managed by kernel)
🔄 Systemd communication: Data flows explained with practical examples
Understanding interactions between different layers of systemd architecture
FLOW 1💻 HARDWARE⇄KERNEL
FLOW 2🐧 KERNEL⇄SYSTEMD API
FLOW 3📚 SYSTEMD API⇄SYSTEMD CORE
FLOW 4⚙️ SYSTEMD CORE⇄SYSTEMD DAEMONS
FLOW 5🎯 SYSTEMD CORE➜SYSTEMD TARGETS
FLOW 6🚀 SYSTEMD CORE➜EXTERNAL SERVICES
FLOW 7🖥️ SYSTEMD CORE⇄SYSTEMD UTILITIES
FLOW 8🔧 SYSTEMD DAEMONS⇄SYSTEMD UTILITIES
LAYER 1💻 PC HARDWARE
🎯 Hardware Foundation
Lowest layer - the physical hardware everything relies on.
🔧 Interaction
Linux kernel (layer 2) communicates directly with hardware via drivers.
LAYER 2🐧 LINUX KERNEL
🎯 System Interface
Linux kernel provides all system interfaces needed by systemd.
🔧 Key Features
- cgroups - Resource isolation and limitation
- namespaces - Process and network isolation
- seccomp - Security via syscall filtering
- D-Bus - Inter-process communication
- autofs - Automatic filesystem mounting
LAYER 3📚 SYSTEMD API (Libraries)
🎯 Software Abstraction
Systemd libraries provide abstraction of kernel interfaces.
🔧 Components
- libsystemd-core - Main functionalities
- libsystemd-shared - Reusable common code
- libsystemd - Public API for developers
- sd-bus - Simplified D-Bus interface
- sd-journal - Journal access
LAYER 4⚙️ SYSTEMD CORE (PID1 - Manager)
🎯 Orchestration Core
The PID1 process that orchestrates the entire system.
🔧 Key Responsibilities
- Complete unit management (service, socket, timer, mount)
- Dependency resolution (Requires, Wants, Before, After)
- Transaction processing (consistency validation)
- cgroups hierarchy creation in /sys/fs/cgroup/
- State machine for each unit
- Event loop handling signals + timers
- Manages systemd daemons, targets and external services
LAYER 5a🔧 SYSTEMD DAEMONS
🔧 Specialized Daemons
Each daemon has a specific role and is managed by Core (PID1):
- journald - Centralized logs (binary, secure)
- logind - User sessions + suspend/hibernate
- resolved - DNS with cache + DNSSEC
- networkd - Declarative network configuration
- udevd - Hotplug device events
🏗️ Architecture Relation
Daemons are managed by Core (layer 4) and provide services to utilities (layer 6).
LAYER 5b🎯 SYSTEMD TARGETS (System States)
🎯 Targets Hierarchy
🔗 Dependencies Management
- multi-user.target - Manages critical system services
- graphical.target - Depends on multi-user.target
- user-session.target - Individual user sessions
- Tizen Targets - Specific extensions (telephony, dlog, tizen)
🏗️ Architecture Relation
Targets are special units managed by Core that define system states and group other units. They provide synchronization points for boot and state transitions.
📌 Important Note
Some targets like telephony, bootmode, dlog, tizen service are specific Tizen extensions and are not part of standard systemd components.
LAYER 5c🚀 EXTERNAL SERVICES
🎯 User Services
External services not provided by systemd but managed by it.
🔧 Characteristics
- Managed by systemd but developed independently
- Configuration via unit files in /etc/systemd/system/
- Isolation via cgroups and namespaces
- Monitoring and automatic restart
- Complete integration with systemd ecosystem
🏗️ Architecture Relation
External services are managed by Core (PID1) just like systemd daemons. They benefit from the same features: monitoring, isolation, dependencies, etc.
LAYER 6🖥️ SYSTEMD UTILITIES
🎯 User Interface
Command line tools to interact with systemd.
🔧 Essential Utilities
- systemctl - Service management (start/stop/enable/disable)
- journalctl - Log viewing and filtering
- systemd-analyze - Boot analysis and security
- systemd-run - Command execution in transient units
- systemd-cgtop - Real-time resource monitoring
EX 1⏱️ Timer Example: db-backup-daily
📄 File: /etc/systemd/system/db-backup-daily.timer
EX 2🔧 Service Example: db-backup-daily
📄 File: /etc/systemd/system/db-backup-daily.service
🔗 Execution Flow
🛡️ Security Hardening
KERNEL 1📦 cgroups (Control Groups)
🎯 Responsibilities
- Resource isolation and limitation (CPU, memory, I/O)
- Each daemon/service in its own cgroup
- Hierarchy: root → system.slice → services
- Resource consumption tracking
KERNEL 2🔄 namespaces
🎯 Responsibilities
- Complete process/service isolation
- PrivateTmp=yes → isolated mount namespace
- Each service sees its own PID 1 (if containerized)
- Security by default (no privilege escalation)
KERNEL 3🔐 capabilities
🎯 Responsibilities
- Granular privilege dropping
- No need to run as root for services
- Drastically reduced attack surface
- CapabilityBoundingSet=~CAP_SYS_PTRACE (block ptrace)
KERNEL 4🚫 seccomp Filtering
🎯 Responsibilities
- Block dangerous system calls
- SystemCallFilter=write read close (whitelist)
- SystemCallFilter=~execve socket (blacklist)
- Mitigation zero-day kernel exploits
KERNEL 5🔌 autofs + kdbus (historical)
🎯 Responsibilities
- autofs: Lazy mounting /var/autofs (resource saving)
- kdbus: Historically considered for performant IPC
- kdbus Status: ABANDONED (kernel maintainers disagreements)
- Current: D-Bus via sd-bus (userspace native)
TRANSVERSE🛡️ Security (Transverse Layer)
🎯 Responsibilities
- SELinux: Fine-grained access control (contexts)
- AppArmor: Profile-based (path, permissions)
- D-Bus Security: Secure transports (Unix sockets + encryption)
- systemd Compatibility: All three supported + active together
- DynamicUser=yes: Ephemeral user creation (least privilege)
openSUSE 1📦 cgroups + systemd
🎯 Impact
Each service limited in CPU, memory, I/O. A "crazy" service cannot crash the entire system. Example: nginx with MemoryMax=512M.
📊 Monitoring
openSUSE 2🔐 Capabilities + seccomp
🎯 Impact
Services have only necessary capabilities. No ptrace, no mknod, no module loading. Blocks kernel exploitation.
📊 Analysis
openSUSE 3🔒 SELinux + Firewalld
🎯 Impact
systemd fully compatible SELinux. All D-Bus transports secured via Unix sockets. Firewalld manages firewall rules automatically via systemd.
📊 Verification
openSUSE 4📊 journald + audit
🎯 Impact
journald logs = single source of truth. Binary format (no text falsification). Kernel audit + systemd = complete forensic traceability.
📊 Consultation
DynamicUser=yes creates ephemeral users (dynamic UIDs) for each service. Least privilege principle: each service has its own unique UID, invalidated after stop. Maximum security + complete isolation.
D-BUS 1📡 Communication Flow: systemctl start
🔄 Complete Flow
D-BUS 2🎯 systemd D-Bus Interfaces
🔧 Main Methods
- Manager: StartUnit(), StopUnit(), RestartUnit(), ReloadUnit()
- Unit: Start(), Stop(), Reload(), Restart(), TryRestart()
- Service: SetProperties(), ClearProperties()
📊 Properties
- Unit: ActiveState, SubState, Description, LoadState
- Service: TimeoutStartUSec, TimeoutStopUSec, Restart
D-BUS 3🚀 varlink (Modern JSON Protocol)
📌 Characteristics
- Protocol: JSON-based RPC over Unix sockets
- Advantages: Simpler than D-Bus, better performance
- Status: Progressive adoption (some systemd interfaces)
- Future: Will progressively replace D-Bus for systemd
- Compatibility: D-Bus remains for backward compatibility
D-BUS 4🔐 D-Bus Security
🛡️ Mechanisms
- Socket Security: Unix permissions on /run/dbus/ (mode 0700)
- Policy Engine: /etc/dbus-1/system.d/ (allow/deny rules)
- SELinux: Full MAC integration for D-Bus transports
- Encryption: Unix sockets + credentials passing
CRITICAL 1🎯 systemd is PID1
⚠️ Implications
If systemd PID1 crashes or hangs, ALL other processes are orphaned. Kernel can no longer manage anything. System becomes dead-locked.
✅ Best Practices
- Never disable systemd without replacement
- Continuously monitor systemd logs
- Regularly test boot in rescue mode
- Have recovery plan in place
CRITICAL 2📦 cgroups = resources
⚠️ Implications
No cgroups = non-isolated services = "crazy" service crashes everything. With cgroups: service confined, predictable resources, stable system.
✅ Best Practices
- Configure MemoryMax= for critical services
- Use CPUQuota= to limit CPU
- Monitor with systemd-cgtop continuously
- Analyze with systemd-cgls to understand hierarchy
CRITICAL 3📡 D-Bus = IPC
⚠️ Implications
If D-Bus crashes: systemctl stops working, journalctl unavailable, etc. But systemd PID1 continues (D-Bus not critical). However admin tools become useless.
✅ Best Practices
- Monitor dbus.service status
- Check D-Bus socket: /run/dbus/system_bus_socket
- Configure D-Bus policy correctly
- Integrate SELinux/AppArmor for D-Bus security
CRITICAL 4🔗 Targets + Dependencies
⚠️ Implications
Targets define which services boot. Dependencies define order. Cycles or missing dependencies = boot failure.
✅ Best Practices
- Audit dependencies: systemctl list-dependencies --all
- Check for cycles: systemd-analyze verify /etc/systemd/
- Use After=/Before= correctly
- Test boot with journalctl after changes
CRITICAL 5🔧 Daemons = specialized
⚠️ Implications
Disabling a daemon = losing its functionality. Example: without journald = no centralized logs. Each daemon must run for full functionality.
✅ Best Practices
- Monitor all daemons: systemctl list-units --type=service
- Don't disable criticals (journald, logind, udevd)
- Plan alternatives before disabling
- Use systemd-analyze security to harden daemons
CRITICAL 6🛡️ Multi-Layer Security
⚠️ Implications
Systemd security = multi-layer. Not a single layer, but 3-4 simultaneously. Each complementary (defense-in-depth).
✅ Best Practices
- Enable SELinux + AppArmor + systemd hardening
- Analyze: systemd-analyze security service.service
- Configure CapabilityBoundingSet strictly
- Use SystemCallFilter to block dangerous calls
- Configure DynamicUser=yes (ephemeral users)
CONC 1📚 6 Hierarchical Layers
🎯 Nested Architecture
Each layer depends on the previous one. Crash of one layer = crash of everything that depends on it.
✅ Impact
Understanding this hierarchy = understanding where to debug. systemctl problem? Check D-Bus. D-Bus problem? Check systemd PID1. PID1 problem? Check systemd libraries.
CONC 2🔗 5 Kernel Interfaces + Security
🎯 Defense-in-Depth
Not a single security layer, but 5+ simultaneously. Each complementary. Attacker must go through ALL to compromise system.
✅ Impact
Systemd security = very robust. Even if one layer bypassed, others stop the attack.
CONC 3📡 D-Bus = Central Communication
🎯 Single Point of IPC
D-Bus = only way for utilities to talk to systemd PID1. If D-Bus down: systemctl, journalctl useless. But PID1 continues.
✅ Impact
Monitor D-Bus critically. Configure D-Bus policy. Integrate SELinux for D-Bus. Understand that varlink = future direction.
CONC 4🎯 Dependencies + Targets = Boot
🎯 Boot Orchestration
systemd uses graph theory to orchestrate boot. Resolves dependencies, creates jobs, executes them in parallel (respecting Before/After).
✅ Impact
Incorrect dependency configuration = boot failure. Cycles forbidden! Use systemctl list-dependencies --all to audit.
CONC 5🔧 Resource Isolation via cgroups
🎯 Resource Fairness
Without cgroups: service consumes 100% CPU/RAM = system freeze. With cgroups: service limited to MemoryMax=512M = stable system.
✅ Impact
Configure MemoryMax=, CPUQuota= for critical services. Monitor with systemd-cgtop continuously. This is production key.
CONC 6📊 Monitoring & Best Practices
🎯 Production Ops
Best practices: monitor, audit, document. Use systemd-analyze security regularly. Configure journalctl alerts.
✅ Checklist
- Analyze security: systemd-analyze security APP.service
- Audit dependencies: systemctl list-dependencies --all
- Monitor resources: systemd-cgtop continuously
- Configure DynamicUser=yes (ephemeral users)
- Implement custom CapabilityBoundingSet
- Test boot regularly: systemctl reboot
- Document systemd security strategy
ARTICLES📖 Related Articles
🎯 Recommended Articles
- Linux in 2025: Desktop Environment Compatibilities
- Linux in 2025: Desktop Environment Architecture
- 2025 Security Guide: Proactive Protection for Linux, Windows, and macOS
- Immutable Operating Systems: An Architectural Revolution
🔍 Topics Covered
These articles delve into topics related to the modern Linux ecosystem, system architecture, and emerging trends in 2025.
REFERENCES🔗 Official Documentation
🎯 Official Sources
- systemd Official Documentation
- Freedesktop systemd
- openSUSE systemd Guide
- Kernel cgroups v2 Documentation
- Linux Capabilities Man Page
📚 Technical Resources
Official documentation to deepen the technical concepts covered in this article, including systemd, the Linux kernel, and security mechanisms.
🏆 systemd Documentation - Complete Architecture for Advanced Users
Sources: systemd.io | man pages | Linux kernel docs
For SafeITExperts - In-depth technical article | Final Corrected Version - 6-Layer Architecture Validated
/image%2F7127247%2F20251113%2Fob_117401_architecture-systemd.jpg)
