「systemd」

What is this?

systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points, and implements an elaborate transactional dependency-based service control logic. systemd supports SysV and LSB init scripts and works as a replacement for sysvinit. Other parts include a logging daemon, utilities to control basic system configuration like the hostname, date, locale, maintain a list of logged-in users and running containers and virtual machines, system accounts, runtime directories and settings, and daemons to manage simple network configuration, network time synchronization, log forwarding, and name resolution. See Lennart’s blog story for a longer introduction, and the three status updates since then. Also see the Wikipedia article. If you are wondering whether systemd is for you, please have a look at this comparison of init systems by one of the creators of systemd.

Spelling

Yes, it is written systemd, not system D or System D, or even SystemD. And it isn’t system d either. Why? Because it’s a system daemon, and under Unix/Linux those are in lower case, and get suffixed with a lower case d. And since systemd manages the system, it’s called systemd. It’s that simple. But then again, if all that appears too simple to you, call it (but never spell it!) System Five Hundred since D is the roman numeral for 500 (this also clarifies the relation to System V, right?). The only situation where we find it OK to use an uppercase letter in the name (but don’t like it either) is if you start a sentence with systemd. On high holidays you may also spell it sÿstëmd. But then again, Système D is not an acceptable spelling and something completely different (though kinda fitting).

安装systemd的方法

使用源码安装

参考LFS/Systemd-231: http://www.linuxfromscratch.org/lfs/view/7.10-systemd/chapter06/systemd.html

从发行版的源中安装

较新的发行版中已经预装了systemd,不需要手动安装。

#!/bin/bash

# Kali GNU/Linux Rolling
apt-get install systemd

安装的可执行程序

bootctl
used to query the firmware and boot manager settings

busctl
Used to introspect and monitor the D-Bus bus

coredumpctl
Used to retrieve coredumps from the systemd Journal

halt
Normally invokes shutdown with the -h option, except when already in run-level 0, then it tells the kernel to halt the system; it notes in the file /var/log/wtmp that the system is being brought down

hostnamectl
Used to query and change the system hostname and related settings

init
The first process to be started when the kernel has initialized the hardware which takes over the boot process and starts all the proceses it is instructed to

journalctl
Used to query the contents of the systemd Journal

kernel-install
Used to add and remove kernel and initramfs images to and from /boot

localectl
Used to query and change the system locale and keyboard layout settings

loginctl
Used to introspect and control the state of the systemd Login Manager

machinectl
Used to introspect and control the state of the systemd Virtual Machine and Container Registration Manager

networkctl
Used to introspect the state of the network links as seen by systemd-networkd

poweroff
Tells the kernel to halt the system and switch off the computer (see halt)

reboot
Tells the kernel to reboot the system (see halt)

runlevel
Reports the previous and the current run-level, as noted in the last run-level record in /var/run/utmp

shutdown
Brings the system down in a secure way, signaling all processes and notifying all logged-in users

systemctl
用于对「systemd系统」和「服务管理器的状态」进行自身检查和控制。

systemd-analyze
Used to determine system boot-up performance of the current boot

systemd-ask-password
Used to query a system password or passphrase from the user, using a question message specified on the command line

systemd-cat
Used to connect STDOUT and STDERR of a process with the Journal

systemd-cgls
Recursively shows the contents of the selected Linux control group hierarchy in a tree

systemd-cgtop
Shows the top control groups of the local Linux control group hierarchy, ordered by their CPU, memory and disk I/O load

systemd-delta
Used to identify and compare configuration files in /etc that override default counterparts in /usr

systemd-detect-virt
Detects execution in a virtualized environment

systemd-escape
Used to escape strings for inclusion in systemd unit names

systemd-hwdb
Used to manage hardware database (hwdb)

systemd-inhibit
Used to execute a program with a shutdown, sleep or idle inhibitor lock taken

systemd-machine-id-setup
Used by system installer tools to initialize the machine ID stored in /etc/machine-id at install time with a randomly generated ID

systemd-notify
Used by daemon scripts to notify the init system about status changes

systemd-nspawn
Used to run a command or OS in a light-weight namespace container

systemd-path
Used to query system and user paths

systemd-resolve
Used to resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services

systemd-run
Used to create and start a transient .service or a .scope unit and run the specified command in it

systemd-tmpfiles
Creates, deletes and cleans up volatile and temporary files and directories, based on the configuration file format and location specified in tmpfiles.d directories

systemd-tty-ask-password-agent
Used to list or process pending systemd password requests

telinit
Tells init which run-level to change to

timedatectl
Used to query and change the system clock and its settings

udevadm
Generic Udev administration tool: controls the udevd daemon, provides info from the Udev database, monitors uevents, waits for uevents to finish, tests Udev configuration, and triggers uevents for a given device

systemd
systemd系统和服务的管理器。

参考文献