3

I try to package my self-made daemon into debian package. I wrote systemd's .service file for it. This file is present in the package. Package installs ok. But after install there is no .service file in /etc/systemd/system. When monitoring /etc/systemd/system with inotifywait I can see the following:

/etc/systemd/system/ CREATE myservice.service.dpkg-new
/etc/systemd/system/ MODIFY myservice.service.dpkg-new
/etc/systemd/system/ ATTRIB myservice.service.dpkg-new
/etc/systemd/system/ ATTRIB myservice.service.dpkg-new
/etc/systemd/system/ CLOSE_WRITE,CLOSE myservice.service.dpkg-new
/etc/systemd/system/ ATTRIB myservice.service.dpkg-new
/etc/systemd/system/ CLOSE_WRITE,CLOSE myservice.service.dpkg-new
/etc/systemd/system/ DELETE myservice.service.dpkg-new

Why .service file is not installed? Why I don't even get an error? How to fix this?

My system is Ubuntu 15.10.

1 Answers1

4

Answering my own question: I misunderstood systemd documentation.

Unit file for systemd must be placed to /lib/systemd/system; in /etc/systemd/system are stored symlinks created by systemd itself.

  • 1
    If you follow dh_installinit's conventions, it will take care of installation and enabling, etc. – muru Jan 09 '16 at 07:05
  • Thank you! Now I understand it was a better way.

    I tried to avoid the problem described here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752279 (standard debian posrm scripts for systemd infrastructure can't uninstall package with incorrect unit file), because in my case the unit file itself is still under development and often contains errors.

    – Yuriy Al. Shirokov Jan 10 '16 at 09:46