SlideShare a Scribd company logo
Systemd Usage Guide on RHEL 7
i | P a g e
Table of Contents
Overview.......................................................................................................................................................1
Applies To..................................................................................................................................................1
Pre-Requisites ...........................................................................................................................................1
Systemd – Generic Information....................................................................................................................1
Version......................................................................................................................................................1
Binaries......................................................................................................................................................1
Process System..........................................................................................................................................2
Systemd – Units ............................................................................................................................................2
Systemd – Boot Process................................................................................................................................3
Analyze systemd – Boot Process...............................................................................................................3
Analyze systemd – Each Boot Process......................................................................................................4
Analyze systemd – Critical Chain at Boot..................................................................................................5
Analyze systemd – Critical Chain by Service Unit .....................................................................................6
Analyze systemd – Critical Chain by Target ..............................................................................................6
Systemd Units Commands............................................................................................................................7
List Units – Available.................................................................................................................................7
List Units – Running ..................................................................................................................................8
List Units – Failed ......................................................................................................................................8
List Units – By Type Service.......................................................................................................................9
List Units – By Type Mount .......................................................................................................................9
List Units – By Type Socket .....................................................................................................................10
List Units – By Type Slice.........................................................................................................................10
List Units – By Type Swap........................................................................................................................11
List Units – By Type Snapshot .................................................................................................................11
List Units – By Type Path.........................................................................................................................11
List Units – By Type Timer.......................................................................................................................12
So What’s systemctl / systemd unit Files....................................................................................................12
List Service – All Properties.....................................................................................................................13
List Service – Specific Property - CPUShares...........................................................................................13
List Service – Specific Property - CanReload...........................................................................................14
List Service – Specific Property - Conflicts ..............................................................................................14
Systemd Usage Guide on RHEL 7
ii | P a g e
Service Dependencies.................................................................................................................................14
List Dependencies...................................................................................................................................15
List Service Dependencies by Service .....................................................................................................16
List Dependencies by Target...................................................................................................................16
List Service Dependencies – For Service.................................................................................................17
List Service Dependencies – Before........................................................................................................17
List Service Dependencies – After...........................................................................................................18
List Service Dependencies – Reverse......................................................................................................18
List Service Dependencies – Target ........................................................................................................19
List Service Dependencies – Plot ............................................................................................................19
Systemd Usage Guide on RHEL 7
1 | P a g e
Overview
Systemctl is a systemd utility which is responsible for controlling the systemd system and service manager.
Systemd is a collection of system management daemons, utilities and libraries which serves as a
replacement of SystemV init daemon.
Systemd functions as central management and configuration platform for UNIX like system.
Applies To
Tested on RHEL 7, CentOS 7.
Pre-Requisites
 None
Systemd – Generic Information
Version
To find the version of systemctl executable, run the command;
systemctl --version
Binaries
To find the binaries of systemctl executable, run the command;
whereis systemctl
Systemd Usage Guide on RHEL 7
2 | P a g e
Process System
To know the process associated with systemd run the command;
ps -eaf | grep [s]ystemd
Systemd – Units
There are different units that are managed by systemd and it accepts following units.
Systemctl Units Purpose
systemd.service Manage System Service;
A unit configuration file whose name ends in .service encodes information about
a process controlled and supervised by systemd.
systemd.socket Manage sockets for each service;
A unit configuration file whose name ends in ".socket" encodes information
about an IPC or network socket or a file system FIFO controlled and supervised
by systemd, for socket-based activation.
systemd.device Manage devices;
A unit configuration file whose name ends in ".device" encodes information
about a device unit as exposed in the sysfs/udev device tree.
systemd.mount Manage mount points;
A unit configuration file whose name ends in ".mount" encodes information
about a file system mount point controlled and supervised by systemd.
systemd.target Manage targets;
A unit configuration file whose name ends in ".target" encodes information
about a target unit of systemd, which is used for grouping units and as well-
known synchronization points during start-up.
Target units do not offer any additional functionality on top of the generic
functionality provided by units. They exist merely to group units via
dependencies (useful as boot targets), and to establish standardized names for
synchronization points used in dependencies between units. Among other
Systemd Usage Guide on RHEL 7
3 | P a g e
things, target units are a more flexible replacement for SysV runlevels in the
classic SysV init system.
systemd.paths Check the existence of files or directories or create them as needed
systemd.slices Manage resources
systemd.snapshots Takes snapshots of the current state of the system
systemd.sockets Set up sockets to allow communication paths to processes that can remain in
place, even if the underlying process needs to restart
systemd.swaps Create and use swap files or swap partitions
Systemd.timer Trigger actions based on a timer
Systemd – Boot Process
systemd is the first process started by the kernel. It replaces the venerable SysVinit program (also
called init) and the newer Upstart init system. systemd coordinates the rest of the boot process and
configures the environment for the user.
systemd improves on other init systems with increased parallelization. It starts the process of loading all
programs it launches immediately, and manages information between interdependent programs as they
load. By dissociating programs and their means of communication, each program is able to load without
waiting for unrelated or even dependent programs to load first.
Analyze systemd – Boot Process
To find out overall boot-up performance time consumption for the boot processes under different
categories, run the command;
systemd-analyze
This information are categorized under different heads such as;
 kernel
 initrd
 userspace
Systemd Usage Guide on RHEL 7
4 | P a g e
Analyze systemd – Each Boot Process
You can also analyze boot-up performance, the time consumed by each task / service during the boot
process. Run the command;
systemd-analyze blame
Systemd Usage Guide on RHEL 7
5 | P a g e
Analyze systemd – Critical Chain at Boot
To analyze the boot-up processes that’s critical for the booting the system in the current target, run the
command;
systemd-analyze critical-chain
Note:
 If the list is very long the overall boot process is extended / delay in system boot.
 Time after the unit is active or started is printed after the "@" character.
 Time the unit takes to start is printed after the "+" character.
Systemd Usage Guide on RHEL 7
6 | P a g e
Analyze systemd – Critical Chain by Service Unit
To analyze the boot-up process for a specific service unit and its critical chain, run the command;
systemd-analyze critical-chain sshd.service
Note:
 If the list is very long the overall boot process is extended / delay. In case of the specific service takes
longer time to start, it would impact the overall booting of the server
 Time after the unit is active or started is printed after the "@" character.
 Time the unit takes to start is printed after the "+" character.
Analyze systemd – Critical Chain by Target
To list the “Critical Chain” for different targets, to know the analysis run the command;
systemd-analyze critical-chain basic.target | grep target
Note:
 Time after the unit is active or started is printed after the "@" character.
 Time the unit takes to start is printed after the "+" character.
Systemd Usage Guide on RHEL 7
7 | P a g e
Systemd Units Commands
Units are the objects that systemd knows how to manage it. It’s standardized representation of system
resources that can be managed by the suite of daemons and it can be manipulated by the provided
utilities.
Units in some ways can be said to similar to services or jobs in other init systems.
List Units – Available
Unit files allow systemd to address multiple units from a single configuration file. You can call a systemd
template unit file. To list from the template, unit files configured on the system along with their current
state of each unit run the command;
systemctl list-unit-files
Systemd Usage Guide on RHEL 7
8 | P a g e
List Units – Running
Unit files allow systemd to address multiple units from a single configuration file. You can call a systemd
template unit file. To list from the template, active state unit files configured on the system run the
command;
systemctl list-units --state=active
List Units – Failed
Unit files allow systemd to address multiple units from a single configuration file. You can call a systemd
template unit file. To list from the template, failed state unit files configured on the system run the
command;
systemctl list-units --state=failed
Systemd Usage Guide on RHEL 7
9 | P a g e
List Units – By Type Service
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.service”
encodes information about a process controlled and managed by systemd , to list service units run the
command;
systemctl list-units --type=service
List Units – By Type Mount
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.mount”
encodes information about a process controlled and managed by systemd , to list mount points run the
command;
systemctl list-unit-files --type=mount
Systemd Usage Guide on RHEL 7
10 | P a g e
List Units – By Type Socket
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.socket”
encodes information an IPC or network socket or a file system FIFO controlled and supervised by systemd,
for socket-based activation, to list sockets that are configured and enabled, run the command;
systemctl list-unit-files --type=socket
List Units – By Type Slice
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.slice” encodes
information about a slice which is a concept for hierarchically managing resources of a group of
processes. This management is performed by creating a node in the Linux Control Group (cgroup) tree, ,
run the command;
systemctl list-unit-files --type=slice
Systemd Usage Guide on RHEL 7
11 | P a g e
List Units – By Type Swap
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.swap”
encodes swap device or file for memory paging controlled and supervised by systemd, run the command;
systemctl list-unit-files --type=swap
List Units – By Type Snapshot
Snapshot units are not configured via unit configuration files. Nonetheless they are named similar to
filenames. A unit whose name ends in ".snapshot" refers to a dynamic snapshot of the systemd runtime
state.
Snapshots are not configured on disk but created dynamically via systemctl, run the command;
systemctl list-unit-files --type=snapshot
List Units – By Type Path
systemctl list-unit-files --type=path
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.path”
encodes information about path monitored by systemd, for path-based activation, run the command;
Systemd Usage Guide on RHEL 7
12 | P a g e
List Units – By Type Timer
Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.timer”
encodes timer controlled and supervised by systemd, for timer-based activation.
systemctl list-unit-files --type=timer
So What’s systemctl / systemd unit Files
The unit files on your system determine how systemd will start and run. Each corresponds to a single
activity or component or unit in systemd terms.
 The global systemd configuration is stored in the /etc/systemd directory.
 The service configuration files are located in the /usr/lib/systemd/system directory.
 Custom service configuration files are stored in the /etc/systemd/system directory.
Each unit file is a simple text file describing a unit, what it does, what needs to run before or afterward,
and other details. Unit files can be stored in a few different places on your system. systemd looks for
system unit files in the following order;
Path Purpose Mode
/etc/systemd/system Local Configuration System
/run/systemd/system Run-time Units System
/usr/lib/systemd/system Units provided by installed packages System
Depending on whether “--system” “--user” “--runtime” or “--global” is specified, this enables the unit for
the system, for the calling user only, for only this boot of the system, or for all future logins of all users, or
only this boot.
Note: In the last case, systemd daemon configuration is reloaded.
Similarly, systemd can also run in a user context and manage resources per user in addition to system-
side. Unit files for user units are stored similarly in folders
Path Purpose Mode
/etc/systemd/user Local Configuration User
/run/systemd/user Run-time Units User
/usr/lib/systemd/user Units provided by installed packages User
Note: The order of precedence works similarly way.
Systemd Usage Guide on RHEL 7
13 | P a g e
List Service – All Properties
List all the properties of a unit. It will display a list of properties that are set for the specified unit.
systemctl show rsyslogd --all
List Service – Specific Property - CPUShares
List a specific property of a service / unit, enter the attribute name. Run the command;
systemctl show rsyslogd -p CPUShares
Note: The default each service has a CPUShare = 1024. It can be configured to increase/decrease CPU
share of a process.
Systemd Usage Guide on RHEL 7
14 | P a g e
List Service – Specific Property - CanReload
List dependencies for a service / unit, if the service can automatically reload. Run the command;
systemctl show rsyslogd -p CanReload
List Service – Specific Property - Conflicts
List dependencies for a service / unit, if the service can automatically reload. Run the command;
In case sshd.service conflicts, it will invoke shutdown.target which will shutdown the unit / service.
systemctl show sshd.service -p Conflicts
Service Dependencies
One other information that can be collate or reviewed is dependencies for each target(s) or each unit(s).
Service dependencies allow you to conditionally include submodules and functionality, based on what the
service / units library require.
There are two types systemd dependencies that exists between units:
 Dependencies that affect the activation of units, that are
 Requires
 Wants
 Conflicts
 Dependencies that affect the order of units, that are
 After
 Before
Systemd Usage Guide on RHEL 7
15 | P a g e
List Dependencies
To list the services, current target dependencies run the command;
systemctl list-dependencies
Systemd Usage Guide on RHEL 7
16 | P a g e
List Service Dependencies by Service
To list the services dependencies run the command;
systemctl list-dependencies sshd.service
List Dependencies by Target
To list the target dependencies run the command;
systemctl list-dependencies graphical.target | grep target
Systemd Usage Guide on RHEL 7
17 | P a g e
List Service Dependencies – For Service
Show the service / unit dependencies. To know the dependencies of rsyslog.service, run the command;
systemctl list-dependencies rsyslog.service
List Service Dependencies – Before
List the units that are ordered after the specified unit.
systemctl list-dependencies rsyslog.service --before
Systemd Usage Guide on RHEL 7
18 | P a g e
List Service Dependencies – After
show the units that are ordered before the specified unit
systemctl list-dependencies rsyslog.service --after
List Service Dependencies – Reverse
Show reverse dependencies between units, List units with dependencies of type Wants= or Requires= on
the given unit.
systemctl list-dependencies rsyslog.service --reverse
Systemd Usage Guide on RHEL 7
19 | P a g e
List Service Dependencies – Target
List critical chain for network and local-fs targets.
systemd-analyze critical-chain network.target local-fs.target
List Service Dependencies – Plot
Analyze systemd and plot into a file.
systemd-analyze plot > systemd_analyze_plot.svg

More Related Content

PDF
LSOF Command Usage on RHEL 7
VCP Muthukrishna
 
PDF
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure Splunk on RHEL 7 in AWS
VCP Muthukrishna
 
PDF
How to Configure OpenFiler for NFS Share
VCP Muthukrishna
 
PDF
Installation CentOS 6.3
VCP Muthukrishna
 
PDF
How To Install OpenFire in CentOS 7
VCP Muthukrishna
 
PDF
How To Configure Apache VirtualHost on RHEL 7 on AWS
VCP Muthukrishna
 
PDF
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
VCP Muthukrishna
 
LSOF Command Usage on RHEL 7
VCP Muthukrishna
 
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
VCP Muthukrishna
 
How To Install and Configure Splunk on RHEL 7 in AWS
VCP Muthukrishna
 
How to Configure OpenFiler for NFS Share
VCP Muthukrishna
 
Installation CentOS 6.3
VCP Muthukrishna
 
How To Install OpenFire in CentOS 7
VCP Muthukrishna
 
How To Configure Apache VirtualHost on RHEL 7 on AWS
VCP Muthukrishna
 
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
VCP Muthukrishna
 

What's hot (20)

PDF
How to installation and configure apache2
VCP Muthukrishna
 
PDF
How To Install CentOS 7
VCP Muthukrishna
 
PDF
Linux Basic Administration Commands Guide
VCP Muthukrishna
 
PDF
How To Install and Configure Salt Master on Ubuntu
VCP Muthukrishna
 
PDF
How To Install and Configure SUDO on RHEL 7
VCP Muthukrishna
 
PDF
How To Install and Generate Audit Reports in CentOS 7 or RHEL 7
VCP Muthukrishna
 
PDF
How To View Login History and Logout History on RHEL 7
VCP Muthukrishna
 
PDF
How To Protect SSH Access with Fail2Ban on RHEL 7
VCP Muthukrishna
 
PDF
Configure Run Levels RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure AWS CLI on RHEL 7
VCP Muthukrishna
 
PDF
How to Change Hostname in CentOS 7 or RHEL 7
VCP Muthukrishna
 
PDF
How To Install and Configure Apache SSL on CentOS 7
VCP Muthukrishna
 
PDF
How To Configure FirewallD on RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
How to Install Configure and Use sysstat utils on RHEL 7
VCP Muthukrishna
 
PDF
How to Upgrade Openfire on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure Chrony on RHEL 7
VCP Muthukrishna
 
PDF
How to install and configure firewall on ubuntu os
VCP Muthukrishna
 
PDF
How to Install MariaDB Server or MySQL Server on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure Screen on CentOS 7
VCP Muthukrishna
 
PDF
Habilitar repositorio EPEL RHEL
Moisés Elías Araya
 
How to installation and configure apache2
VCP Muthukrishna
 
How To Install CentOS 7
VCP Muthukrishna
 
Linux Basic Administration Commands Guide
VCP Muthukrishna
 
How To Install and Configure Salt Master on Ubuntu
VCP Muthukrishna
 
How To Install and Configure SUDO on RHEL 7
VCP Muthukrishna
 
How To Install and Generate Audit Reports in CentOS 7 or RHEL 7
VCP Muthukrishna
 
How To View Login History and Logout History on RHEL 7
VCP Muthukrishna
 
How To Protect SSH Access with Fail2Ban on RHEL 7
VCP Muthukrishna
 
Configure Run Levels RHEL 7 or CentOS 7
VCP Muthukrishna
 
How To Install and Configure AWS CLI on RHEL 7
VCP Muthukrishna
 
How to Change Hostname in CentOS 7 or RHEL 7
VCP Muthukrishna
 
How To Install and Configure Apache SSL on CentOS 7
VCP Muthukrishna
 
How To Configure FirewallD on RHEL 7 or CentOS 7
VCP Muthukrishna
 
How to Install Configure and Use sysstat utils on RHEL 7
VCP Muthukrishna
 
How to Upgrade Openfire on CentOS 7
VCP Muthukrishna
 
How To Install and Configure Chrony on RHEL 7
VCP Muthukrishna
 
How to install and configure firewall on ubuntu os
VCP Muthukrishna
 
How to Install MariaDB Server or MySQL Server on CentOS 7
VCP Muthukrishna
 
How To Install and Configure Screen on CentOS 7
VCP Muthukrishna
 
Habilitar repositorio EPEL RHEL
Moisés Elías Araya
 
Ad

Viewers also liked (10)

PDF
How To Reset root Password on CentOS 7
VCP Muthukrishna
 
PDF
How To Manage Services on RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
How to Manage journalctl Logging System on RHEL 7
VCP Muthukrishna
 
PDF
How To Install and Use ABRT CLI on RHEL 7
VCP Muthukrishna
 
PDF
How To Check file exists and Delete PowerShell
VCP Muthukrishna
 
PDF
How To View Current Execution Policy PowerShell
VCP Muthukrishna
 
PDF
How To Manage Linux User on RHEL 7
VCP Muthukrishna
 
PDF
How To Create RDS Database for WordPress in AWS on RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure SNMP on RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
VCP Muthukrishna
 
How To Reset root Password on CentOS 7
VCP Muthukrishna
 
How To Manage Services on RHEL 7 or CentOS 7
VCP Muthukrishna
 
How to Manage journalctl Logging System on RHEL 7
VCP Muthukrishna
 
How To Install and Use ABRT CLI on RHEL 7
VCP Muthukrishna
 
How To Check file exists and Delete PowerShell
VCP Muthukrishna
 
How To View Current Execution Policy PowerShell
VCP Muthukrishna
 
How To Manage Linux User on RHEL 7
VCP Muthukrishna
 
How To Create RDS Database for WordPress in AWS on RHEL 7 or CentOS 7
VCP Muthukrishna
 
How To Install and Configure SNMP on RHEL 7 or CentOS 7
VCP Muthukrishna
 
Install and Configure WordPress in AWS on RHEL 7 or CentOS 7
VCP Muthukrishna
 
Ad

Similar to SystemD Usage Guide (20)

PDF
Systemd for developers
Alison Chaiken
 
PDF
Systemd: the modern Linux init system you will learn to love
Alison Chaiken
 
PDF
Your first dive into systemd!
Etsuji Nakai
 
PDF
LISA15: systemd, the Next-Generation Linux System Manager
Alison Chaiken
 
PDF
Tuning systemd for embedded
Alison Chaiken
 
ODP
SystemV vs systemd
All Things Open
 
PDF
systemd
nussbauml
 
PDF
Systemd mlug-20140614
Susant Sahani
 
PDF
Automotive Grade Linux and systemd
Alison Chaiken
 
PDF
Basic of Systemd
Praveen Kumar
 
PDF
Systemd
Susant Sahani
 
PDF
Systemd poettering
Susant Sahani
 
PPTX
Systemd 간략하게 정리하기
Seungha Son
 
PDF
IBM Systems Technical Symposium Melbourne, 2015
Filipe Miranda
 
PDF
Pdf c1t tlawaxb
Susant Sahani
 
PDF
Summit demystifying systemd1
Susant Sahani
 
PPTX
First steps on CentOs7
Marc Cortinas Val
 
ODP
CLUG 2010 09 - systemd - the new init system
PaulWay
 
PPTX
Systemd
Ganesh Bhosale
 
PDF
Red Hat for IBM System z IBM Enterprise2014 Las Vegas
Filipe Miranda
 
Systemd for developers
Alison Chaiken
 
Systemd: the modern Linux init system you will learn to love
Alison Chaiken
 
Your first dive into systemd!
Etsuji Nakai
 
LISA15: systemd, the Next-Generation Linux System Manager
Alison Chaiken
 
Tuning systemd for embedded
Alison Chaiken
 
SystemV vs systemd
All Things Open
 
systemd
nussbauml
 
Systemd mlug-20140614
Susant Sahani
 
Automotive Grade Linux and systemd
Alison Chaiken
 
Basic of Systemd
Praveen Kumar
 
Systemd
Susant Sahani
 
Systemd poettering
Susant Sahani
 
Systemd 간략하게 정리하기
Seungha Son
 
IBM Systems Technical Symposium Melbourne, 2015
Filipe Miranda
 
Pdf c1t tlawaxb
Susant Sahani
 
Summit demystifying systemd1
Susant Sahani
 
First steps on CentOs7
Marc Cortinas Val
 
CLUG 2010 09 - systemd - the new init system
PaulWay
 
Red Hat for IBM System z IBM Enterprise2014 Las Vegas
Filipe Miranda
 

More from VCP Muthukrishna (20)

PDF
How to Fix Duplicate Packages in YUM on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure GNome on CentOS 7
VCP Muthukrishna
 
PDF
How To Connect to Active Directory User Validation
VCP Muthukrishna
 
PDF
How To Connect To Active Directory PowerShell
VCP Muthukrishna
 
PDF
How To List Files on Remote Server - PowerShell
VCP Muthukrishna
 
PDF
How To List Files and Display In HTML Format
VCP Muthukrishna
 
PDF
How To Check and Delete a File via PowerShell
VCP Muthukrishna
 
PDF
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
VCP Muthukrishna
 
PDF
How To Setup SSH Keys on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure Open SSH Server on Ubuntu
VCP Muthukrishna
 
PDF
Windows PowerShell Basics - How To List PSDrive Info
VCP Muthukrishna
 
PDF
How To List Nginx Modules Installed / Complied on CentOS 7
VCP Muthukrishna
 
PDF
Windows PowerShell Basics – How To Create powershell for loop
VCP Muthukrishna
 
PDF
How To Construct IF and Else Conditional Statements
VCP Muthukrishna
 
PDF
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
VCP Muthukrishna
 
PDF
How To Create Power Shell Function Mandatory Parameter Value
VCP Muthukrishna
 
PDF
How To Create PowerShell Function
VCP Muthukrishna
 
PDF
How To Disable IE Enhanced Security Windows PowerShell
VCP Muthukrishna
 
PDF
How To Check IE Enhanced Security Is Enabled Windows PowerShell
VCP Muthukrishna
 
PDF
How To Configure Nginx Load Balancer on CentOS 7
VCP Muthukrishna
 
How to Fix Duplicate Packages in YUM on CentOS 7
VCP Muthukrishna
 
How To Install and Configure GNome on CentOS 7
VCP Muthukrishna
 
How To Connect to Active Directory User Validation
VCP Muthukrishna
 
How To Connect To Active Directory PowerShell
VCP Muthukrishna
 
How To List Files on Remote Server - PowerShell
VCP Muthukrishna
 
How To List Files and Display In HTML Format
VCP Muthukrishna
 
How To Check and Delete a File via PowerShell
VCP Muthukrishna
 
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
VCP Muthukrishna
 
How To Setup SSH Keys on CentOS 7
VCP Muthukrishna
 
How To Install and Configure Open SSH Server on Ubuntu
VCP Muthukrishna
 
Windows PowerShell Basics - How To List PSDrive Info
VCP Muthukrishna
 
How To List Nginx Modules Installed / Complied on CentOS 7
VCP Muthukrishna
 
Windows PowerShell Basics – How To Create powershell for loop
VCP Muthukrishna
 
How To Construct IF and Else Conditional Statements
VCP Muthukrishna
 
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
VCP Muthukrishna
 
How To Create Power Shell Function Mandatory Parameter Value
VCP Muthukrishna
 
How To Create PowerShell Function
VCP Muthukrishna
 
How To Disable IE Enhanced Security Windows PowerShell
VCP Muthukrishna
 
How To Check IE Enhanced Security Is Enabled Windows PowerShell
VCP Muthukrishna
 
How To Configure Nginx Load Balancer on CentOS 7
VCP Muthukrishna
 

Recently uploaded (20)

PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Software Development Methodologies in 2025
KodekX
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 

SystemD Usage Guide

  • 1. Systemd Usage Guide on RHEL 7 i | P a g e Table of Contents Overview.......................................................................................................................................................1 Applies To..................................................................................................................................................1 Pre-Requisites ...........................................................................................................................................1 Systemd – Generic Information....................................................................................................................1 Version......................................................................................................................................................1 Binaries......................................................................................................................................................1 Process System..........................................................................................................................................2 Systemd – Units ............................................................................................................................................2 Systemd – Boot Process................................................................................................................................3 Analyze systemd – Boot Process...............................................................................................................3 Analyze systemd – Each Boot Process......................................................................................................4 Analyze systemd – Critical Chain at Boot..................................................................................................5 Analyze systemd – Critical Chain by Service Unit .....................................................................................6 Analyze systemd – Critical Chain by Target ..............................................................................................6 Systemd Units Commands............................................................................................................................7 List Units – Available.................................................................................................................................7 List Units – Running ..................................................................................................................................8 List Units – Failed ......................................................................................................................................8 List Units – By Type Service.......................................................................................................................9 List Units – By Type Mount .......................................................................................................................9 List Units – By Type Socket .....................................................................................................................10 List Units – By Type Slice.........................................................................................................................10 List Units – By Type Swap........................................................................................................................11 List Units – By Type Snapshot .................................................................................................................11 List Units – By Type Path.........................................................................................................................11 List Units – By Type Timer.......................................................................................................................12 So What’s systemctl / systemd unit Files....................................................................................................12 List Service – All Properties.....................................................................................................................13 List Service – Specific Property - CPUShares...........................................................................................13 List Service – Specific Property - CanReload...........................................................................................14 List Service – Specific Property - Conflicts ..............................................................................................14
  • 2. Systemd Usage Guide on RHEL 7 ii | P a g e Service Dependencies.................................................................................................................................14 List Dependencies...................................................................................................................................15 List Service Dependencies by Service .....................................................................................................16 List Dependencies by Target...................................................................................................................16 List Service Dependencies – For Service.................................................................................................17 List Service Dependencies – Before........................................................................................................17 List Service Dependencies – After...........................................................................................................18 List Service Dependencies – Reverse......................................................................................................18 List Service Dependencies – Target ........................................................................................................19 List Service Dependencies – Plot ............................................................................................................19
  • 3. Systemd Usage Guide on RHEL 7 1 | P a g e Overview Systemctl is a systemd utility which is responsible for controlling the systemd system and service manager. Systemd is a collection of system management daemons, utilities and libraries which serves as a replacement of SystemV init daemon. Systemd functions as central management and configuration platform for UNIX like system. Applies To Tested on RHEL 7, CentOS 7. Pre-Requisites  None Systemd – Generic Information Version To find the version of systemctl executable, run the command; systemctl --version Binaries To find the binaries of systemctl executable, run the command; whereis systemctl
  • 4. Systemd Usage Guide on RHEL 7 2 | P a g e Process System To know the process associated with systemd run the command; ps -eaf | grep [s]ystemd Systemd – Units There are different units that are managed by systemd and it accepts following units. Systemctl Units Purpose systemd.service Manage System Service; A unit configuration file whose name ends in .service encodes information about a process controlled and supervised by systemd. systemd.socket Manage sockets for each service; A unit configuration file whose name ends in ".socket" encodes information about an IPC or network socket or a file system FIFO controlled and supervised by systemd, for socket-based activation. systemd.device Manage devices; A unit configuration file whose name ends in ".device" encodes information about a device unit as exposed in the sysfs/udev device tree. systemd.mount Manage mount points; A unit configuration file whose name ends in ".mount" encodes information about a file system mount point controlled and supervised by systemd. systemd.target Manage targets; A unit configuration file whose name ends in ".target" encodes information about a target unit of systemd, which is used for grouping units and as well- known synchronization points during start-up. Target units do not offer any additional functionality on top of the generic functionality provided by units. They exist merely to group units via dependencies (useful as boot targets), and to establish standardized names for synchronization points used in dependencies between units. Among other
  • 5. Systemd Usage Guide on RHEL 7 3 | P a g e things, target units are a more flexible replacement for SysV runlevels in the classic SysV init system. systemd.paths Check the existence of files or directories or create them as needed systemd.slices Manage resources systemd.snapshots Takes snapshots of the current state of the system systemd.sockets Set up sockets to allow communication paths to processes that can remain in place, even if the underlying process needs to restart systemd.swaps Create and use swap files or swap partitions Systemd.timer Trigger actions based on a timer Systemd – Boot Process systemd is the first process started by the kernel. It replaces the venerable SysVinit program (also called init) and the newer Upstart init system. systemd coordinates the rest of the boot process and configures the environment for the user. systemd improves on other init systems with increased parallelization. It starts the process of loading all programs it launches immediately, and manages information between interdependent programs as they load. By dissociating programs and their means of communication, each program is able to load without waiting for unrelated or even dependent programs to load first. Analyze systemd – Boot Process To find out overall boot-up performance time consumption for the boot processes under different categories, run the command; systemd-analyze This information are categorized under different heads such as;  kernel  initrd  userspace
  • 6. Systemd Usage Guide on RHEL 7 4 | P a g e Analyze systemd – Each Boot Process You can also analyze boot-up performance, the time consumed by each task / service during the boot process. Run the command; systemd-analyze blame
  • 7. Systemd Usage Guide on RHEL 7 5 | P a g e Analyze systemd – Critical Chain at Boot To analyze the boot-up processes that’s critical for the booting the system in the current target, run the command; systemd-analyze critical-chain Note:  If the list is very long the overall boot process is extended / delay in system boot.  Time after the unit is active or started is printed after the "@" character.  Time the unit takes to start is printed after the "+" character.
  • 8. Systemd Usage Guide on RHEL 7 6 | P a g e Analyze systemd – Critical Chain by Service Unit To analyze the boot-up process for a specific service unit and its critical chain, run the command; systemd-analyze critical-chain sshd.service Note:  If the list is very long the overall boot process is extended / delay. In case of the specific service takes longer time to start, it would impact the overall booting of the server  Time after the unit is active or started is printed after the "@" character.  Time the unit takes to start is printed after the "+" character. Analyze systemd – Critical Chain by Target To list the “Critical Chain” for different targets, to know the analysis run the command; systemd-analyze critical-chain basic.target | grep target Note:  Time after the unit is active or started is printed after the "@" character.  Time the unit takes to start is printed after the "+" character.
  • 9. Systemd Usage Guide on RHEL 7 7 | P a g e Systemd Units Commands Units are the objects that systemd knows how to manage it. It’s standardized representation of system resources that can be managed by the suite of daemons and it can be manipulated by the provided utilities. Units in some ways can be said to similar to services or jobs in other init systems. List Units – Available Unit files allow systemd to address multiple units from a single configuration file. You can call a systemd template unit file. To list from the template, unit files configured on the system along with their current state of each unit run the command; systemctl list-unit-files
  • 10. Systemd Usage Guide on RHEL 7 8 | P a g e List Units – Running Unit files allow systemd to address multiple units from a single configuration file. You can call a systemd template unit file. To list from the template, active state unit files configured on the system run the command; systemctl list-units --state=active List Units – Failed Unit files allow systemd to address multiple units from a single configuration file. You can call a systemd template unit file. To list from the template, failed state unit files configured on the system run the command; systemctl list-units --state=failed
  • 11. Systemd Usage Guide on RHEL 7 9 | P a g e List Units – By Type Service Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.service” encodes information about a process controlled and managed by systemd , to list service units run the command; systemctl list-units --type=service List Units – By Type Mount Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.mount” encodes information about a process controlled and managed by systemd , to list mount points run the command; systemctl list-unit-files --type=mount
  • 12. Systemd Usage Guide on RHEL 7 10 | P a g e List Units – By Type Socket Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.socket” encodes information an IPC or network socket or a file system FIFO controlled and supervised by systemd, for socket-based activation, to list sockets that are configured and enabled, run the command; systemctl list-unit-files --type=socket List Units – By Type Slice Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.slice” encodes information about a slice which is a concept for hierarchically managing resources of a group of processes. This management is performed by creating a node in the Linux Control Group (cgroup) tree, , run the command; systemctl list-unit-files --type=slice
  • 13. Systemd Usage Guide on RHEL 7 11 | P a g e List Units – By Type Swap Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.swap” encodes swap device or file for memory paging controlled and supervised by systemd, run the command; systemctl list-unit-files --type=swap List Units – By Type Snapshot Snapshot units are not configured via unit configuration files. Nonetheless they are named similar to filenames. A unit whose name ends in ".snapshot" refers to a dynamic snapshot of the systemd runtime state. Snapshots are not configured on disk but created dynamically via systemctl, run the command; systemctl list-unit-files --type=snapshot List Units – By Type Path systemctl list-unit-files --type=path Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.path” encodes information about path monitored by systemd, for path-based activation, run the command;
  • 14. Systemd Usage Guide on RHEL 7 12 | P a g e List Units – By Type Timer Unit files that allow systemd to manage units. In case of wherein unit name that ends with “.timer” encodes timer controlled and supervised by systemd, for timer-based activation. systemctl list-unit-files --type=timer So What’s systemctl / systemd unit Files The unit files on your system determine how systemd will start and run. Each corresponds to a single activity or component or unit in systemd terms.  The global systemd configuration is stored in the /etc/systemd directory.  The service configuration files are located in the /usr/lib/systemd/system directory.  Custom service configuration files are stored in the /etc/systemd/system directory. Each unit file is a simple text file describing a unit, what it does, what needs to run before or afterward, and other details. Unit files can be stored in a few different places on your system. systemd looks for system unit files in the following order; Path Purpose Mode /etc/systemd/system Local Configuration System /run/systemd/system Run-time Units System /usr/lib/systemd/system Units provided by installed packages System Depending on whether “--system” “--user” “--runtime” or “--global” is specified, this enables the unit for the system, for the calling user only, for only this boot of the system, or for all future logins of all users, or only this boot. Note: In the last case, systemd daemon configuration is reloaded. Similarly, systemd can also run in a user context and manage resources per user in addition to system- side. Unit files for user units are stored similarly in folders Path Purpose Mode /etc/systemd/user Local Configuration User /run/systemd/user Run-time Units User /usr/lib/systemd/user Units provided by installed packages User Note: The order of precedence works similarly way.
  • 15. Systemd Usage Guide on RHEL 7 13 | P a g e List Service – All Properties List all the properties of a unit. It will display a list of properties that are set for the specified unit. systemctl show rsyslogd --all List Service – Specific Property - CPUShares List a specific property of a service / unit, enter the attribute name. Run the command; systemctl show rsyslogd -p CPUShares Note: The default each service has a CPUShare = 1024. It can be configured to increase/decrease CPU share of a process.
  • 16. Systemd Usage Guide on RHEL 7 14 | P a g e List Service – Specific Property - CanReload List dependencies for a service / unit, if the service can automatically reload. Run the command; systemctl show rsyslogd -p CanReload List Service – Specific Property - Conflicts List dependencies for a service / unit, if the service can automatically reload. Run the command; In case sshd.service conflicts, it will invoke shutdown.target which will shutdown the unit / service. systemctl show sshd.service -p Conflicts Service Dependencies One other information that can be collate or reviewed is dependencies for each target(s) or each unit(s). Service dependencies allow you to conditionally include submodules and functionality, based on what the service / units library require. There are two types systemd dependencies that exists between units:  Dependencies that affect the activation of units, that are  Requires  Wants  Conflicts  Dependencies that affect the order of units, that are  After  Before
  • 17. Systemd Usage Guide on RHEL 7 15 | P a g e List Dependencies To list the services, current target dependencies run the command; systemctl list-dependencies
  • 18. Systemd Usage Guide on RHEL 7 16 | P a g e List Service Dependencies by Service To list the services dependencies run the command; systemctl list-dependencies sshd.service List Dependencies by Target To list the target dependencies run the command; systemctl list-dependencies graphical.target | grep target
  • 19. Systemd Usage Guide on RHEL 7 17 | P a g e List Service Dependencies – For Service Show the service / unit dependencies. To know the dependencies of rsyslog.service, run the command; systemctl list-dependencies rsyslog.service List Service Dependencies – Before List the units that are ordered after the specified unit. systemctl list-dependencies rsyslog.service --before
  • 20. Systemd Usage Guide on RHEL 7 18 | P a g e List Service Dependencies – After show the units that are ordered before the specified unit systemctl list-dependencies rsyslog.service --after List Service Dependencies – Reverse Show reverse dependencies between units, List units with dependencies of type Wants= or Requires= on the given unit. systemctl list-dependencies rsyslog.service --reverse
  • 21. Systemd Usage Guide on RHEL 7 19 | P a g e List Service Dependencies – Target List critical chain for network and local-fs targets. systemd-analyze critical-chain network.target local-fs.target List Service Dependencies – Plot Analyze systemd and plot into a file. systemd-analyze plot > systemd_analyze_plot.svg