nixpkgs/nixos/modules/system
Will Fancher 5d6ea734a1 systemd stage 1 networking: Stop systemd-networkd on switch-root
This essentially backports
https://github.com/systemd/systemd/pull/27791. `systemd-networkd.service`
is sent the `SIGTERM` signal, but it is not required to be stopped
before `initrd-switch-root.target` is reached, despite the use of
`systemctl isolate initrd-switch-root.target`. This is because when
there is no ordering at all between two units, and a transaction stops
one and starts the other, the two operations can happen
simultaneously. This means the service could still be running when
`switch-root` actually occurs. Then, stage 2 systemd will see the
service still running and decide it doesn't need to add a start
operation for it to its initial transaction. Finally, the service
exits, but only after it's already too late. If, however, there is any
ordering at all between a stopping unit and a starting unit, then the
stop operation will be done first. This way, we ensure that the
service is properly exited before doing `switch-root`.

This is something to keep in mind going forward. There may be other
services that need this treatment. These `before` and `conflicts`
definitions are the correct way to ensure a unit is actually stopped
before you reach initrd-switch-root
2023-06-08 00:25:15 -04:00
..
activation nixos: use passAsFile to avoid "Argument list too long" error 2023-05-19 22:31:31 +02:00
boot systemd stage 1 networking: Stop systemd-networkd on switch-root 2023-06-08 00:25:15 -04:00
etc nixos/etc: skip resolv.conf in nixos-enter chroot 2023-01-02 01:41:29 +01:00
build.nix treewide: automatically md-convert option descriptions 2022-07-30 15:16:34 +02:00