4

When should a systemd unit file use WantedBy=sysinit.target vs WantedBy=multi-user.target?

Does WantedBy=sysinit.target have something to do with grub boot menu boot into recovery mode?

Units listed under WantedBy=sysinit.target are started in recovery mode but those listed under WantedBy=multi-user.target are not? Or is recovery mode unrelated?

2 Answers 2

4

The page you're looking for is located freedesktop.org here. By default sysinit.target is after the filesystems and swap are mounted and the basic system features are up, but before the various background services start.

Multi-user.target is after the services are running and the login prompts are enabled.

Graphical.target essentially means a display manager is running.

It's not GRUB recovery mode that's different but systemd's recovery mode (which can be triggered with kernel options from GRUB). Systemd's recovery is rescue.service/rescue.target which comes explicitly after sysinit.target so everything before that is already running and everything wanted by sysinit has already been kicked off by the time it runs.

2

If you want to see the real picture of services loading on a timeline, run

systemd-analyze plot > systemd.svg

and then load the SVG in your browser or any other graphics program able to display this file type (e.g. inkscape).

2
  • 1
    This is totally unrelated and does not answer the question in any way. Commented Dec 27, 2020 at 8:48
  • 1
    @Atemu damn, harsh. I mean to be fair, there might be others who are wondering a related question but ended up here that can benefit from this feature, so it's not totally unrelated. Commented Mar 7, 2023 at 12:16

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.