1

Without having to manually trace dependencies, e.g. with systemctl show or systemctl cat, and manually inspect the state of the system with systemctl status and systemctl list-units, is there a way to preview what a systemctl stop|start|restart would do?

Failing that, after the fact, is there a way to show a trace of which jobs were queued and why?

The kind of trace I would like to see in either case is something like:

starting X due to user request adding Y to the transaction because it is required by X adding Z1, Z2, Z3 because they are wanted by Y … 

PS: The --dry-run option is only available on later versions of systemd than the one I have, and is documented to only be supported on certain operations that are not relevant for my use case.

3
  • PPS: I tried a systemctl poweroff --dry-run on my workstation (systemd version 237) as a normal non-root user, and it simply ignored the --dry-run option and shut my computer down. A bug in systemd, or a lack of understanding of the documentation on my part? Commented Jan 16, 2019 at 12:31
  • Have you looked at systemctl list-dependencies <unit>? Commented Jan 16, 2019 at 15:49
  • Yes, list-dependencies is in the same category as show, cat etc., i.e. requires manual work to interpret for my use case. For one thing, it does not seem to follow the symlinks for WantedBy=, so some units are obviously missing from the list. Commented Jan 16, 2019 at 21:13

1 Answer 1

0

It depends: If other units do not rely on your unit, you could replace the actual commands you unit executes with a dummy command that just prints or logs its parameters. However for daemon-like processes it would be a bit tricky as they should not terminate.

As some units can only work when other units were started actually, simulation is always limited.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.