Translation(s): English - Español - Français - 한국어 - Russian - Brasileiro - 简体中文
systemd - 系统和服务管理器
Contents
介绍
systemd 是linux的系统和服务管理器。 systemd 和 SysV、LSB init scripts兼容. 它可以作为sysvinit的一个替代品. Systemd
- 提供了更积极的并行能力
- 使用socket和D-Bus activation来启动服务
- 能够按需启动守护进程
- 采用基于依赖关系的服务控制逻辑来完成各项事务
- 采用linux cgroups来跟踪进程
- 支持快照和恢复
- Maintains mount and automount points
参见 upstream 来获得更多的信息.
安装和测试
systemd 作为技术预览包含在Debian wheezy中. 请确保您使用Debian测试版或更新Debian版本来获得较新的systemd版本。
安装
安装systemd请运行:
# apt-get update # apt-get install systemd
这个命令会安装systemd软件包,但是不会将systemd配置为你的初始化系统。
设置以测试
为了在将systemd转换为默认设置之前进行测试,你要将以下启动参数添加到内核中:
init=/bin/systemd
This can be done in the grub menu for a single boot - press "e" in the grub menu and add this to the kernel line. For example, depending on the options required for your particular system, it might look something like:
linux /vmlinuz-3.13-1-amd64 root=/dev/mapper/root-root init=/bin/systemd ro quiet
If PID 1 is systemd then your system is running with systemd.
设置为默认
为了使用systemd,你同样应该安装 systemd-sysv ,它可以为 /sbin/init 提供符号链接。
# apt-get install systemd-sysv
为了使用新安装的systemd来引导系统,请重新启动:
# reboot
如果你运行一个自己编译的内核,确保你的内核版本比2.6.39更新并启用以下选项:
* CONFIG_DEVTMPFS=y * CONFIG_CGROUPS=y * CONFIG_AUTOFS4_FS=[y|m] * CONFIG_IPV6=[y|m], optional, but highly recommended * CONFIG_FANOTIFY=y, optional, required for systemd readahead. available in Linux kernel >= 2.6.37.
最新的列表, 参见上游读我文件中 "REQUIREMENTS" 章节 README .
调试
有时候需要调查为什么 systemd 在启动或者重启/关机过程中卡住不动.
解决方案 #0: Remove "quiet" from Kernel command line (so called "cmdline" or "grub line")
解决方案 #1: Increase verbosity via cmdline: Add "systemd.log_target=kmsg systemd.log_level=debug"
Of course you can have a "temporary" persistent solution:
[ /etc/default/grub ] GRUB_CMDLINE_LINUX="systemd.log_target=kmsg systemd.log_level=debug" <--- Add here (by uncommenting you can easily switch to debug) # update-grub
In addition enhance cmdline with "systemd.sysv_console=1" (0: disabled, 1: enabled).
Solution #2: Increase verbosity via /etc/systemd/system.conf
LogLevel=debug <--- Uncomment this line and use "debug" (default: commented and "info") LogTarget=syslog-or-kmsg <--- Uncomment this line (default: commented) SysVConsole=yes <--- Uncomment this line (default: commented)
HINT: "man system" and "man systemd.conf" (Note: File is system.conf vs. man-page system*d*.conf)
HINT: How to check Kernel command line parameters/options?
# cat /proc/cmdline
NOTE on LogLevel (see systemd(1) and systemd.conf(5)):
"Set log level. As argument this accepts a numerical log level or the well-known syslog(3) symbolic names (lowercase): emerg, alert, crit, err, warning, notice, info, debug."
HINT: Keep a copy of /sbin/init from sysvinit package in case of rescue (so you can use init=/sbin/init.sysvinit in cmdline)!
# cp -av /sbin/init /sbin/init.sysvinit <--- Before installing systemd-sysv package
另请参阅 https://fedoraproject.org/wiki/How_to_debug_Systemd_problems
漏洞和漏洞跟踪系统
- For known bugs please see topic "Known Issues and Workarounds"
已知问题和解决方法
sysvinit vs. systemd-sysv
Upgrade to sysvinit ≥ 2.88dsf-44.
加密交换模块引导
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=712439#70 for a patch.
According to the bug, the patch is no longer required as long as you upgrade to dmsetup 2:1.02.83-1.
Booting with lvm (especially with separate /usr) fails
Upgrade to lvm2 ≥ 2.02.104-1
哪里可取得帮助?
Systemd is a young project with a strong emphasis on solving problems in a distribution agnostic manner.
mailing-list @ https://lists.freedesktop.org/mailman/listinfo/systemd-devel
#systemd (irc.freenode.net)
Debian specific channels include
mailing-list @ https://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers
#debian-systemd (irc.oftc.net)
Several other distributions are using systemd
Debian资源
其他资源
Talk about current state of systemd in Debian and plans for Jessie at FOSDEM 2013 by Tollef Fog Heen and Michael Biebl <biebl@debian.org>
Slides from the FOSDEM 2013 talk
Talk about systemd in Debian at Linux Plumbers Conference 2010 by Michael Biebl <biebl@debian.org>
待办事项
更新更多的包来过渡到systemd服务文件. See ?How to Help
- 起草一个涉及systemd的打包政策 (upgrade / install / removal).
- 集成到软件包维护人员工具中
- invoke-rc.d/update-rc.d/service integration.
- Get Essential flag removed from sysvinit.
- Sort out what to do about pam_loginuid, and integration into the Debian PAM stack
- Decide what to do about group:lock (/var/lock).
- Make systemd-vconsole work. Investigate which of the console-* and kbd* packages are actually required and how to migrate the configuration.