Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a way to instruct systemd to recalculate service dependencies while the system is booting. Specifically, I need one service to be able to enable another service, and have the second service start up later in the same boot sequence. This is part of my automatic deployment process; very early in the boot process, the first time the system starts up, it automatically configures itself. One of the steps that it may need to take is enabling other services. Unfortunately, any changes it makes at that step do not seem to take effect until the following reboot. Rebooting the machine after initial deployment is not an option.

Here's a generalized idea of what I'm trying to achieve


Description=Enable MyService

ExecStart=/bin/systemctl enable myservice.service
ExecStartPost=/bin/systemctl disable firstboot.service






Unfortunately, this doesn't work as I expected; the service is enabled, but is not started before multi-user.target:

$ systemctl status myservice
myservice.service - MyService
   Loaded: loaded (/etc/systemd/system/myservice.service; enabled)
   Active: inactive (dead)

I can force it to start with systemctl isolate multi-user.target or by rebooting the machine.

I have tried adding systemctl daemon-reload and/or systemctl daemon-reexec to ExecStart/ExecStartPost of firstboot.service, but neither seem to have any effect.

Is there any way I can tell systemd to recalculate the boot path and include the changes that were made while it was still booting? Or will I need to do something later in the boot process to force my service to start?

share|improve this question
systemd already does this by default - after a fashion - if you have it in initramfs. It execs itself at switchroot. If I were you I would have one initramfs for deployment and one it deploys. If you find the idea interesting look here for more: freedesktop.org/wiki/Software/systemd/InitrdInterface – mikeserv Jun 6 '14 at 14:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.