In most operating systems, user data, system data, and configuration files can become intermingled.
Clear Linux* OS has a stateless design philosophy with the goal to provide an OS that functions without excessive user configuration or customization. Stateless in this context does not mean ephemeral or non-persistent.
To accomplish a stateless design the Linux Filesystem Hierarchy is separated between user-owned areas and Clear Linux OS-owned areas.
File under the
/usr directory are managed by Clear Linux OS as system files.
Files written under the
/usr directory by users can get removed
through system updates with swupd. This operating
assumption allows Clear Linux OS to verify and maintain integrity of system files.
Files under the
/var directories are
owned and managed by the user. A freshly installed Clear Linux OS system will only have
a minimal set of files in the
/etc/ directory and software installed
by Clear Linux OS does not write to
/etc. This operating assumption allows Clear Linux OS
users to clearly identify the configuration that makes their system unique.
With stateless separation, default software configurations are read in order from predefined source code, Clear Linux OS provided defaults, and user-provided configuration.
Software in Clear Linux OS provides default configuration values so that it is immediately functional, whenever it is appropriate to do so.
Clear Linux OS distributed software packages may be directly modified to include default
configuration values or default configuration files may be provided by Clear Linux OS
/usr/share/defaults. These files can be referenced as templates
For example, the default configuration that Apache uses when installed can be
If a configuration needs to be changed, the appropriate file should be
modified by the user under
/etc/. If the configuration file does not
already exist, it can be created in the appropriate location.
User defined configuration files should contain the minimal set of desired changes and rely on default configuration for the rest.
For example, a customized Apache configuration can be used instead by:
Create the destination directory for the configuration:
sudo mkdir /etc/httpd
Copy the default configuration as a reference template:
sudo cp /usr/share/defaults/httpd/httpd.conf /etc/httpd/
Make any desired modifications to the configurations:
Reload the service or reboot the system to pickup any changes:
systemctl daemon-reload httpd && systemctl restart httpd
This pattern can be used to modify the configurations of other programs too. The stateless man page has application-specific examples.
Once advantage of the stateless design is that the system defaults can be
easily restored by simply deleting everything under
Running the commands below effectively performs a system reset as if it was just installed:
sudo rm -rf /etc sudo rm -rf /var
In other Linux distributions, this can be a catastrophic action that renders a system unable to boot.