「systemd」- 概念、术语

System Instance and User Instance

在阅读「systemd-system.conf」手册时,有这样一段话:

When run as a system instance, systemd interprets the configuration file system.conf and the files in system.conf.d directories; when run as a user instance, systemd interprets the configuration file user.conf and the files in user.conf.d directories.

问题就是:什么是 system instance?什么是 user instance?

「系统服务」是由「系统级 systemd 实例」管理。

「用户服务」是由「用户级 systemd 实例」管理。

「系统级 systemd 实例」只能有一个,它总是运行的,进程ID 为 1 。只有系统管理员才能管理它的服务。

「用户级systemd实例」是以命令systemd --user形式运行,你可以看一下系统中systemd进程数及它们的运行方式,这个在桌面环境下比较明显。它们的进程ID不为 1 。每个用户只有一个实例。

参考文献

systemd/Directives/systemd-system.conf
What is the difference between systemd’s user and system services?