15

I expected systemctl --user enable SERVICE to start the service on login, which is not happening. Then what is it supposed to mean?

4
  • Is your user session using systemd? Commented Dec 1, 2014 at 6:52
  • 1
    What exactly do you mean? Can I check this in any way? I'm running arch linux. And systemd is the default since 2012-10-13. I installed my OS this summer. Does this answer your question? Commented Dec 1, 2014 at 7:13
  • 3
    Have you followed wiki.archlinux.org/index.php/Systemd/User ? Commented Dec 1, 2014 at 8:31
  • Apparently, yes. But I missed the fact that when it starts, it brings up the target default.target. I just copied the file as is and failed to realize that I've got yet to change the target. Commented Dec 3, 2014 at 21:54

3 Answers 3

10

It makes the unit start on first login of a user, but for that corresponding unit file should have WantedBy = default.target or something along the lines. Because when user instance of systemd starts, it brings up the default.target target.

4
  • My chrome-remote-desktop.service has [Install] / Alias=chromoting.service / WantedBy=default.target, but I still have to start it manually on first login, any idea? Commented Jun 8, 2021 at 21:56
  • @tokland Have you enabled the service? systemctl is-enabled chrome-remote-desktop Commented Jun 9, 2021 at 4:00
  • $ systemctl --user is-enabled chrome-remote-desktop -> enabled Commented Jun 9, 2021 at 8:20
  • 1
    @tokland systemd --user instance is not launched on login? Maybe this will provide some clues. Commented Jun 9, 2021 at 14:47
3

systemctl --user enable SERVICE will do nothing unless the related unit file has an [Install] section. the [Install] section lets systemd know which symlinks to set up with enable is used. From the docs:

Unit files may include an "[Install]" section, which carries installation information for the unit. This section is not interpreted by systemd(1) during runtime; it is used by the enable and disable commands of the systemctl(1) tool during installation of a unit.

0

systemd --user runs as a separate process from the systemd --system process. User units can not reference or depend on system units or units of other users.

Cannot have

After=network.target network-online.target 
3
  • Is that first paragraph a quote?  If so, what is it from?  How does any of this answer the question? … … … … … … … … … … … … … … … … … … Please do not respond in comments; edit your answer to make it clearer and more complete. Commented Jun 26, 2022 at 1:53
  • 1
    As far as I can tell, this does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post. - From Review Commented Jun 26, 2022 at 1:53
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. Commented Jul 4, 2022 at 15:42

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.