1

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

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).

1
  • 1
    This is totally unrelated and does not answer the question in any way.
    – Atemu
    Dec 27, 2020 at 8:48
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.