Download presentation
Presentation is loading. Please wait.
1
System startup process systemd
The ABC of Linux System startup process systemd
2
The ABC of Linux - by Peter Larsen
Agenda Overview Sysvinit recap Systemd goals Commands and cool stuff August 2012 The ABC of Linux - by Peter Larsen
3
The ABC of Linux - by Peter Larsen
Overview System startup happens after kernel has loaded Kernel will run /init or /sbin/init if found Every system must have a PID 1 – the parent of all processes Init is responsible for getting the system running August 2012 The ABC of Linux - by Peter Larsen
4
The ABC of Linux - by Peter Larsen
SysVInit recap /etc/inittab - runlevels /etc/rc.d/ Init, rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d /etc/sysconfig # service command # chkconfig command August 2012 The ABC of Linux - by Peter Larsen
5
So what's wrong with SysVInit?
Well nothing except: Serial startup Script based Sequence/dependency hell It's old – 25 years! While supposedly a standard, different distributions implements it differently August 2012 The ABC of Linux - by Peter Larsen
6
But I know trust SysVInit!
Yes, systemd is new Learning new stuff is hard Backwards compatibility with old commands It's worth it – going from 60 seconds to sub 1 second startup times! August 2012 The ABC of Linux - by Peter Larsen
7
The ABC of Linux - by Peter Larsen
Systemd goals Parallel startup No Scripts! Better control More options Re-designed from ground up August 2012 The ABC of Linux - by Peter Larsen
8
The ABC of Linux - by Peter Larsen
Systemd features #1 aggressive parallelization capabilities using socket D-Bus activation for starting services on-demand starting of daemons keeps track of processes using Linux cgroups supports snapshotting and restoring of the system state August 2012 The ABC of Linux - by Peter Larsen
9
The ABC of Linux - by Peter Larsen
Systemd features #2 maintains mount and automount points implements an elaborate transactional dependency-based service control logic Full control of spawn processes The native configuration files use a syntax that closely follows the well-known .desktop files August 2012 The ABC of Linux - by Peter Larsen
10
The ABC of Linux - by Peter Larsen
Systemd features #3 Compatibility with SysV init scripts Support a simple templating/instance mechanism August 2012 The ABC of Linux - by Peter Larsen
11
The ABC of Linux - by Peter Larsen
Systemd units Service (can be started, stopped, restarted, reloaded) Socket: this unit encapsulates a socket in the file-system or on the Internet. Device: this unit encapsulates a device in the Linux device tree. Mount: this unit encapsulates a mount point in the file system hierarchy. service: these are the most obvious kind of unit: daemons that can be started, stopped, restarted, reloaded. socket: this unit encapsulates a socket in the file-system or on the Internet. systemd currently support AF_INET, AF_INET6, AF_UNIX sockets of the types stream, datagram, and sequential packet. It can also support classic FIFOs as transport. Each socket unit has a matching service unit, that is started if the first connection comes in on the socket or FIFO (e.g. nscd.socket starts nscd.service on an incoming connection). device: this unit encapsulates a device in the Linux device tree. If a device is marked for this via udev rules, it will be exposed as a device unit in systemd. Properties set with udev can be used as configuration source to set dependencies for device units. mount: this unit encapsulates a mount point in the file system hierarchy. August 2012 The ABC of Linux - by Peter Larsen
12
Systemd units - continued
Automount: this unit type encapsulates an automount point in the file system hierarchy. Target: this unit type is used for logical grouping of units. Snapshot: similar to target automount: this unit type encapsulates an automount point in the file system hierarchy. Each automount unit has a matching mount unit, which is started (i.e. mounted) as soon as the automount directory is accessed. target: this unit type is used for logical grouping of units: instead of actually doing anything by itself it simply references other units, which thereby can be controlled together. (e.g. multi-user.target, which is a target that basically plays the role of run-level 5 on classic SysV system; or bluetooth.target which is requested as soon as a bluetooth dongle becomes available and which simply pulls in bluetooth related services that otherwise would not need to be started: bluetoothd and obexd and suchlike). snapshot: similar to target units snapshots do not actually do anything themselves and their only purpose is to reference other units. August 2012 The ABC of Linux - by Peter Larsen
13
Commands and Cool Stuff
# systemctl # systemadm # August 2012 The ABC of Linux - by Peter Larsen
14
The ABC of Linux - by Peter Larsen
Switching runlevel # systemctl isolate multi-user.target # systemctl isolate graphical.target (or use runlevel3.target and runlevel5.target respectfully) ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target August 2012 The ABC of Linux - by Peter Larsen
15
The ABC of Linux - by Peter Larsen
Boot parameters systemd.unit – overwriting default boot mode systemd.unit=rescue.target systemd.unit=emergency.target systemd.unit=multi-user.target systemd.unit=graphical.target August 2012 The ABC of Linux - by Peter Larsen
16
The ABC of Linux - by Peter Larsen
Thank you – Questions? Documentation: docs.html August 2012 The ABC of Linux - by Peter Larsen
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.