Modern daemon implementations can be run in a variety of ways, in a range of contexts. The daemon software itself can be a useful tool in environments where the associated traditional system service is neither needed nor desired. Unfortunately, common debian packaging practice has a tendency to conflate the two ideas, leading to some potentially nasty problems where only the tool itself is needed, but the system service is set up anyway.
How would i fix it? i'd suggest that we make a distinction between packages that provide tools and packages that provide system services. A package that provides the system service foo would need to depend on a package that provides the tool foo. But the tool foo should be available through the package manager without setting up a system service automatically.
Here are some examples of this class of problem i've seen recently:
akonadi is a project to provide extensible, cross-desktop storage for PIM data. It is a dependency of many pieces of the modern KDE4 desktop. Its current implementation relies on a private instantiation of mysqld, executed directly by the end user whose desktop is running.
This means that a sysadmin who installs a graphical calendar application suddenly now has (in addition to the user-instantiated local mysqld running as the akonadi backend) a full-blown system RDBMS service running and potentially consuming resources on her machine.
Wouldn't it be better if the /usr/sbin/mysqld tool itself was distinct from the system service?
Puppet is a powerful framework for configuration management. A managed host installs the puppet package, which invokes a puppetd service to reconfigure the managed host by talking to a centralized server on the network. The central host installs the the puppetmaster package, which sets up a system puppetmasterd service. puppetmaster depends on puppet to make use of some of the functionality available in the package.
But this means that the central host now has puppetd running, and is being configured through the system itself! While some people may prefer to configure their all-powerful central host through the same configuration management system, this presents a nasty potential failure mode: if the configuration management goes awry and makes the managed nodes inaccessible, it could potentially take itself out too.
Shouldn't the puppet tools be distinct from the puppetd system service?
Update: puppet 0.25.4-1 resolves this problem with a package re-factoring; the tools are in puppet-common, and the puppet package retains its old semantics of running the system service. Looks good to me!
The Monkeysphere is a framework for managing SSH authentication through the OpenPGP Web-of-Trust (i'm one of the authors). To ensure that the package interacts properly with the OpenSSH implementation, the monkeysphere source ships with a series of test suites that exercise both sshd and ssh.
This means that anyone trying to build the monkeysphere package must pull in openssh-server to satisfy the build-depends, thereby inadvertently starting up a potentially powerful network service on their build machine and maybe exposing it to remote access that they didn't intend.
Wouldn't it be better if the /usr/sbin/sshd tool was available without starting up the ssh system service?
Here are some examples of debian packaging that already understand and implement this distinction in some way:
Let's consider an existing foo package which currently provides:
I suggest that this should be split into two packages. foo-bin would contain the tool itself, and foo (which Depends: foo-bin) would contain the service configuration information, postinst scripts to set it up and start it, etc. This would mean that every instance of apt-get install foo in someone's notes would retain identical semantics to the past, but packages which need the tool (but not the service) can now depend on foo-bin instead, leaving the system with fewer resources consumed, and fewer unmanaged services running.
For brand new packages (which don't have to account for a legacy of documentation which says apt-get install foo), i prefer the naming convention that the foo package includes the tool itself (after all, it does provide /usr/sbin/foo), and foo-service sets up a standard system service configured and running (and depends on foo).
This proposal would fix the problems noted above, but it would also offer some nice additional benefits. For example, it would make it easier to introduce an alternate system initialization process by creating alternate service packages (while leaving the tool package alone). Things like runit-services could become actual contenders for managing the running services, without colliding with the "stock" services installed by the bundled tool+service package.
The ability to create alternate service packages would also mean that maintainers who prefer radically different configuration defaults could offer their service instantiations as distinct packages. For example, one system-wide foo daemon (foo-service) versus a separate instance of the foo daemon per user (foo-peruser-service) or triggering a daemon via inetd (foo-inetd-service).
One negative side effect is that it adds some level of increased load on the package maintainers — if the service package and the tool package both come from the same source package, then some work needs to be done to figure out how to split them. If the tool and service packages have separate sources (like vblade and vblade-persist) then some coordinating footwork needs to be done between the two packages when any incompatible changes happen.
Do you disagree with this proposal? If so, why? Unfortunately (to my mind), Debian has a long history of packages which conflate tools with services. Policy section 9.3.2 can even be read as deliberately blurring the line (though i'd argue that a cautious reading suggests that my proposal is not in opposition to policy):
Packages that include daemons for system services should place scripts in /etc/init.d to start or stop services at boot time or during a change of runlevel.
I feel like this particular conflict must have been hashed out before at some level — are there links to definitive discussion that i'm missing? Is there any reason we shouldn't push in general for this kind of distinction in debian daemon packages?
[ Parent | Reply to this comment ]
gitosis appears to provide only a tool, along with instructions about how to enable the service if you want it (see /usr/share/doc/gitosis/README.Debian). I could be mistaken, though, as i've never administered it.
gitweb (which i've also never administered) also appears to provide a tool itself (code that can provide human-readable HTML-based views into a git repository), but does not start up a service (beyond dropping a script in /usr/lib/cgi-bin); it expects the service to be configured by the admin's reasonable configuration of a web server, which is beyond the scope of the packages.
git-gui also does not provide a service in the sense that i describe in the original post -- i don't think it provides a system daemon at all, or even anything that could be used as a system daemon.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
When a new network-accessible service package is added to debian, do build chroots automatically get rc.policy fixes to disable that service?
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
A developer who wants to manually start the system service for her work but leave it generally disabled would install the service package (which Depends: on the tools package). Then she would instruct the system initialization system to not start the service automatically. For example, in recent versions of sysv-rc:
update-rc.d foo disableor in older versions of sysv-rc, something like:
update-rc.d foo stop 20 0 1 2 3 4 5 6She can now start and stop the system service as needed with /etc/init.d/foo [start|stop]. This particular use case has been solved on debian systems for many years.
The concern i raised above is about the use case where someone legitimately needs the tools, but has no plans or need to run the system service at all. We currently don't handle that situation well.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
I think it's in general a bad behavior of Debian to enable services by default and to re-enable and start them on updates.And i'm trying to point out that if you've disabled the services properly, i think it is a serious bug if they get re-enabled and restarted on updates. It should not happen, according to policy, from what i can tell.
If that happens to you, please report it and we can get it fixed. This is indeed a different issue than the one i'm raising, but it's worth fixing too.
[ Parent | Reply to this comment ]
Kudos to the puppet team for their packaging work!
[ Parent | Reply to this comment ]
I love this idea.
A few other, less obvious, examples:
[ Parent | Reply to this comment ]