0

I have a service that starts at boot, but I want to control it manually. Everywhere I go it says sudo systemctl disable service should do what I need, but it seems to remove the service entirely so I can't start it manually afterwards:

$ sudo systemctl disable service
Removed /etc/systemd/system/multi-user.target.wants/service.service.
Removed /etc/systemd/system/service.service.

$ sudo systemctl start service
Failed to start service.service: Unit service.service not found

I want to remove it from autostart but still be able to start it when I want. What am I missing?


What is the output of systemctl cat

Before disabling it:

# /etc/systemd/system/service.service
[Unit]
Description=Service Name

[Service]
Type=simple
ExecStart=/usr/service/service <username>
Restart=on-failure

[Install]
WantedBy=multi-user.target

9
  • How did you enable service.service.? Where is located that service file? Commented Sep 28, 2022 at 7:36
  • It came with an executable that configures everything
    – splaytreez
    Commented Sep 28, 2022 at 7:41
  • Ok, and what is the output of systemctl cat service.service? Commented Sep 28, 2022 at 7:47
  • 1
    And about the output you got with that command, is not there a path before [Unit] text? Something like /etc/systemd/system/service.service. Commented Sep 28, 2022 at 8:19
  • 1
    I think your service might be an alias as telcoM says or this one was removed from the system when you disabled it. If you try to enable again, what is the output you get? Commented Sep 28, 2022 at 8:26

1 Answer 1

0

This looks like service.service was just an alias for the actual service name, and was represented by a symbolic link in /etc/systemd/system/service.service. Such links get removed when a service is disabled.

Try grep "Alias=service.service" /etc/systemd/system/*. If it produces a hit, the name of the file will be the actual service name, and you will be able to use that name to start, stop and re-enable the service.

1
  • I suppose should add -r at the end? No hits... Without -r it prints a bunch of "is not a directory"
    – splaytreez
    Commented Sep 28, 2022 at 8:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .