La documentazione di systemd e varie fonti online dichiarano che systemd dovrebbe avviare (per impostazione predefinita) il target "speciale" chiamato "default.target". È possibile cambiarlo con systemctl set-default che fondamentalmente crea un collegamento simbolico da default.target al target desiderato.
Tuttavia nel mio sistema non esiste un tale file. No /etc/systemd/system/default.target, no /usr/lib/systemd/system/default.target (in realtà questo file non esiste nell'intero sistema). Il sistema è ancora in fase di avvio. La mia domanda è come può essere?
(Ovviamente potrei creare un collegamento simbolico da solo, voglio solo sapere come è possibile definire un default senza default.target)
Informazioni aggiuntive:
# systemctl get-default
graphical.target
Quindi il mio target predefinito è graphical.target. Ma dove (e come) si definisce?
# 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'.
Risposta accettata:
Gentoo ha cambiato la posizione dei file systemd in /lib/systemd
nel luglio del 2017. Sul mio sistema, posso vedere il collegamento simbolico predefinito in /lib/systemd/system
:
$ ls -l /lib/systemd/system/default.target
lrwxrwxrwx 1 root root 16 Apr 2 15:48 /lib/systemd/system/default.target -> graphical.target
Se aggiungi un collegamento simbolico in /etc/systemd/system
(come systemctl set-default
fa), sovrascriverà l'impostazione predefinita della distribuzione.