The New Process No. 1 of Linux -- SystemD

56 %
44 %
Information about The New Process No. 1 of Linux -- SystemD
Technology

Published on March 14, 2014

Author: freedman6022e20

Source: slideshare.net

Description

Showing what systemD is. These slides had been wrote in traditional chinese.

全新的 Linux 一號行程-- systemd by Freedman 2014-03-04 Q__ f"_< ○ ○▽ ............. 自由車上自由人

常見的一號行程 ● init: debian, archlinux ~2012-10-12, BSD... ● upstart: Ubuntu 6.10~, Fedora 9~14 ● systemd: Fedora 15~, archlinux 2012-10-13~, Mageia 2, Mandriva 2011, openSUSE 12.1~

常見的系統開機過程 GRUB/LILO/... 載入系統 核心以 Initrd 設定系統 Init Systemd Init (upstart) SysV int | Systemd prefdm gdm kdm... mingetty... gnome PowerOn BootLoader Splash Kernel InitRAMFS Init Services (Runlevel) mate sugar xsession... kde startx

systemd 專案 ● 由 Lennart Poettering 與 Kay Sievers 開發 ● Linux 上的系統與服務管理程式 ● 可以相容、取代 init ● 主要效益:快速啟動、服務程式的線上抽換 ● 以 LGPL v2.1+ 發行 ● 已經在很多 Linux 發行版中被採用

運作概念 ● init: 設定檔是文件和 shell 腳本,以啟動各種行程為系 統的運作概念 – /etc/inittab /etc/init.d /etc/rc[0~6].d/ ● upstart: 基於事件,在事件發生時啟動各種程式,還能支援 變動的硬體環境 – /etc/init/ (/etc/event.d/) ● systemd: 基於 socket, 先將各種服務的 socket 建立,然後 各種程式可以同時啟動

systemd 架構圖 圖片取自維基百科 http://zh.wikipedia.org/wiki/File:Systemd_components.svg

systemd 的特色 ● 啟動速度較快 – 不使用 shell script – 各服務平行啟動(只在 SSD 上才會加快) ● 提供系統服務快照 ● 掛載及自動掛載管理 ● 以事務系統 (transaction) 處理相依服務 ● 服務的無感即時更新、重新啟動與暫時結束 ● 使用 Linux 核心 cgroup 功能進行管理

Target vs. Runlevel SysVinit systemd init 0 systemctl poweroff init 1 systemctl isolate rescue.target init 3 systemctl isolate multi-user.target init 5 systemctl isolate graphical.target init 6 systemctl reboot ● 以目標取代執行等級的概念 ● 相關檔案: – /lib/systemd/system/*.target – /etc/systemd/system/default.target

systemd 的設定檔 位置: /lib/systemd/ /lib/systemd/system/ /etc/systemd/ /etc/systemd/system/ 主要類型: XXX.target XXX.service XXX.socket 這些檔案由建構整個 發行版的工程師們撰 寫,一般的系統管理 員通常不需要自行修 改。

default.target → graphic.target [Unit] Description=Graphical Interface Documentation=man:systemd.special(7) Requires=multi-user.target After=multi-user.target Conflicts=rescue.target Wants=display-manager.service AllowIsolate=yes [Install] Alias=default.target

iscsid.service [Unit] Description=Open-iSCSI Documentation=man:iscsid(8) man:iscsiadm(8) DefaultDependencies=no Conflicts=shutdown.target After=network.target iscsiuio.service Before=remote-fs-pre.target [Service] Type=forking PIDFile=/var/run/iscsid.pid ExecStart=/usr/sbin/iscsid ExecStop=/sbin/iscsiadm -k 0 2 [Install] WantedBy=multi-user.target

iscsid.socket [Unit] Description=Open-iSCSI iscsid Socket Documentation=man:iscsid(8) man:iscsiadm(8) [Socket] ListenStream=@ISCSIADM_ABSTRACT_NAMESPA CE [Install] WantedBy=sockets.target

啟動的比較

其他相關命令與套件 ● 服務的管理 systemctl start/stop/restart foo.service 立刻啟動、重新啟動或停止服務 systemctl status foo.service 查看服務狀態 systemctl enable/disable foo.service 設定使用或不使用某服務(只會設定在目前的 target ) ● 分析工具: systemd-analyze 套件 systemd-analyze blame 列出最耗時的 systemd-analyze plot > out.svg 製作時序圖

參考資料 ● systemd man page ● 鳥哥的私房菜 http://linux.vbird.org/linux_basic/0510osloader.php#startup_init ● Itsmw http://myip.tw/itsmw/index.php?title=Upstart ● systemd System and Service Manager http://www.freedesktop.org/wiki/Software/systemd/ ● Systemd/zh-hant - The Chakra Project http://www.chakra-project.org/wiki/index.php?title=Systemd/zh-hant#.E4.BD.BF.E7.94.A8_systemd ● (=..=)/: systemd-analyze http://xatierlike.blogspot.tw/2013/01/systemd-analyze.html

Add a comment

Related presentations

Related pages

Systemd - FedoraProject

systemd is a system and service manager for Linux, ... (similar to run level 1); systemd.unit=emergency ... systemd-cgls lists the running process in a ...
Read more

The systemd Daemon | Reference | openSUSE Leap 42.1

The program systemd is the process with process ID 1. ... systemd introduces a new concept ... root # systemd-cgls --no-pager ├─1 /usr/lib/systemd ...
Read more

Managing Services on Linux with systemd | Linux.com

Managing Services on Linux with systemd ... You've read all about systemd, the new Linux init ... systemadm is a nice graphical systemd manager (figure 1).
Read more

systemd - freedesktop.org

Defaults to no. systemd.show _status= ... (1) and the systemd process. ... [1] If run inside a Linux container these arguments may be passed as ...
Read more

systemd(1) - Linux manual page - Michael Kerrisk

SYSTEMD(1) ... even if the process ID is not 1, i.e. systemd is ... Processes systemd spawns are placed in individual Linux control ...
Read more

systemd in SUSE® Linux Enterprise 12 - White Paper

Introduced with SUSE ® Linux Enterprise 12, systemd ... runs.with.a.process.ID.(PID).of.1 ..But ... The systemd Journal. Theystemd.s .journal.is.a.new ...
Read more

Systemd Service Unit Configuration - freedesktop.org

The service process may be the main service process, but it ... Example 1. Simple service. ... Since no ExecStop= was specified, systemd will send ...
Read more

systemd - Wikipedia, the free encyclopedia

... space's process tree; the first process (pid 1) ... systemd version 215 was released, adding new features ... systemd supports only Linux and ...
Read more

Chapter 9. Unix Services - Debian

Boot sequence of a computer running Linux with systemd. ... systemd[1]: ssh.service: main process ... missing services and stop those that are no ...
Read more