On Friday 2023-08-11 18:40, Franck Bui wrote:
Basically the daemons parse first their "main" configuration file (e.g /etc/systemd/system.conf for PID1) and then read and apply the optional drop-in files located in the following directories:
/usr/lib/systemd/*.conf.d/ /usr/local/lib/systemd/*.conf.d/ /run/systemd/*.conf.d/ /etc/systemd/*.conf.d/
There were various discussions [1] about addressing this concern but at the end upstream preferred keeping the existing logic. [1] https://github.com/systemd/systemd/pull/17161
The reasoning there in [1] is sound; it's all getting too complicated and it is best to stick to just fragments (drop-ins). The use of "early config" files that you proposed makes it even harder. How about an alternate proposal: * Remember the "priority" where the main config file was found; /usr (low), /run (medium), /etc (high) * _Only_ read drop-ins from locations with same-or-higher priority. IOW, * if /usr/xx.conf was used, read fragments from /usr/xx.d,/run/xx.d,/etc/xx.d * if /run/xx.conf was used, read fragments from /run/xx.d,/etc/xx.d * if /etc/xx.conf was used, read fragments from /etc/xx.d (This is _also_ not backwards-compatible obviously, but at least it's better than reading /usr/xx.d at unexpected times.)