What I mean under the question is: is there a way to dump the ordered list (like pstree does for processes) to see how systemd executed the supplied set of units, i.e. the tree after the dependencies were resolved and jobs were queued for the execution? I know that you can do it by analysing systemd state data, but is there a quick way to see such a tree? It would help a lot in failure investigation (e.g. if you see that the boot process was stuck on some unit you would be able to pinpoint the approximate location for your deeper investigation.
Linux – way to see the execution tree of systemd
linuxsystemd
Related Topic
- Find the location of a systemd unit file service
- Systemd – Difference Between After= and Requires=
- Preview or debug (dry-run or trace) systemctl actions (start, stop, restart, etc.)
- SELinux – How to Unblock Execution in Systemd Units
- Systemd failing enable with “service is transient or generated”. What’s wrong with this configuration
Best Answer
systemd-analyze
is your friend. For examplesystemd-analyze critical-chain
outputs blocking tree of daemons. Mine for example:NetworkManager in example basically holding entire bootup.
If you want to have more detailed view you can render entire execution chain in a svg file.
systemd-analyze plot > something.svg
outputs entire chain (120+ modules) as progress bars to high-res svg file which show states, that are blocked and another problems.Finally you have
systemd-analyze dot
tool which outputs dot file which outputs entire hierarchy:systemd-analyze dot | dot -Tpng -o stuff.png
with dot tool you can output it as ps and svg files too.All of above tools are built-in in systemd-analyze tool which comes by default with systemd in archlinux at least. I think there is some 3rd party projects dealing with it too.