From Fedora Project Wiki
(Created page with "= 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 packag...")
 
 
(2 intermediate revisions by the same user not shown)
Line 35: Line 35:
=== /etc ===
=== /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:
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>/
* /usr/lib/<packageconfdir>/
* /run/<packagename>/
* /run/<packageconfdir>/
* /etc/<packagename>/
* /etc/<packageconfdir>/


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.
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/<packagename>/ is normally not needed.
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.
This model ensures that with an empty /etc the OS starts with sane default values.
Line 48: Line 48:
To populate contents in an empty /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
* 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
* 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.


<!--
<!--
Line 95: Line 95:
<!-- * Blocks release? N/A (not a System Wide Change), Yes/No
<!-- * Blocks release? N/A (not a System Wide Change), Yes/No
-->
-->
<!--
== Documentation ==
== Documentation ==


<!--
 
== Release Notes == -->
== Release Notes == -->
<!-- The Fedora Release Notes inform end-users about what is new in the release.  Examples of past release notes are here: http://docs.fedoraproject.org/release-notes/ -->
<!-- The Fedora Release Notes inform end-users about what is new in the release.  Examples of past release notes are here: http://docs.fedoraproject.org/release-notes/ -->

Latest revision as of 08:12, 7 May 2014

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.