steps to reproduce:

  1. issue

     cd /usr/portage && grep -R "systemd_dounit" *
  2. open several ebuilds and read them

almost all ebuilds use systemd_dounit without checking for systemd USE-flag first.

Flags are descried here:
systemd.eclass is described here:

and no, code of function doesn't have checks either:

# @FUNCTION: systemd_dounit
# @USAGE: <unit>...
# Install systemd unit(s). Uses doins, thus it is fatal in EAPI 4
# and non-fatal in earlier EAPIs.
systemd_dounit() {
    debug-print-function ${FUNCNAME} "${@}"

        insinto "$(_systemd_get_unitdir)"
        doins "${@}"
  • 1
    This behavior is controlled by the systemd USE Flag, The USE Flag controls what init system the system you've built is using. This flag is also universally set, i.e. inherited using a profile that contains the word systemd. Use eselect profiles list to see those available. Pre EAPI 4 builds did not differentiate between init systems, therefore as a work around, the ebuild installs for both. This behavior carried over, as Gentoo does not force you to use one init system over the other. – eyoung100 Jul 17 '15 at 21:56
  • 1
    EAPI=4 contains strange behavior in regards to doins and symlinks which is why it's broken. The split between init systems amd the adoption of separate USE Flags occurred around the time EAPI 5 was adopted. See EAPI Usage and Description – eyoung100 Jul 17 '15 at 22:01

Because the Gentoo developer community thinks it's no problem installing those files unconditionally, as long as the systemd dependency is not pulled in. And you can prevent that with INSTALL_MASK=/usr/lib/systemd in your make.conf (see man 5 make.conf).

  • This answer more appropriately matches my comments +1 and thanks. – eyoung100 Jul 20 '15 at 16:44

IUSE is needed only if you actually reference that USE flag in the ebuild.

In the few ebuilds I checked they don't use the systemd USE flag and just blindly install systemd service definitions in /usr/lib/systemd/system/, just as they blindly install the OpenRC init scripts without checking for the openrc USE flag.

The systemd (and openrc) USE flags are used in ebuilds where the init system makes a material difference, not whether to install a service or init script.

  • so, gentoo has a fundamental flaw - it spams my system with unnecessary files, because there is no possibility to reinstall without recompilation? – dh3x25bd1f Jul 17 '15 at 21:09
  • 2
    More info for your reading displeasure: wiki.gentoo.org/wiki/Project:Systemd/Ebuild_policy - General guidelines #4. Funtoo discussion: bugs.funtoo.org/browse/FL-2091 – Mark Wagner Jul 17 '15 at 21:53
  • @dh3x25bd1f Storage space is essentially free.If installing such files (systemd unit, openrc init, zsh completion, …) unconditionally is a flaw, is merely a matter of personal opinion (and one of the longstanding discussion within the gentoo community). If you don't want systemd files, you can put INSTALL_MASK=/usr/lib/systemd in your make.conf (see man 5 make.conf). – Flow Jul 18 '15 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.