3

What can I do to prevent that a service starts on install?

When installing zerotier-one manually, i.e. using

apt install zerotier-one 

it is both enabled (equivalent of systemctl enable zerotier-one) and started (equivalent of systemctl start zerotier-one) automatically. Is there some way of preventing this behviour?

Looking at the control file in the .deb the package is built using dh_systemd_enable to enable it, and dh_installinit to start it. Neither of the manpages for these two pieces of debhelper mention anything about how to prevent enable/start though.

1

1 Answer 1

4

For a one off installation, you can prevent a service from being started by masking it beforehand:

sudo systemctl mask zerotier-one 

(See this recent debian-devel thread on “not starting a daemon upon installation” for related discussion, including the paucity of documentation in a Debian-specific context.)

To define a more comprehensive policy, you can use systemd presets, which are designed explicitly for this; for a single service you could create a preset containing only

disable zerotier-one.service 
2
  • 1
    The proper systemd way is of course presets, not masks, with the maintainer scripts using systemctl preset instead of systemctl enable. Last that I checked, this was rarely used by Debian packages and did not really work in Debian if one used debhelper. unix.stackexchange.com/a/462321/5132 Commented Jun 12, 2020 at 12:48
  • 1
    @JdeBP indeed, presets are another option, I’ll update my answer. They are supported in Debian, via deb-systemd-helper, see #772555 for details. Commented Jun 12, 2020 at 13:13

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.