I have come across a .service that contains the following:

[Install]
WantedBy=multi-user.target

The original .service file can be found HERE.

I am on Ubuntu 16.04LTS.

  • 3
    Possible duplicate of What is systemd's target, service and socket? – muru Nov 15 '17 at 8:49
  • 1
    It's not a proper duplicate, as (reading beyond the title) this question is asking about the [Install] section of a unit file. Ironically, it is the very next table down from the one hyperlinked in the question. – JdeBP Nov 15 '17 at 11:52
up vote 11 down vote accepted

This is the dependencies handling mechanism in systemd. multiuser.target is the alternative for runlevel 3 in systemV world. That said, reaching multiuser.target includes starting the "Confluent ZooKeeper" service. Probably that's what you need indeed.

multi-user.target means that the systemd-service will start when the system reach runlevel 2.

To complement the answer, here's a table of the targets and their run levels:

Run Lvl Target Units                        Description
0       runlevel0.target, poweroff.target   Shut down and power off
1       runlevel1.target, rescue.target     Set up a rescue shell
2,3,4   runlevel[234].target,               Set up a non-gfx multi-user shell
        multi-user.target
5       runlevel5.target, graphical.target  Set up a gfx multi-user shell
6       runlevel6.target, reboot.target     Shut down and reboot the system
  • But it's WantedBy=multi-user.target, so it just means the service will start and before runlevel 2 right ? not necessarily when system reaches runlevel 2, am I wrong ? – Tristan 22 hours ago

I found this tutorial the simplest to understand. You can run the following command yourself to see what's there:

$ ls -al /lib/systemd/system/runlevel*
lrwxrwxrwx. 1 root root 15 Apr 25 10:31 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 Apr 25 10:31 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 Apr 25 10:31 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Apr 25 10:31 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 Apr 25 10:31 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 Apr 25 10:31 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 Apr 25 10:31 /lib/systemd/system/runlevel6.target -> reboot.target

But you should probably just read the linked question accepted answer about targets.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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