Difference between revisions of "Systemd FAQ (简体中文)"

From ArchWiki
Jump to: navigation, search
(Create from Systemd FAQ section.)
 
(常见问题: Update translation.)
Line 4: Line 4:
 
== 常见问题 ==
 
== 常见问题 ==
 
最新的已知问题,参见:[http://cgit.freedesktop.org/systemd/systemd/tree/TODO TODO]。
 
最新的已知问题,参见:[http://cgit.freedesktop.org/systemd/systemd/tree/TODO TODO]。
 
{{FAQ
 
|question=控制台字体很难看,怎么办?
 
|answer=如果 {{ic|/etc/vconsole.conf}}(以及备用的 {{ic|/etc/rc.conf}}) 中没有设置控制台字体,那么会使用一个支持很多字符集的标准字体。自己设置一个好看的字体吧。}}
 
  
 
{{FAQ
 
{{FAQ
 
|question=为什么控制台上会显示日志信息?
 
|question=为什么控制台上会显示日志信息?
|answer=请自行设置内核日志等级(loglevel)。以前,{{ic|/etc/rc.sysinit}} 帮我们把 dmesg 的日志等级设置为 {{ic|3}},是比较合适的。在启动引导器中添加内核参数 {{ic|1=loglevel=3}} 或 {{ic|quiet}} 即可。}}
+
|answer=请自行设置内核日志等级(loglevel)。以前,{{ic|/etc/rc.sysinit}} 帮我们把 dmesg 的日志等级设置为 {{ic|3}},是比较合适的。 [[kernel parameters|内核参数]]中加入 {{ic|1=loglevel=3}} 或 {{ic|quiet}} 即可。}}
  
 
{{FAQ
 
{{FAQ
Line 19: Line 15:
 
在 {{ic|/etc/systemd/system/getty.target.wants/}} 添加新的软链接即可:
 
在 {{ic|/etc/systemd/system/getty.target.wants/}} 添加新的软链接即可:
  
{{bc|<nowiki># ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty9.service
+
# ln -sf /usr/lib/systemd/system/getty@.service /etc/systemd/system/getty.target.wants/getty@tty9.service
# systemctl daemon-reload
+
# systemctl daemon-reload
# systemctl start getty@tty9.service</nowiki>}}
+
# systemctl start getty@tty9.service
  
 
移除 getty:
 
移除 getty:
Line 27: Line 23:
 
从 {{ic|/etc/systemd/system/getty.target.wants/}} 删除对应的软链接即可:
 
从 {{ic|/etc/systemd/system/getty.target.wants/}} 删除对应的软链接即可:
  
{{bc|<nowiki># rm /etc/systemd/system/getty.target.wants/getty@tty5.service /etc/systemd/system/getty.target.wants/getty@tty6.service
+
# rm /etc/systemd/system/getty.target.wants/getty@tty5.service /etc/systemd/system/getty.target.wants/getty@tty6.service
# systemctl daemon-reload
+
# systemctl daemon-reload
# systemctl stop getty@tty5.service getty@tty6.service</nowiki>}}
+
# systemctl stop getty@tty5.service getty@tty6.service
 +
 
 +
Users may also change the number of gettys by editing {{ic|/etc/systemd/logind.conf}} and changing the value of {{ic|NAutoVTs}}. By doing it this way, the on-demand spawning will be preserved, whereas the above method will simply have the gettys running from boot.
  
 
systemd 不使用 {{ic|/etc/inittab}} 文件。
 
systemd 不使用 {{ic|/etc/inittab}} 文件。
Line 46: Line 44:
 
|answer=自己写一个 getty@tty1.service 文件
 
|answer=自己写一个 getty@tty1.service 文件
  
把 {{ic|/usr/lib/systemd/system/getty@.service}} 复制到 {{ic|/etc/systemd/system/getty.target.wants/getty@tty1.service}},编辑该文件:
+
把 {{ic|/usr/lib/systemd/system/getty@.service}} 复制到 {{ic|/etc/systemd/system/getty.target.wants/getty@tty1.service}},修改 {{ic|TTYVTDisallocate}} 为 {{ic|no}}.
* 在 {{ic|ExecStart}} 行的 {{ic|agetty}} 后添加 {{ic|--noclear}}
+
* 修改 {{ic|TTYVTDisallocate}} 为 {{ic|no}}
+
 
}}
 
}}
  
Line 57: Line 53:
 
这里有一些必须/推荐的编译设置,但并不全:
 
这里有一些必须/推荐的编译设置,但并不全:
  
{{bc|<nowiki>
+
CONFIG_AUDIT=y (recommended)
CONFIG_AUDIT=y (推荐)
+
CONFIG_AUDIT_LOGINUID_IMMUTABLE=y (not required, may break sysvinit compat)
CONFIG_AUDIT_LOGINUID_IMMUTABLE=y (不必要,会破坏 sysvinit 兼容性)
+
CONFIG_CGROUPS=y
CONFIG_CGROUPS=y
+
CONFIG_IPV6=[y<nowiki>|</nowiki>m] (highly recommended)
CONFIG_IPV6=[y|m] (强烈推荐)
+
CONFIG_UEVENT_HELPER_PATH=""
CONFIG_UEVENT_HELPER_PATH="" (如果不使用 initramfs 的话)
+
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS=y
+
CONFIG_DEVTMPFS_MOUNT=y (required if you don't use an initramfs)
CONFIG_DEVTMPFS_MOUNT=y (推荐,如果不使用 initramfs 的话)
+
CONFIG_RTC_DRV_CMOS=y (highly recommended)
CONFIG_RTC_DRV_CMOS=y (强烈推荐)
+
CONFIG_FANOTIFY=y (required for readahead)
CONFIG_FANOTIFY=y (readahead 需要)
+
CONFIG_AUTOFS4_FS=[y<nowiki>|</nowiki>m]
CONFIG_AUTOFS4_FS=[y|m]
+
CONFIG_TMPFS_POSIX_ACL=y (recommended, if you want to use pam_systemd.so)
CONFIG_TMPFS_POSIX_ACL=y (推荐,如果使用 pam_systemd.so 的话)
+
CONFIG_NAMESPACES=y (for Private*=yes)
</nowiki>}}}}
+
CONFIG_NET_NS=y (for PrivateNetwork=yes)
 +
CONFIG_FHANDLE=y
 +
}}
  
 
{{FAQ
 
{{FAQ
 
|question=怎样知道一个目标需要哪些进程服务?
 
|question=怎样知道一个目标需要哪些进程服务?
 
|answer=例如,你可能想搞明白目标单元 {{ic|multi-user.target}} 究竟启用了哪些服务,那么以下命令即可:
 
|answer=例如,你可能想搞明白目标单元 {{ic|multi-user.target}} 究竟启用了哪些服务,那么以下命令即可:
{{hc|$ systemctl show -p "Wants" multi-user.target|2=Wants=ntpd.service cronie.service cpufreq.service psd.service syslog-ng.service remote-fs.target NetworkManager.service rc-local.service goagent.service dbus.service systemd-ask-password-wall.path systemd-logind.service getty.target systemd-user-sessions.service systemd-update-utmp-runlevel.service}}
+
{{hc|$ systemctl show -p "Wants" multi-user.target|2=
 +
Wants=rc-local.service avahi-daemon.service rpcbind.service NetworkManager.service acpid.service dbus.service atd.service crond.service auditd.service ntpd.service udisks.service bluetooth.service cups.service wpa_supplicant.service getty.target modem-manager.service portreserve.service abrtd.service yum-updatesd.service upowerd.service test-first.service pcscd.service rsyslog.service haldaemon.service remote-fs.target plymouth-quit.service systemd-update-utmp-runlevel.service sendmail.service lvm2-monitor.service cpuspeed.service udev-post.service mdmonitor.service iscsid.service livesys.service livesys-late.service irqbalance.service iscsi.service}}
  
 
除了 {{ic|Wants}},还可以查看各种形式的依赖和被依赖信息:{{ic|WantedBy}}、{{ic|Requires}}、{{ic|RequiredBy}}、{{ic|Conflicts}}、{{ic|ConflictedBy}}、{{ic|Before}}、{{ic|After}}。}}
 
除了 {{ic|Wants}},还可以查看各种形式的依赖和被依赖信息:{{ic|WantedBy}}、{{ic|Requires}}、{{ic|RequiredBy}}、{{ic|Conflicts}}、{{ic|ConflictedBy}}、{{ic|Before}}、{{ic|After}}。}}
Line 82: Line 81:
 
|answer=使用
 
|answer=使用
 
  $ systemctl poweroff
 
  $ systemctl poweroff
而不是 systemctl halt.}}
+
而不是 {{ic|systemctl halt}}.}}
  
 
{{FAQ
 
{{FAQ
Line 106: Line 105:
 
本例是说当目标multi-usr载入的时候,会启动你这个自定义脚本。
 
本例是说当目标multi-usr载入的时候,会启动你这个自定义脚本。
 
}}
 
}}
 +
 +
{{FAQ
 +
|question=Status of .service says "active (exited)" in green. (e.g. iptables)
 +
|answer=This is perfectly normal. In the case with iptables it is because there is no daemon to run, it is controlled in the kernel. Therefore, it exits after the rules have been loaded.
 +
 +
To check if your iptables rules have been loaded properly:
 +
 +
{{bc|# iptables --list}}}}
 +
 +
{{FAQ
 +
|question={{ic|Failed to issue method call: File exists}} error
 +
|answer=This happens when using {{ic|systemctl enable}} and the symlink it tries to create in {{ic|/etc/systemd/system/}} already exists. Typically this happens when switching from one display manager to another one (for instance GDM to KDM, which can be enabled with {{ic|gdm.service}} and {{ic|kdm.service}}, respectively) and the corresponding symlink {{ic|/etc/systemd/system/display-manager.service}} already exists.
 +
 +
To solve this problem, use {{ic|systemctl -f enable}} to overwrite an existing symlink.}}

Revision as of 01:58, 24 October 2012

常见问题

最新的已知问题,参见:TODO

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ

Template:FAQ