Ubuntu – Ubuntu 18.04 and systemctl service disappearing

servicessystemd

I created and enabled a service:

$ sudo systemctl enable /path/to/imaservice.service
Created symlink /etc/systemd/system/multi-user.target.wants/imaservice.service → /path/to/imaservice.service.
Created symlink /etc/systemd/system/imaservice.service → /path/to/imaservice.service.

It exists and persists in both:

/etc/systemd/system/imaservice.service
/etc/systemd/system/multi-user.target.wants/imaservice.service

I can now start/stop/status it happily. When I reboot, I can't start it. I get the following:

$sudo systemctl is-enabled imaservice
enabled

However:

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

Every time I reboot, I have to re-enable with:

$sudo systemctl enable imaservice
$sudo systemctl daemon-reload

And after this it's back to normal.

What am I doing wrong?

Best Answer

I had the same problem.

Only solution that I found is to copy the service without creating links

sudo cp /path/to/imaservice.service /etc/systemd/system/multi-user.target.wants/imaservice.service

In this way it works.

Related Question