Empty /etc and /var
Summary
To ease the provisioning of OS and container images, the goal is to be able to start the system with an empty /etc and /var. rpm packages should/must not ship any files in /etc and /var.
Detailed Description
/etc
Starting with udev, systemd, kmod (modprobe), and dracut, tools read their configuration data from different places, where files with the same name overwrite files from previous directories. These directories mostly follow the naming convention:
- /usr/lib/<packagename>/
- /run/<packagename>/
- /etc/<packagename>/
The application ships with files in /usr/lib/<packagename>/. Dynamic runtime configuration is done via /run/<packagename>, which ensures, that these files don't persist over a reboot. The administrator can customize the behavior in /etc/<packagename>, overwriting any defaults. It is encouraged to compile in sane default values, so that /usr/lib/<packagename>/ is normally not needed.
This model ensures that with an empty /etc the OS starts with sane default values.
/var
To populate contents in an empty /var:
- use systemd-tmpfiles ( see tmpfiles.d(5) ) to create the necessary directories with the correct permissions and owner
- copy over default files from /usr/lib/<packagename>/ to /var, if the directory is empty