On Mo, 09.10.23 12:07, Tony Rodriguez (unixpro1970@xxxxxxxxx) wrote: > Created a service that invokes a "systemctl daemon-reload". Goal is for a > reload to occur early in the boot process, before other user made services > are invoked. During additional testing, sometimes it is correct and other > times it is out of order (incorrect - See steps C). It may work for 5 or 6 > times after each reboot/shutdown, then randomly become incorrect. How can I > make this more consistent? Already tried various keyword combinations > (wants,before,after, etc) within the unit file, all without luck. > Thought about something like "After=var.mount, etc" as well, but that is > inflexible because I will not know filesystems users may create. > > A) Unit file > > [Unit] > Description=Systemctl-Reload > Wants=local-fs.target > DefaultDependencies=yes > > [Service] > Type=oneshot > RemainAfterExit=yes > ExecStart=/bin/systemctl daemon-reload > > [Install] > WantedBy=local-fs.target > > B) Correct order: ** Reached target Local File Systems is after all > mounting is done. Sometimes it works. You have not defined any order in the unit file. i.e. not After= nor Before=. Hence it's going to be executed as quickly as possible during boot. See docs: https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before= Generally though it's recommended not to reload PID 1 configuration during the initial transaction if avoidable. Better approaches are to put together generators or so, which can augment the set of units and their dependencies already when the first transaction is put together. https://www.freedesktop.org/software/systemd/man/systemd.generator.html Lennart -- Lennart Poettering, Berlin