5.8. /var/lib : Variable state information

5.8.1. Purpose

This hierarchy holds state information pertaining to an application or the system. State information is data that programs modify while they run, and that pertains to one specific host. Users must never need to modify files in /var/lib to configure a package's operation, and the specific file hierarchy used to store the data must not be exposed to regular users. [40]

State information is generally used to preserve the condition of an application (or a group of inter-related applications) between invocations and between different instances of the same application. State information should generally remain valid after a reboot, should not be logging output, and should not be spooled data.

An application (or a group of inter-related applications) must use a subdirectory of /var/lib for its data. There is one required subdirectory, /var/lib/misc, which is intended for state files that don't need a subdirectory; the other subdirectories should only be present if the application in question is included in the distribution. [41]

/var/lib/<name> is the location that must be used for all distribution packaging support. Different distributions may use different names, of course.

5.8.2. Requirements

The following directories, or symbolic links to directories, are required in /var/lib:

DirectoryDescription
miscMiscellaneous state data

5.8.3. Specific Options

The following directories, or symbolic links to directories, must be in /var/lib, if the corresponding subsystem is installed:

DirectoryDescription
<editor>Editor backup files and state (optional)
<pkgtool>Packaging support files (optional)
<package>State data for packages and subsystems (optional)
colorColor management information (optional)
hwclockState directory for hwclock (optional)
xdmX display manager variable data (optional)

5.8.4. /var/lib/<editor> : Editor backup files and state (optional)

5.8.4.1. Purpose

These directories contain saved files generated by any unexpected termination of an editor (e.g., elvis, jove, nvi).

Other editors may not require a directory for crash-recovery files, but may require a well-defined place to store other information while the editor is running. This information should be stored in a subdirectory under /var/lib (for example, GNU Emacs would place lock files in /var/lib/emacs/lock).

Future editors may require additional state information beyond crash-recovery files and lock files — this information should also be placed under /var/lib/<editor>.

Rationale

Previous Linux releases, as well as all commercial vendors, use /var/preserve for vi or its clones. However, each editor uses its own format for these crash-recovery files, so a separate directory is needed for each editor.

Editor-specific lock files are usually quite different from the device or resource lock files that are stored in /var/lock and, hence, are stored under /var/lib.

5.8.5. /var/lib/color : Color management information (optional)

5.8.5.1. Purpose

This directory is the home for ICC color management files installed dynamically. This directory shall be laid out using the same rules as the /usr/share/color directory.

5.8.6. /var/lib/hwclock : State directory for hwclock (optional)

5.8.6.1. Purpose

This directory contains the file /var/lib/hwclock/adjtime.

Rationale

In FHS 2.1, this file was /etc/adjtime, but as hwclock updates it, that was obviously incorrect.

5.8.7. /var/lib/misc : Miscellaneous variable data

5.8.7.1. Purpose

This directory contains variable data not placed in a subdirectory in /var/lib. An attempt should be made to use relatively unique names in this directory to avoid namespace conflicts. [42]



[40] Data with exposed filesystem structure should be stored in /srv.

[41] An important difference between this version of this standard and previous ones is that applications are now required to use a subdirectory of /var/lib.

[42] This hierarchy should contain files stored in /var/db in current BSD releases. These include locate.database and mountdtab, and the kernel symbol database(s).