Skip to content

order, implicitly added by sysinit.target, between normal units and almost all sysinit units is ignored by nixos-rebuild switch (or test) #334017

Open
@jian-lin

Description

@jian-lin

Describe the bug

Quoting the excellent NixOS manual as context:

sysinit.target is a systemd target that encodes system initialization (i.e. early startup). A few units that need to run very early in the bootup process are ordered to finish before this target is reached. Probably the most notable one of these is systemd-tmpfiles-setup.service. We will refer to these units as "sysinit units".

"Normal" systemd units, by default, are ordered AFTER sysinit.target. In other words, these "normal" units expect all services ordered before sysinit.target to have finished without explicitly declaring this dependency relationship for each dependency. See the systemd bootup for more details on the bootup process.

When restarting both a unit ordered before sysinit.target as well as one after, this presents a problem because they would be started at the same time as they do not explicitly declare their dependency relations.

To solve this, NixOS has an artificial sysinit-reactivation.target which allows you to ensure that services ordered before sysinit.target are restarted correctly. This applies both to the ordering between these sysinit services as well as ensuring that sysinit units are restarted before "normal" units.

Currently, sysinit-reactivation.target ignores almost all sysinit units except systemd-tmpfiles-resetup.service (systemd-tmpfiles-setup.service):

> systemctl list-dependencies sysinit-reactivation.target --after
sysinit-reactivation.target
● └─systemd-tmpfiles-resetup.service

This means order, implicitly added by sysinit.target, between normal units and almost all sysinit units is ignored by nixos-rebuild switch (or test).

Steps To Reproduce

Issues caused by this:

Expected behavior

Order, implicitly added by sysinit.target, between normal units and all sysinit units is not ignored by nixos-rebuild switch (or test).

Additional context

While a general fix is preferred, there are some efforts to fix this case by case:

Notify maintainers

@NixOS/systemd @nikstur


Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions