Systemd. The giant monster that ate Linux

Similar documents
systemd our next-generation init system PABLO N. HESS Instructor Red Hat São Paulo December 2011

systemd: Converting sysvinit scripts

systemd unit le basics

An Introduction to systemd. Erik Johnson

Beyond Init: systemd

systemd: What to Know and How to Transition

systemd, the modern Linux service and resource manager

CompTIA Linux+/LPIC-1 COPYRIGHTED MATERIAL

init rides the rocket: systemd is here Olaf Kirch

GL-280: Red Hat Linux 7 Update. Course Description. Course Outline

QueueMetrics Installation under Systemd (Debian/Ubuntu)

CompTIA Exam LX0-103 CompTIA Linux+ [Powered by LPI] Exam 1 Version: 6.0 [ Total Questions: 120 ]

RED HAT ENTERPRISE LINUX 7 BETA

LPI Exam LPI Level 1 Exam 101, Junior Level Linux Certification, Part 1 of 2 Version: 6.0 [ Total Questions: 120 ]

Authored by: Brian E. Brzezicki Copyright 2013, Paladin Group LLC Reuse without permission is strictly prohibited

systemd, the next-generation Linux system manager

More on file systems, Booting Todd Kelley CST8177 Todd Kelley 1

LX0-103 Exam Questions Demo CompTIA. Exam Questions LX CompTIA Linux+ [Powered by LPI] 1

RHCE BOOT CAMP. The Boot Process. Wednesday, November 28, 12

LPIC-1 Exam 101, Part 1 of 2, version 4.0

Tizen Bootup. Xiaoli Gong Nankai University, China

1 LINUX KERNEL & DEVICES

More on file systems, Booting Todd Kelley CST8177 Todd Kelley 1

exam.30q. Number: Passing Score: 800 Time Limit: 120 min File Version: 1 LPI

Course 55187B Linux System Administration

Why did you do this to me?!

Enterprise Linux System Administration

TestOut Linux Pro - English 4.0.x OBJECTIVE MAPPING: CompTIA Linux+ LX0-103

At course completion. Overview. Audience profile. Course Outline. : 55187B: Linux System Administration. Course Outline :: 55187B::

"Charting the Course... MOC B: Linux System Administration. Course Summary

For personnal use only

LPIC-1 System Administrator

CSE 265: System and Network Administration

CSE 265: System and Network Administration

OVERDRIVE Quick Start Guide. v.1.0

Booting up and Shutting down A primer for troubleshooting

Exam LFCS/Course 55187B Linux System Administration

Systemd Easy as 1, 2, 3. Ben Breard, RHCA Solutions Architect, Red Hat

Systemd. Simone Caronni. University of Zurich 29 th September 2015

"Charting the Course... Enterprise Linux System Administration. Course Summary

Oracle Linux 7: System Administration Ed 1

Oracle Linux 7: System Administration Ed 2 Duration: 5 Days

LX0-103.exam.68q. Number: LX0-103 Passing Score: 800 Time Limit: 120 min LX CompTIA Linux+ [Powered by LPI] Exam 1

Prerequisites: Students must be proficient in general computing skills but not necessarily experienced with Linux or Unix. Supported Distributions:

The Linux IPL Procedure

Insight Control Server Provisioning Capturing and Installing SUSE Enterprise Linux 12 System Images

Oracle Linux 7: System Administration Ed 2 NE

HP-UX System Administration

Oracle Linux System AdministrationNEW

Oracle Linux 5 & 6 System Administration TOD

Oracle Linux 5 & 6 System Administration

"Charting the Course... Enterprise Linux System Administration Course Summary

Demystifying systemd OHIO LINUX FEST Scott Seighman Solutions Architect Red Hat. CleRHUG

Linux+ Guide to Linux Certification, Third Edition. Chapter 2 Linux Installation and Usage

Oracle Linux 7: System Administration Ed 1

Oracle - Oracle Linux 5 6 System Administration Ed 3

CST8177 Linux II. Linux Boot Process

Disks, Filesystems, Booting Todd Kelley CST8177 Todd Kelley 1

Oracle Linux 7: System Administration Ed 1 LVC

LPI201 LPIC-2 Exam Prep (Course 1) (LPI201) HL965S

Linux. An introduction. Aurélien Villani 01/2018

Certification. System Initialization and Services

Booting Up and Shutting Down. lctseng / Liang-Chi Tseng

client X11 Linux workstation

Chapter 2 Booting Up and Shutting Down

Prerequisites: General computing knowledge and experience. No prior knowledge with Linux is required. Supported Distributions:

Disks, Filesystems 1

Community Enterprise Operating System (CentOS 7) Courses

runit and ignite: a suckless init system? Christian Neukirchen slcon jun2013

Demystifying systemd. 2017: RHEL 7.3 Edition. Ben Breard, RHCA Sr Product Manager - Linux Containers. Lennart Poettering Sr Principal Engineer

System Administration. Startup Process

Configure router. 26. Start AirPort Utility (located in the Utilities folder). The AirPort Utility window show a component diagram:

This is Lab Worksheet 13 - not an Assignment. Boot Process and GRUB

Disks, Filesystems Todd Kelley CST8177 Todd Kelley 1

Singularity CRI User Documentation

DYNAMIC DEVICE MANAGEMENT FOR LXC. Michael J Coss Oct 15, 2014

Advanced Unix System Administration

LINUX OS FUNDAMENTALS FOR THE SQL ADMIN

Control Center Planning Guide

LPI Linux LPIC1. Module 1

Insight Control Server Provisioning Capturing and Installing Red Hat Enterprise Linux 7 System Images

Installation of the OS

"Charting the Course... RHCE Rapid Track Course. Course Summary

. Fill in the Blank: A directory named mydir has just been... Points:10. Add Question Success: 64 questions added as a copy.

Unix Introduction to UNIX

New RHEL 7.5 features: VDO, USBGuard, NBDE and AIDE. RHUG Q Marc Skinner Principal Solutions Architect 3/21/2018

Control Center Planning Guide

H7091S. Prerequisites

Linux Kung Fu. Stephen James UBNetDef, Spring 2017

How to Use This Lab Manual

Disk-Level Encryption

Basic UNIX system administration

Red Hat Enterprise Linux Atomic Host 7 Getting Started with Cockpit

HP-UX System Administration Course Overview. Skills Gained. Who will the Course Benefit?

Install the Marionnet network simulator on Kali Linux Light vbox-i686

The kernel constitutes the core part of the Linux operating system. Kernel duties:

Saddle up, Penguins! The ICS Admin RHEL7 Primer is Here. William Malchisky Jr. Effective Software Solutions, LLC

Ubuntu Manual Fsck Must Performed Debian

OPS235. Linux File Systems Partitioning Mounting File Systems

Linux OS Fundamentals for the SQL Admin. Anthony E. Nocentino

Transcription:

Systemd The giant monster that ate Linux

SysV Init is comfy Dates back to AT&T System III from 1982 Modified up until AT&T Sys V in 1983

systemd is Easy

Systemd Managing The System

System Service Management Unified System Management Tab completion for commands Aggressive parallelization Transactional activation logic Power management Backward compatibility

Unified System Management Multiple non-integrated tools System management by committee Can hinder forward progress X11? -> Wayland & Mir

Unified System Management (cont.) One system to start them all, One system to stop them, One system to log them all and with ease manage them.

Tab Completion Makes life easier First tab adds a space Subsequent tabs work like BASH tab completion

Tab Completion Example [jaybrown@localhost ~]$ systemd-<tab><tab><tab> systemd-analyze systemd-machine-id-setup systemd-ask-password systemd-notify systemd-cat systemd-nspawn systemd-cgls systemd-path systemd-cgtop systemd-run systemd-delta systemd-stdio-bridge systemd-detect-virt systemd-sysusers systemd-escape systemd-tmpfiles systemd-firstboot systemd-tty-ask-password-agent systemd-inhibit

Can Be Overwhelming [jaybrown@localhost ~]$ sysctl<tab><tab><tab> Display all 745 possibilities? (y or n)

Power Management systemctl reboot systemctl poweroff systemctl suspend systemctl hibernate systemctl hybrid-sleep

Aggressive parallelization SysV init: inherently serial Upstart: parallelization using a dependency graph Systemd: socket activation can make all service startup parallel

Transactional activation Before activating or deactivating a unit, systemd calculates its dependencies, creates a temporary transaction, and verifies that this transaction is consistent. If a transaction is inconsistent, systemd automatically attempts to correct it and remove non-essential jobs from it before reporting an error. systemd performs dependency checking and attempts to handle dependencies before reporting an error

Backward compatibility systemd processes the scripts in /etc/init.d legacy commands telinit, init, halt, shutdown, reboot, runlevel

Unit Files Defining Services

Types of Unit Files systemctl -t help service socket target device mount automount snapshot timer swap path slice scope

Locations - System Mode /usr/lib/systemd/system/ - Installed Packages /etc/systemd/system/ - System Administrator

Locations - User Mode /usr/lib/systemd/user/ - Provided by installed packages /etc/systemd/user/ - System-wide user services ~/.config/systemd/user/ - User specific services

Writing http://www.freedesktop. org/software/systemd/man/systemd.unit.html systemd.service(5), systemd.socket(5), systemd.device(5), systemd.mount(5), systemd.automount(5), systemd.swap(5), systemd.target(5), systemd.path(5), systemd.timer(5), systemd.snapshot(5). systemd.slice(5). systemd.scope(5)

Example Service Unit File [Unit] Description=OpenSSH server daemon After=syslog.target network.target auditd.service [root@ursus jaybrown]# cat /etc/init.d/sshd wc -l 236 [Service] EnvironmentFile=/etc/sysconfig/sshd ExecStartPre=/usr/sbin/sshd-keygen ExecStart=/usr/sbin/sshd -D $OPTIONS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target

Socket Units listens on a IP port or UNIX socket queues request until the service is available

Example.socket file [Unit] Description=OpenSSH Server Socket Conflicts=sshd.service [Socket] ListenStream=22 Accept=yes [Install] WantedBy=sockets.target

Service Units listens for D-Bus communication and activate services uses D-Bus service files for bus-based activation

Example D-Bus.service file [Unit] Description=Bluetooth service [Service] Type=dbus BusName=org.bluez ExecStart=/usr/sbin/bluetoothd -n [Install] WantedBy=bluetooth.target Alias=dbus-org.bluez.service

Device Units enables services based on device connection or activation named after the device paths they control dev-sda5.device = /dev/sda5 configured directly from the udev database

Example.device file [jaybrown@localhost Documents]$ systemctl status dev-sda1.device dev-sda1.device - KINGSTON_SNS4151S316G 1 Follow: unit currently follows state of sys-devices-pci0000:00-0000:00:1f.2-ata1-host0- target0:0:0-0:0:0:0-block-sda-sda1.device Loaded: loaded Active: active (plugged) since Sat 2014-12-27 06:16:37 CST; 1h 14min ago Device: /sys/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1

Path Units encodes information about a path monitored by systemd takes action on filesystem activity in path

Example.path file [Unit] Description=Forward Password Requests to Wall Directory Watch Documentation=man:systemd-ask-password-console.service(8) DefaultDependencies=no Conflicts=shutdown.target Before=paths.target shutdown.target [Path] DirectoryNotEmpty=/run/systemd/ask-password MakeDirectory=yes

Mount and automount point management reads /etc/fstab and dynamically generates native units /etc/fstab is preferred over static mount units must be named for its mountpoint /home/user file is home-user.mount

Example.automount file [Unit] Description=Arbitrary Executable File Formats File System Automount Point Documentation=https://www.kernel. org/doc/documentation/binfmt_misc.txt Documentation=http://www.freedesktop. org/wiki/software/systemd/apifilesystems DefaultDependencies=no Before=sysinit.target ConditionPathExists=/proc/sys/fs/binfmt_misc/ ConditionPathIsReadWrite=/proc/sys/ [Automount] Where=/proc/sys/fs/binfmt_misc

Example.mount file [Unit] Description=Debug File System Documentation=https://www.kernel. org/doc/documentation/filesystems/debugfs.txt Documentation=http://www.freedesktop. org/wiki/software/systemd/apifilesystems DefaultDependencies=no ConditionPathExists=/sys/kernel/debug Before=sysinit.target [Mount] What=debugfs Where=/sys/kernel/debug Type=debugfs

Managing Units New Commands

Listing Units In Specific State or States [jaybrown@localhost ~]$ systemctl list-unit-files --state=failed UNIT FILE STATE 0 unit files listed. [jaybrown@localhost ~]$ systemctl list-unit-files --state=disabled,enabled UNIT FILE cups.path abrt-ccpp.service abrt-oops.service abrt-pstoreoops.service STATE enabled enabled enabled disabled

Listing Only Enabled Socket Units [jaybrown@localhost ~]$ systemctl list-unit-files -t socket --state=enabled UNIT FILE STATE avahi-daemon.socket enabled cups.socket dm-event.socket iscsid.socket iscsiuio.socket enabled enabled enabled enabled lvm2-lvmetad.socket enabled rpcbind.socket enabled

Disabling a Unit [jaybrown@localhost ~]$ systemctl disable cups Removed symlink /etc/systemd/system/printer.target.wants/cups.service. Removed symlink /etc/systemd/system/multi-user.target.wants/cups.path. Removed symlink /etc/systemd/system/sockets.target.wants/cups.socket.

Enabling a Unit [jaybrown@localhost ~]$ systemctl enable cups Created symlink from /etc/systemd/system/printer.target.wants/cups.service to /usr/lib/systemd/system/cups.service. Created symlink from /etc/systemd/system/sockets.target.wants/cups.socket to /usr/lib/systemd/system/cups.socket. Created symlink from /etc/systemd/system/multi-user.target.wants/cups.path to /usr/lib/systemd/system/cups.path.

systemd Journal journalctl provides the ability to work with the systemd journal as written by systemd-journal.service Without any parameters it displays the full contents of the journal journalctl --since "20 min ago" Can use / to search within results

System state snapshots Save the state of the system configuration in a snapshot systemctl <snapshot name> creates a snapshot of the current state under the name <snapshot name> systemctl isolate <snapshot name>.service restores the system state to the state saved in the snapshot <snapshot name> systemctl delete <snapshot name> deletes a previously saved snapshot man 5 systemd.snapshot & man systemctl

Reference Where to get more detailed information

Commands Full man page index at http://0pointer.de/public/systemd-man/ /usr/bin/busctl /usr/bin/coredumpctl /usr/sbin/halt /usr/bin/hostname /usr/bin/hostnamectl /usr/sbin/init /usr/bin/journalctl /usr/bin/localectl /usr/bin/loginctl /usr/bin/machinectl /usr/sbin/reboot /usr/sbin/runlevel /usr/sbin/shutdown /usr/sbin/sysctl /usr/bin/systemctl /usr/sbin/telinit /usr/bin/timedatectl /usr/bin/udevadm

Good Pages https://wiki.archlinux.org/index.php/systemd http://freedesktop.org/wiki/software/systemd/ Beyond init: systemd RedHat 7 Documentation systemd man pages