From Fedora Project Wiki

< User:Harald

Revision as of 08:12, 7 May 2014 by Harald (talk | contribs) (→‎/etc)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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/<packageconfdir>/
  • /run/<packageconfdir>/
  • /etc/<packageconfdir>/

The application ships with files in /usr/lib/<packageconfdir>/. Dynamic runtime configuration is done via /run/<packageconfdir>, which ensures, that these files don't persist over a reboot. The administrator can customize the behavior in /etc/<packageconfdir>, overwriting any defaults. It is encouraged to compile in sane default values, so that /usr/lib/<packageconfdir>/ 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. For this step, there will be tools created to generalize the process, most likely part of the systemd infrastructure.