SYSTEMD(1) systemd SYSTEMD(1) systemd init - systemd /usr/lib/systemd/systemd [...] init [...] systemd . ( PID 1) init . . systemd /sbin/init . user@.service(5). systemd system.conf system.conf.d systemd user.conf user.conf.d. systemd-system.conf(5) . systemd . (loopback). /sys/ /proc/ /dev/. systemd . " " . systemd [1]. D-Bus systemd org.freedesktop.systemd1(5) org.freedesktop.LogControl1(5). systemd initrd [2] initrd[3] . systemd "" 11 . . systemd.unit(5) . . . 1. +----------------------+-----------------------------+ | | | +----------------------+-----------------------------+ | | | | | | | | ... | | | | | | | | | . | +----------------------+-----------------------------+ |inactive | | | | | | | | | | ... | | | | | | | | | . | +----------------------+-----------------------------+ |failed | | | | inactive ( | | | ) | | | | | | | | | | | | ( | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ). | +----------------------+-----------------------------+ | | | | | inactive | | | active. | +----------------------+-----------------------------+ |deactivating | | | | active | | | inactive. | +----------------------+-----------------------------+ |maintenance | | | | | | | | | | | | | | | | . | +----------------------+-----------------------------+ |reloading | | | | | | | | | | | | | . | +----------------------+-----------------------------+ |refreshing | | | | | | | | | | | | | | | | | | | | | | | | | . | +----------------------+-----------------------------+ : 1. (Service units) (daemons) . systemd.service(5). 2. (Socket units) IPC . systemd.socket(5) daemon(7). 3. (Target units) systemd.target(5). 4. (Device units) systemd . systemd.device(5). 5. (Mount units) systemd.mount(5). 6. (Automount units) . systemd.automount(5). 7. (Timer units) . systemd.timer(5). 8. (Swap units) . systemd.swap(5). 9. (Path units) . systemd.path(5). 10. (Slice units) ( ) . systemd.slice(5). 11. (Scope units) . systemd.scope(5). . . systemd.special(7). systemd ( Requires= Conflicts=) (After= Before=). : . ( foo.service bar.service) ( foo.service bar.service) . . systemd. . ( ) . systemd '' (jobs) . . systemd default.target . ( ) graphical.target ( ) multi-user.target ( graphical.target). . systemd.special(7) . systemd . systemd.preset(5) " " machine-id(5). systemd . : 1. (active) (activating) (deactivating) (failed) ( "inactive") 2. 3. 4. ( ) 5. D-Bus systemd -- -- . . systemctl list-units --all . . . (journal) . systemd (control groups) systemd. ( 2[4] "cgroups"). systemd . ( /sys/fs/cgroup/) systemd-cgls(1) ps(1) ( ps xawf -eo pid,user,cgroup,args systemd .). systemd /etc/fstab utmp. systemd (transaction system) : . ( ). systemd . systemd . . . systemd . ( ). . . . systemd.generator(7). systemd . pkg-config systemd --variable=systemdsystemunitdir. /usr/local/lib/systemd/system /usr/lib/systemd/system. . pkg-config systemd --variable=systemdsystemconfdir . enable disable systemctl(1). systemd.unit(5). . XDG [5] . pkg-config systemd --variable=systemduserunitdir. pkg-config systemd --variable=systemduserconfdir. enable disable systemctl(1) / ( ) ( ). systemd.unit(5). . . . sd_notify() X_SYSTEMD_SIGNALS_LEVEL=2 . . SIGTERM systemd . systemctl daemon-reexec. systemd exit.target . systemctl --user start exit.target --job-mode=replace-irreversibly. SIGINT systemd ctrl-alt-del.target. systemctl start ctrl-alt-del.target --job-mode=replace-irreversibly. 7 . Ctrl+Alt+Del . Ctrl+Alt+Del 7 . systemd SIGTERM. SIGWINCH systemd kbrequest.target. systemctl start kbrequest.target. systemd . SIGPWR systemd sigpwr.target. systemctl start sigpwr.target. SIGUSR1 systemd D-Bus. SIGUSR2 systemd . systemd-analyze dump. SIGHUP . systemctl daemon-reload. SIGRTMIN+0 default.target. systemctl isolate default.target. SIGRTMIN+1 rescue.target. systemctl isolate rescue.target. SIGRTMIN+2 emergency.service. systemctl isolate emergency.service. SIGRTMIN+3 halt.target. systemctl start halt.target --job-mode=replace-irreversibly. SIGRTMIN+4 poweroff.target. systemctl start poweroff.target --job-mode=replace-irreversibly. SIGRTMIN+5 reboot.target. systemctl start reboot.target --job-mode=replace-irreversibly. SIGRTMIN+6 kexec kexec.target. systemctl start kexec.target --job-mode=replace-irreversibly. SIGRTMIN+7 soft-reboot.target. systemctl start soft-reboot.target --job-mode=replace-irreversibly. 254. SIGRTMIN+13 . SIGRTMIN+14 . SIGRTMIN+15 . SIGRTMIN+16 kexec. SIGRTMIN+17 . 254. SIGRTMIN+20 systemd.show_status=1 . SetShowStatus() SIGRTMIN+20 (race conditions). org.freedesktop.systemd1(5). SIGRTMIN+21 systemd.show_status=0 . SetShowStatus() SIGRTMIN+21 . org.freedesktop.systemd1(5). SIGRTMIN+22 "debug" () systemd.log_level=debug . SIGRTMIN+23 . - - systemd.log-level= LogLevel= "info". 239. SIGRTMIN+24 ( --user). 195. SIGRTMIN+25 systemd . systemctl daemon-reexec . systemd SIGTERM. 250. SIGRTMIN+26 . - - systemd.log-target= LogTarget= . 239. SIGRTMIN+27 SIGRTMIN+28 "console" () SIGRTMIN+27 ( "kmsg" SIGRTMIN+28) systemd.log_target=console ( systemd.log_target=kmsg SIGRTMIN+28) . 239. . ( "key=value" PID 1). " " systemd.exec(5). DefaultEnvironment= user@.service. ( ) Environment= EnvironmentFile= user@.service ( systemd.exec(5)). ManagerEnvironment= systemd-system.conf(5) systemd-user.conf(5). systemd: $SYSTEMD_LOG_LEVEL ( ). . ( ) emerg alert crit err warning notice info debug 0 7. syslog(3) . console syslog kmsg journal (: SYSTEMD_LOG_LEVEL=debug,console:info debug info). . --log-level=. $SYSTEMD_LOG_COLOR . tty . --log-color=. $SYSTEMD_LOG_TIME . . --log-time=. 246. $SYSTEMD_LOG_LOCATION . . --log-location=. $SYSTEMD_LOG_TID . (TID). 247. $SYSTEMD_LOG_TARGET . : console ( ) console-prefixed ( "" syslog(3) kmsg ( ) journal ( ) journal-or-kmsg ( kmsg ) auto ( ) null ( ). --log-target=. $SYSTEMD_LOG_RATELIMIT_KMSG kmsg . . "true". systemd kmsg. 254. $XDG_CONFIG_HOME $XDG_CONFIG_DIRS $XDG_DATA_HOME $XDG_DATA_DIRS systemd XDG [5] . $SYSTEMD_UNIT_PATH $SYSTEMD_GENERATOR_PATH $SYSTEMD_ENVIRONMENT_GENERATOR_PATH systemd . (":"). ("...:") . . $SYSTEMD_PAGER $PAGER --no-pager. $SYSTEMD_PAGER $PAGER. $SYSTEMD_PAGER $PAGER less(1) more(1) . . "cat" --no-pager. : $SYSTEMD_PAGERSECURE $SYSTEMD_PAGER $PAGER ( "cat" "") . $SYSTEMD_LESS less ( "FRSXMK"). : K Ctrl+C. less Ctrl+C . $SYSTEMD_LESS "K" less Ctrl+C . X termcap . . . $LESS less systemd. less(1) . $SYSTEMD_LESSCHARSET less ( "utf-8" UTF-8). $LESSCHARSET less systemd. $SYSTEMD_PAGERSECURE (pager) less(1) "" . sudo(8) pkexec(1) . . " " ( ). " " --no-pager PAGER=cat . . (true) " " . " " LESSSECURE=1 . less(1) " ". false (pager). SYSTEMD_PAGERSECURE=0 . $SYSTEMD_PAGERSECURE systemd " " . " " geteuid(2) sd_pid_get_owner_uid(3) sudo(8) ($SUDO_UID [6]). SYSTEMD_PAGERSECURE=1 " " . . $SYSTEMD_PAGERSECURE . $SYSTEMD_PAGER $PAGER $SYSTEMD_PAGERSECURE . $SYSTEMD_COLORS (boolean) . ( ) systemd . $COLORTERM "truecolor" "24bit" 24 256 $NO_COLOR $TERM . true $NO_COLOR. false . "16" "256" "24bit" ANSI 16 256 24 . "auto-16" "auto-256" "auto-24bit" $TERM . $SYSTEMD_URLIFY . . systemd $TERM . $LISTEN_PID $LISTEN_PIDFDID $LISTEN_FDS $LISTEN_FDNAMES systemd (socket-based activation). sd_listen_fds(3) . $NOTIFY_SOCKET . . sd_notify(3) . systemd [7]. systemd . systemd. systemd <<>> . /proc/cmdline . : systemd.unit= rd.systemd.unit= . default.target. rescue.target emergency.service. systemd.special(7) . "rd." (initrd) . systemd.dump_core . systemd ( PID 1) (dump core) . . . 233. systemd.crash_chvt . . ( 1-63) (PID 1) . . . 233. systemd.crash_shell . (PID 1) (shell) . . . 233. systemd.crash_action= "freeze" "reboot" "poweroff". "freeze". "freeze" (PID 1). "reboot" (PID 1) 10 . "poweroff" (PID 1) . systemd.crash_shell . 256. systemd.confirm_spawn . . (PID 1) /dev/console. ( "ttyS0") . . 233. systemd.service_watchdogs= . (watchdogs) (WatchdogSec=) ( OnFailure= StartLimitAction=) (PID 1) systemd.service(5). . . 237. systemd.show_status error auto. . systemd (PID 1) . error . auto false . quiet error. ShowStatus= systemd-system.conf(5). 233. systemd.status_unit_format= name description combined. name . combined . StatusUnitFormat= systemd-system.conf(5). 243. systemd.log_color systemd.log_level= systemd.log_location systemd.log_target= systemd.log_time systemd.log_tid systemd.log_ratelimit_kmsg $SYSTEMD_LOG_COLOR $SYSTEMD_LOG_LEVEL $SYSTEMD_LOG_LOCATION $SYSTEMD_LOG_TARGET $SYSTEMD_LOG_TIME $SYSTEMD_LOG_TID $SYSTEMD_LOG_RATELIMIT_KMSG . systemd.log_color systemd.log_location systemd.log_time systemd.log_tid systemd.log_ratelimit_kmsg . systemd.default_standard_output= systemd.default_standard_error= . StandardOutput= StandardError= ( systemd.exec(5) ). inherit null tty journal journal+console kmsg kmsg+console. systemd.default-standard-output= journal systemd.default-standard-error= inherit. systemd.setenv= VARIABLE=VALUE. . . systemd.machine_id= 32 (machine-id). . 229. systemd.set_credential= systemd.set_credential_binary= ImportCredential= LoadCredential= systemd.exec(5) . . systemd.set_credential= systemd.set_credential_binary= Base64. /proc/cmdline. . ( / ) /. [8]. 251. systemd.import_credentials= . (false) DMI/SMBIOS OEM qemu_fw_cfg EFI. 251. quiet systemd.show_status=no. . . 186. debug . systemd.log_level=debug. . . 205. emergency rd.emergency -b . systemd.unit=emergency.target rd.systemd.unit=emergency.target . 186. rescue rd.rescue single s S 1 . systemd.unit=rescue.target rd.systemd.unit=rescue.target . 186. 2 3 4 5 SysV . 2 3 4 systemd.unit=multi-user.target 5 systemd.unit=graphical.target . 186. locale.LANG= locale.LANGUAGE= locale.LC_CTYPE= locale.LC_NUMERIC= locale.LC_TIME= locale.LC_COLLATE= locale.LC_MONETARY= locale.LC_MESSAGES= locale.LC_PAPER= locale.LC_NAME= locale.LC_ADDRESS= locale.LC_TELEPHONE= locale.LC_MEASUREMENT= locale.LC_IDENTIFICATION= (locale) . /etc/locale.conf. locale.conf(5) locale(7). 186. kernel-command-line(7). : o SMBIOS Type 11 io.systemd.credential:= io.systemd.credential.binary:=. o QEMU "fw_cfg". ( SMBIOS .) o systemd.set-credential= . o UEFI systemd-stub(7). o initrd /run/credentials/@initrd/ . systemd-creds(1) : # systemd-creds --system list [8]. PID 1 : vmm.notify_socket AF_VSOCK AF_UNIX READY=1 . sd_notify(3) . (hypervisor) SOCK_DGRAM AF_VSOCK SOCK_SEQPACKET . AF_VSOCK "vsock:CID:PORT". "vsock-stream" "vsock-dgram" "vsock-seqpacket" "vsock" . VSOCK . 254. system.machine_id 128 /etc/machine-id . machine-id(5) . 254. systemd systemd.system-credentials(7). ( ) ( ). ( ) sd_notify(3). ( PID 1) $NOTIFY_SOCKET ( ). : vmm.notify_socket ( ) ( AF_VSOCK) SMBIOS Type 11. . . : o X_SYSTEMD_HOSTNAME=... . () . 256. o X_SYSTEMD_MACHINE_ID=... . machine-id(5) . 256. o X_SYSTEMD_SIGNALS_LEVEL=... UNIX . UNIX . : o X_SYSTEMD_SIGNALS_LEVEL=2 UNIX -- SysV . PID 1 . . 2 . 256. o X_SYSTEMD_UNIT_ACTIVE=... X_SYSTEMD_UNIT_INACTIVE=... . . ssh-access.target SSH systemd.special(7) . 256. o X_SYSTEMD_SHUTDOWN=... . "reboot" "halt" "poweroff" "kexec" . 256. o X_SYSTEMD_REBOOT_PARAMETER=... . systemctl --reboot-argument=.... 256. "READY=1" "RELOADING=1" . systemd . systemctl(1) . systemd . systemd : --dump-configuration-items . . --dump-bus-properties . D-Bus. 239. --test ( ) -- . . . --system ( ) --user . --system --user --test . --test ( --test) PID 1 . --system PID 1. -h --help . --version . << >>. . . systemd . systemd user@.service(5) . ( systemd-user.conf(5)) . <<>> . --unit= . default.target. systemd.unit= . --dump-core (core dumping) . . systemd.dump_core= . --crash-vt=VT (VT) . . systemd.crash_chvt= ( !). 227. --crash-shell . . systemd.crash_shell= . --crash-action= (PID 1). systemd . systemd.crash_action= . 256. --confirm-spawn . . systemd.confirm_spawn . --show-status . systemd.show_status . 244. --log-color . systemd.log_color . 244. --log-level= . systemd.log_level . --log-location . systemd.log_location . 244. --log-target= . systemd.log_target . --log-time= . systemd.log_time . 246. --machine-id= (machine-id) . systemd.machine_id= . 229. --service-watchdogs / (watchdog) . systemd.service_watchdogs . 237. --default-standard-output=, --default-standard-error= . systemd.default_standard_output= systemd.default_standard_error= . systemd "" (epoch). (monotonic) (RTC) . . . ( 15 ) . : systemd ("mtime") /usr/lib/clock-epoch /var/lib/systemd/timesync/clock. /run/systemd/notify . AF_UNIX sd_notify(3). /run/systemd/private systemctl(1) systemd. AF_UNIX. systemd . /usr/lib/clock-epoch ("mtime") . 247. /var/lib/systemd/timesync/clock ("mtime") systemd-timesyncd.service(8). . 257. systemd 252 systemd.unified_cgroup_hierarchy systemd.legacy_systemd_cgroup_controller . cgroup. systemd[9] systemd-system.conf(5) locale.conf(5) systemctl(1) journalctl(1) systemd-notify(1) daemon(7) sd-daemon(3) org.freedesktop.systemd1(5) systemd.unit(5) systemd.special(7) pkg-config(1) kernel-command-line(7) bootup(7) systemd.directives(7) org.freedesktop.systemd1(5) systemd [10]. 1. https://systemd.io/PORTABILITY_AND_STABILITY/ 2. https://systemd.io/CONTAINER_INTERFACE 3. initrd https://systemd.io/INITRD_INTERFACE/ 4. 2 https://docs.kernel.org/admin-guide/cgroup-v2.html 5. XDG https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html 6. $SUDO_UID . 7. https://systemd.io/ENVIRONMENT 8. https://systemd.io/CREDENTIALS 9. systemd https://systemd.io/ 10. https://0pointer.de/blog/projects/systemd.html 3 . . : . systemd 260.1 SYSTEMD(1)