Indirekter Status der Systemd-Einheit

Indirekter Status der Systemd-Einheit

Ich frage mich, wie ich überprüfen kann, welche Einheit eine andere mit dem Status „indirekt“ aktiviert?

Ich verwende Arch mit Gnome und einem Debian-Server. Auf meinem Debian-Rechner kann ich systemctl list-unit-files --type=target --state=enabledwie erwartet die folgende Ausgabe für Shows sehen:

default.target    enabled
multi-user.target enabled

Aber auf dem Arch-Desktop ist das überraschenderweise nicht der Fall, obwohl sowohl: multi-user.targetals auch graphical.target(mein Standard auf Arch) aktiv sind. Wenn ich den Status dieser Unit-Dateien überprüfe, sind beide: indirect. Wenn ich Abhängigkeiten aufliste, werden und graphical.targetangezeigt . In der GDM-Unit-Datei sehe ich den Abschnitt nicht . Was genau aktiviert also ?gdm.servicemulti-user.targetAlso=[Install]graphical.target

Was ist der Grund für diese „indirekte“ Lösung?

Antwort1

Aus man systemd.special:

grafisches Ziel
       A special target unit for setting up a graphical login screen.
       This pulls in multi-user.target.

       Units that are needed for graphical logins shall add Wants= dependencies for their unit to this unit (or multi-user.target) during installation.
       This is best configured via WantedBy=graphical.target in the unit's [Install] section.

Der Inhalt Ihrer gdm.servicewürde die Dinge also genauer erklären ...


Unten sind die Informationen zu diesen beiden Diensten auf meinem System. Beachten Sie, dass sie „statisch“ sind …

$ systemctl status multi-user.target graphical.target

● multi-user.target - Multi-User System
     Loaded: loaded (/lib/systemd/system/multi-user.target; static)
     Active: active since Mon 2023-09-04 09:34:27 +03; 11h ago
      Until: Mon 2023-09-04 09:34:27 +03; 11h ago
       Docs: man:systemd.special(7)

Sep 04 09:34:27 kubuntu systemd[1]: Reached target multi-user.target - Multi-User System.

● graphical.target - Graphical Interface
     Loaded: loaded (/lib/systemd/system/graphical.target; static)
     Active: active since Mon 2023-09-04 09:34:27 +03; 11h ago
      Until: Mon 2023-09-04 09:34:27 +03; 11h ago
       Docs: man:systemd.special(7)

Sep 04 09:34:27 kubuntu systemd[1]: Reached target graphical.target - Graphical Interface.
$ systemctl cat multi-user.target graphical.target

# /lib/systemd/system/multi-user.target
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Multi-User System
Documentation=man:systemd.special(7)
Requires=basic.target
Conflicts=rescue.service rescue.target
After=basic.target rescue.service rescue.target
AllowIsolate=yes

# /lib/systemd/system/graphical.target
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.

[Unit]
Description=Graphical Interface
Documentation=man:systemd.special(7)
Requires=multi-user.target
Wants=display-manager.service
Conflicts=rescue.service rescue.target
After=multi-user.target rescue.service rescue.target display-manager.service
AllowIsolate=yes
$ ls -la /lib/systemd/system/{multi-user,graphical}.target
-rw-r--r-- 1 root root 606 Jan 26  2023 /lib/systemd/system/graphical.target
-rw-r--r-- 1 root root 540 Jan 26  2023 /lib/systemd/system/multi-user.target

verwandte Informationen