Re: Systemd: how to add a service to rescue.target
On Fri, Sep 19, 2025 at 16:51:32 +0000, stefano prina wrote:
> Hello,
> So he have to :
> 1. edit the Daemon unit file
> 2. systemctl daemon-reload
> 3. run systemctl enable <service> again
> Am I right?
Don't edit the unit file. Create a drop-in override file instead.
The "systemctl edit" command will start that process for you. Or, if
you like, you can manually create the appropriately named subdirectory
under /etc/systemd/system/ and create a *.conf file inside it.
Either way, the file should contain only the lines you need, which are
just:
[Install]
WantedBy=rescue.target
According to the man page (systemctl(1)), after doing an "edit", the
configuration is automatically reloaded, so step 2 shouldn't be
necessary, but it certainly won't hurt.
I don't think step 3 is needed, or even desired. Maybe I'm wrong?
I'm not inclined to test this right now, since it entails rebooting
and is therefore highly disruptive.
Reply to: