Translation(s): English - Russian - 简体中文 - ~


systemd - 系统和服务管理器

介绍

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

另请参阅 http://fedoraproject.org/wiki/How_to_debug_Systemd_problems

漏洞和漏洞跟踪系统

已知问题和解决方法

sysvinit vs. systemd-sysv

Upgrade to sysvinit ≥ 2.88dsf-44.

加密交换模块引导

See http://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.

Debian specific channels include

Several other distributions are using systemd

Debian资源

其他资源

待办事项


CategoryPermalink