[Nix-dev] multi-user.target must not be After network.target
Luca Bruno
lethalman88 at gmail.com
Tue Jun 30 18:02:28 CEST 2015
The multi-user.target must be kept slim, network should not be a
prerequisite.
I find my server system to have systemctl show multi-user.target|grep After:
After=nix-daemon.socket basic.target rescue.service rescue.target
swap.target nss-user-lookup.target nss-lookup.target network.target
sshd.service [various other services] systemd-user-sessions.service
systemd-logind.service getty.target
AFAIK fedora does not have network.target in After for
multi-user.target. Neither systemd show network in any of the bootup
diagrams. If anything goes wrong in the networking phase, the system
might become unbootable. Whether networking works or not, the multi-user
init should not depend on networking.
There are two questions we should answer when writing services:
1. Is it good to run X before multi-user? Yes.
2. Is it necessary to run X before multi-user? No.
Choose the latter. Is it necessary to run network before multi-user? No,
in most cases.
If you have any case where it's really necessary, please explain here,
otherwise I will go deep in eliminating this hard dependency.
Where can this be a problem? Let's say there's a oneshot service that is
After network and Before multi-user. Because by default oneshot services
have no timeouts, if the script fails your system will not boot.
Best regards,
More information about the nix-dev
mailing list