Sono a conoscenza del seguente thread e presumibilmente una risposta ad esso. Tranne una risposta non è una risposta in senso generico. Racconta qual era il problema in un caso particolare, ma non in generale.
La mia domanda è:esiste un modo per eseguire il debug dei cicli di ordinazione in un generico strada? Es.:esiste un comando che descrive il ciclo e cosa collega un'unità all'altra?
Ad esempio, ho seguito in journalctl -b
(ignora la data, il mio sistema non ha RTC con cui sincronizzare l'ora):
Jan 01 00:00:07 host0 systemd[1]: Found ordering cycle on sysinit.target/start
Jan 01 00:00:07 host0 systemd[1]: Found dependency on local-fs.target/start
Jan 01 00:00:07 host0 systemd[1]: Found dependency on cvol.service/start
Jan 01 00:00:07 host0 systemd[1]: Found dependency on basic.target/start
Jan 01 00:00:07 host0 systemd[1]: Found dependency on sockets.target/start
Jan 01 00:00:07 host0 systemd[1]: Found dependency on dbus.socket/start
Jan 01 00:00:07 host0 systemd[1]: Found dependency on sysinit.target/start
Jan 01 00:00:07 host0 systemd[1]: Breaking ordering cycle by deleting job local-fs.target/start
Jan 01 00:00:07 host0 systemd[1]: Job local-fs.target/start deleted to break ordering cycle starting with sysinit.target/start
dove cvol.service (quello che è stato introdotto e che interrompe il ciclo) è:
[Unit]
Description=Mount Crypto Volume
After=boot.mount
Before=local-fs.target
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/bin/cryptsetup open /dev/*** cvol --key-file /boot/***
[Install]
WantedBy=home.mount
WantedBy=root.mount
WantedBy=usr-local.mount
Secondo journalctl, cvol.service vuole basic.service, tranne per il fatto che non lo fa, almeno non ovviamente. Esiste un comando che dimostrerebbe da dove viene derivato questo collegamento? E in generale, esiste un comando che trovi i cicli e mostra dove ha origine ogni collegamento nel ciclo?
Risposta accettata:
Puoi visualizzare il ciclo con i comandi systemd-analyze verify
, systemd-analyze dot
e il dot
di GraphViz strumento:
systemd-analyze verify default.target |&
perl -lne 'print $1 if m{Found.*?ons+([^/]+)}' |
xargs --no-run-if-empty systemd-analyze dot |
dot -Tsvg >cycle.svg
Dovresti vedere qualcosa del genere:
Qui puoi vedere il ciclo:c.service->b.service->a.service->c.service
Color legend:
black = Requires
dark blue = Requisite
dark grey = Wants
red = Conflicts
green = After
Link:
- analisi-sistema(1)
- punto(1)