Migrating Debian and Ubuntu packages to systemd

Exceptions in rules Files

It does occasionally happen that debian/rules includes other contents in addition to the call to dh. At best, separate entries just supplement the work of dh and override individual parts (targets). At worst, administrators will have to deal with a completely self-written rules file. It is important to keep a cool head if this happens: rules files normally use the debhelper suite.

Debhelper provides an approach for the package maintainer to change the normal sequence of steps for virtually any target. It is important to consider whether a target with the name override_dh_installinit exists. If so, the rules script is doing its own thing at this point. Unfortunately, it isn't possible to make a general statement about adapting to systemd. In such situations, the important thing in the end is that the script calls the dh_installinit, dh_systemd_enable, and dh_systemd_start commands within the override_dh_installinit target. If this happens, the debhelper scripts for systemd are aboard.

If dh is Missing Completely

Sometimes the rules file does not call dh at all, which is often the case for scripts that have some years under their belt and have long been abandoned. Anyone dealing with such a package would be best off making sure that the three debhelper commands in debian/rules exist within the binary-arch and the binary-indep target. In most cases, this precaution is sufficient to ensure the systemd integration works correctly.


  1. systemd: https://wiki.freedesktop.org/www/Software/systemd/
  2. Debian: https://www.debian.org
  3. Mark Shuttleworth, "Losing graciously": http://www.markshuttleworth.com/archives/1316
  4. List of Ubuntu packages still to be converted: http://people.canonical.com/~jhunt/systemd/packages-to-convert/
  5. Comparison of Upstart and systemd unit files: https://wiki.ubuntu.com/SystemdForUpstartUsers

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Professor Knopper's Lab – Removing systemd

    The systemd service manager has been widely adopted by many Linux distros, so why would you want to remove it? The professor reveals why and how.

  • systemd-networkd

    The new networkd component of the systemd project supports basic network configuration. Despite its early stage of development, one thing is clear: This is a daemon with brains.

  • Systemd Graphical Tools

    Systemd has won the race, as indicated by the several tools that already offer a service just a mouse click away. We look at six of these tools.

  • Init Systems

    SysV init was formerly the sole candidate for starting processes on Linux, but today, a tech-savvy generation of init systems is waiting in the starting blocks.

  • Systemd Units

    Systemd units use files to control resources that Systemd manages.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More