[systemd-devel] switching to another default from within a service

Chris Morin chris.morin2 at gmail.com
Tue Dec 6 17:03:34 UTC 2016


Hi,
I have a service that needs to run before anything else in the system.
To accomplish this, I made a new target that only depends on this
service, and set that new target as the default.target.

The service that runs does it's early boot task. It's then supposed to
switch to the original default.target; this is where I'm having
issues.

The files I'm using look something like this
================
early-boot.target:
[Unit]
AllowIsolate=true
Requires=early-boot.service

early-boot.service:
[Unit]
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/bin/do-early-boot-stuff.sh
ExecStart=/bin/systemctl set-default normal-boot.target
ExecStart=/bin/systemctl daemon-reload
ExecStart=/bin/systemctl --no-block isolate default.target
====================

This issue is that the isolate command doesn't seem to run/work.
I the device seems to remain in the early-boot.target state.
Why does this not work? And how can I get it working?

Thanks for the help!


More information about the systemd-devel mailing list