systemd 文档和各种在线资源都声明 systemd 应该(默认情况下)启动名为“default.target”的“特殊”目标。可以通过 systemctl set-default 更改此设置,这基本上是从 default.target 到所需目标的符号链接。
但是在我的系统中没有这样的文件。没有/etc/systemd/system/default.target,没有/usr/lib/systemd/system/default.target(实际上这个文件在整个系统中是不存在的)。系统仍在启动。我的问题是怎么可能?
(当然我可以自己做一个符号链接,我只是想知道如何在没有 default.target 的情况下定义一个默认值)
附加信息:
# systemctl get-default
graphical.target
所以我的默认目标是graphics.target。但它在哪里(以及如何)定义?
# find /usr/lib -iname "default.target" # no results
# find /etc -iname "default.target" # no results
# lsb_release -a
LSB Version: n/a
Distributor ID: Gentoo
Description: Gentoo Base System release 2.4.1
Release: 2.4.1
Codename: n/a
# systemctl list-units --type=target
UNIT LOAD ACTIVE SUB DESCRIPTION
basic.target loaded active active Basic System
getty.target loaded active active Login Prompts
graphical.target loaded active active Graphical Interface
local-fs-pre.target loaded active active Local File Systems (Pre)
local-fs.target loaded active active Local File Systems
machines.target loaded active active Containers
multi-user.target loaded active active Multi-User System
network-online.target loaded active active Network is Online
network.target loaded active active Network
nss-lookup.target loaded active active Host and Network Name Lookups
paths.target loaded active active Paths
remote-fs.target loaded active active Remote File Systems
slices.target loaded active active Slices
sockets.target loaded active active Sockets
sound.target loaded active active Sound Card
swap.target loaded active active Swap
sysinit.target loaded active active System Initialization
timers.target loaded active active Timers
LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.
18 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.