I've been following the excellent guides to create debian packages to install an application executable


and using dh-systemd to install a systemd service


however, I would like to combine the two to create a package to install a service and install the binary which gets run by the service.

The first tutorial has the application files in the directory above the /debian folder and a make file to build and install the application, whereas the systemd tutorial has the service file in the debian folder. It is not clear to me how to create a control file which installs both service file and dependant binary.

I'd be grateful if someone could advise how to do this or provide some useful reference material.

I've tried reading https://wiki.debian.org/Teams/pkg-systemd/Packaging but this doesn't explain much.

Is this a realistic expectation, or should services and applications be packaged separately?


1 Answer 1


Services and applications should be packaged together; at least, services should be packaged with the binaries implementing the service they manage.

In most cases, installing systemd units is transparent. If the main build installs units into the expected target directories (/lib/systemd/system), they will be picked up and enabled automatically. If the package ships units in debian, they will be installed in the right place and also enabled automatically. All this is handled by dh_systemd_enable and dh_systemd_start, which used to be shipped in dh-systemd but are now part of debhelper, and included in the default dh sequences.

So, if you take your existing application package, and add a service file in debian, you should find it “just works” (assuming you’re using dh).

  • Thanks. I can almost get my service running. The service is not being enabled, however I think this is perhaps a different issue. Nov 13, 2019 at 17:08

You must log in to answer this question.

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