From 03f2b38e0c44343277f90c5fe761db5696ce52ba Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 May 2018 16:54:32 +0200 Subject: [PATCH 1/3] man: document the XDG specs as further sources of specifications for file-hierarchy(7) We document this further down in the text, but let's also list this early on, where we mention the FHS as major influence too, so that it is clear we incorporate all that thinking. --- man/file-hierarchy.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index 37cb2002d4..f41039b964 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -40,16 +40,16 @@ Description Operating systems using the - systemd1 - system and service manager are organized based on a file system - hierarchy inspired by UNIX, more specifically the hierarchy - described in the File - System Hierarchy specification and - hier7. - This manual page describes a more minimal, modernized subset of - these specifications that defines more strictly the suggestions - and restrictions systemd makes on the file system + systemd1 system and service + manager are organized based on a file system hierarchy inspired by UNIX, more specifically the hierarchy described + in the File System Hierarchy + specification and hier7, with various + extensions, partially documented in the XDG Base Directory + Specification and XDG User + Directories. This manual page describes a more generalized, though minimal and modernized subset of these + specifications that defines more strictly the suggestions and restrictions systemd makes on the file system hierarchy. Many of the paths described here can be queried From 1dc7ca9912bbed8ad2d63b15cfc77d1cd620b149 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 May 2018 16:55:37 +0200 Subject: [PATCH 2/3] man: document /efi in file-hiearchy(7) We have been supporting the directory since a while in the gpt generator, let's document it in file-hierarchy(7) too --- man/file-hierarchy.xml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index f41039b964..a0ceb40db8 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -74,7 +74,7 @@ /boot The boot partition used for bringing up the system. On EFI systems, this is possibly the EFI System - Partition, also see + Partition (ESP), also see systemd-gpt-auto-generator8. This directory is usually strictly local to the host, and should be considered read-only, except when a new kernel or @@ -83,6 +83,15 @@ requires boot loaders. + + /efi/ + If the boot partition /boot/ is maintained separately from the EFI System + Partition (ESP), the latter is mounted here. Tools that need to operate on the EFI system partition should look + for it at this mount point first, and fall back to /boot/ — if the former doesn't qualify + (for example if it is not a mount point or does not have the correct file system type + MSDOS_SUPER_MAGIC). + + /etc System-specific configuration. This directory From 5eb5f352679d43a1c6bdece864e87f0e34ccf706 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 2 May 2018 17:00:30 +0200 Subject: [PATCH 3/3] man: suffix all dir paths in file-hierarchy(7) with "/" Our CODING_STYLE document suggests to suffix all paths referring to dirs rather than regular files with a "/" in our docs and log messages. Update file-hierarchy(7) to do just that. No other changes. --- man/file-hierarchy.xml | 190 ++++++++++++++++++++--------------------- 1 file changed, 95 insertions(+), 95 deletions(-) diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml index a0ceb40db8..c5ee1b61a2 100644 --- a/man/file-hierarchy.xml +++ b/man/file-hierarchy.xml @@ -71,7 +71,7 @@ - /boot + /boot/ The boot partition used for bringing up the system. On EFI systems, this is possibly the EFI System Partition (ESP), also see @@ -93,7 +93,7 @@ - /etc + /etc/ System-specific configuration. This directory may or may not be read-only. Frequently, this directory is pre-populated with vendor-supplied configuration files, but @@ -104,7 +104,7 @@ - /home + /home/ The location for normal user's home directories. Possibly shared with other systems, and never read-only. This directory should only be used for normal @@ -121,16 +121,16 @@ - /root + /root/ The home directory of the root user. The root user's home directory is located outside of - /home in order to make sure the root user - may log in even without /home being + /home/ in order to make sure the root user + may log in even without /home/ being available and mounted. - /srv + /srv/ The place to store general server payload, managed by the administrator. No restrictions are made how this directory is organized internally. Generally writable, @@ -140,11 +140,11 @@ - /tmp + /tmp/ The place for small temporary files. This directory is usually mounted as a tmpfs instance, and should hence not be used for larger files. (Use - /var/tmp for larger files.) Since the + /var/tmp/ for larger files.) Since the directory is accessible to other users of the system, it is essential that this directory is only written to with the mkstemp3, @@ -154,7 +154,7 @@ time are usually automatically deleted. If applications find the environment variable $TMPDIR set, they should prefer using the directory specified in it over - directly referencing /tmp (see + directly referencing /tmp/ (see environ7 and IEEE @@ -169,7 +169,7 @@ - /run + /run/ A tmpfs file system for system packages to place runtime data in. This directory is flushed on boot, and generally writable for privileged @@ -177,15 +177,15 @@ - /run/log + /run/log/ Runtime system logs. System components may place private logs in this directory. Always writable, even - when /var/log might not be accessible + when /var/log/ might not be accessible yet. - /run/user + /run/user/ Contains per-user runtime directories, each usually individually mounted tmpfs instances. Always writable, flushed at each reboot and when @@ -205,7 +205,7 @@ - /usr + /usr/ Vendor-supplied operating system resources. Usually read-only, but this is not required. Possibly shared between multiple hosts. This directory should not be modified @@ -214,23 +214,23 @@ - /usr/bin + /usr/bin/ Binaries and executables for user commands that shall appear in the $PATH search path. It is recommended not to place binaries in this directory that are not useful for invocation from a shell (such as daemon binaries); these should be placed in a subdirectory of - /usr/lib instead. + /usr/lib/ instead. - /usr/include + /usr/include/ C and C++ API header files of system libraries. - /usr/lib + /usr/lib/ Static, private vendor data that is compatible with all architectures (though not necessarily architecture-independent). Note that this includes internal @@ -242,15 +242,15 @@ - /usr/lib/arch-id + /usr/lib/arch-id/ Location for placing dynamic libraries into, also called $libdir. The architecture identifier to use is defined on Multiarch Architecture Specifiers (Tuples) list. Legacy locations of $libdir are - /usr/lib, - /usr/lib64. This directory should not be + /usr/lib/, + /usr/lib64/. This directory should not be used for package-specific data, unless this data is architecture-dependent, too. To query $libdir for the primary architecture of the @@ -260,7 +260,7 @@ - /usr/share + /usr/share/ Resources shared between multiple packages, such as documentation, man pages, time zone information, fonts and other resources. Usually, the precise location and format @@ -269,29 +269,29 @@ - /usr/share/doc + /usr/share/doc/ Documentation for the operating system or system packages. - /usr/share/factory/etc + /usr/share/factory/etc/ Repository for vendor-supplied default configuration files. This directory should be populated with pristine vendor versions of all configuration files that may - be placed in /etc. This is useful to + be placed in /etc/. This is useful to compare the local configuration of a system with vendor defaults and to populate the local configuration with defaults. - /usr/share/factory/var + /usr/share/factory/var/ Similar to - /usr/share/factory/etc, but for vendor + /usr/share/factory/etc/, but for vendor versions of files in the variable, persistent data directory - /var. + /var/. @@ -302,7 +302,7 @@ - /var + /var/ Persistent, variable system data. Must be writable. This directory might be pre-populated with vendor-supplied data, but applications should be able to @@ -317,7 +317,7 @@ - /var/cache + /var/cache/ Persistent system cache data. System components may place non-essential data in this directory. Flushing this directory should have no effect on operation of @@ -326,13 +326,13 @@ - /var/lib + /var/lib/ Persistent system data. System components may place private data in this directory. - /var/log + /var/log/ Persistent system logs. System components may place private logs in this directory, though it is recommended to do most logging via the @@ -343,21 +343,21 @@ - /var/spool + /var/spool/ Persistent system spool data, such as printer or mail queues. - /var/tmp + /var/tmp/ The place for larger and persistent temporary - files. In contrast to /tmp, this directory + files. In contrast to /tmp/, this directory is usually mounted from a persistent physical file system and - can thus accept larger files. (Use /tmp + can thus accept larger files. (Use /tmp/ for smaller files.) This directory is generally not flushed at boot-up, but time-based cleanup of files that have not been accessed for a certain time is applied. The same security - restrictions as with /tmp apply, and + restrictions as with /tmp/ apply, and hence only mkstemp3, mkdtemp3 @@ -365,7 +365,7 @@ If applications find the environment variable $TMPDIR set, they should prefer using the directory specified in it over directly referencing - /var/tmp (see + /var/tmp/ (see environ7 for details). @@ -378,7 +378,7 @@ - /dev + /dev/ The root directory for device nodes. Usually, this directory is mounted as a devtmpfs instance, but might be of a different type in @@ -391,7 +391,7 @@ - /dev/shm + /dev/shm/ Place for POSIX shared memory segments, as created via shm_open3. @@ -401,7 +401,7 @@ to avoid name clashes and vulnerabilities. For normal users, shared memory segments in this directory are usually deleted when the user logs out. Usually, it is a better idea to use - memory mapped files in /run (for system + memory mapped files in /run/ (for system programs) or $XDG_RUNTIME_DIR (for user programs) instead of POSIX shared memory segments, since these directories are not world-writable and hence not vulnerable to @@ -409,7 +409,7 @@ - /proc + /proc/ A virtual kernel file system exposing the process list and other functionality. This file system is mostly an API to interface with the kernel and not a place @@ -420,8 +420,8 @@ - /proc/sys - A hierarchy below /proc + /proc/sys/ + A hierarchy below /proc/ that exposes a number of kernel tunables. The primary way to configure the settings in this API file tree is via sysctl.d5 @@ -430,7 +430,7 @@ - /sys + /sys/ A virtual kernel file system exposing discovered devices and other functionality. This file system is mostly an API to interface with the kernel and not a place @@ -448,27 +448,27 @@ - /bin - /sbin - /usr/sbin + /bin/ + /sbin/ + /usr/sbin/ These compatibility symlinks point to - /usr/bin, ensuring that scripts and + /usr/bin/, ensuring that scripts and binaries referencing these legacy paths correctly find their binaries. - /lib + /lib/ This compatibility symlink points to - /usr/lib, ensuring that programs + /usr/lib/, ensuring that programs referencing this legacy path correctly find their resources. - /lib64 + /lib64/ On some architecture ABIs, this compatibility symlink points to $libdir, ensuring that @@ -479,10 +479,10 @@ - /var/run + /var/run/ This compatibility symlink points to - /run, ensuring that programs referencing + /run/, ensuring that programs referencing this legacy path correctly find their runtime data. @@ -504,7 +504,7 @@ - ~/.cache + ~/.cache/ Persistent user cache data. User programs may place non-essential data in this directory. Flushing this @@ -517,7 +517,7 @@ - ~/.config + ~/.config/ Application configuration and state. When a new user is created, this directory will be empty or not exist @@ -529,13 +529,13 @@ - ~/.local/bin + ~/.local/bin/ Executables that shall appear in the user's $PATH search path. It is recommended not to place executables in this directory that are not useful for invocation from a shell; these should be placed in a - subdirectory of ~/.local/lib instead. + subdirectory of ~/.local/lib/ instead. Care should be taken when placing architecture-dependent binaries in this place, which might be problematic if the home directory is shared between multiple hosts with different @@ -543,14 +543,14 @@ - ~/.local/lib + ~/.local/lib/ Static, private vendor data that is compatible with all architectures. - ~/.local/lib/arch-id + ~/.local/lib/arch-id/ Location for placing public dynamic libraries. The architecture identifier to use is defined on - ~/.local/share + ~/.local/share/ Resources shared between multiple packages, such as fonts or artwork. Usually, the precise location and @@ -581,21 +581,21 @@ of the hierarchy. The exceptions for normal users are - /tmp, - /var/tmp, - /dev/shm, as well as the home directory + /tmp/, + /var/tmp/, + /dev/shm/, as well as the home directory $HOME (usually found below - /home) and the runtime directory + /home/) and the runtime directory $XDG_RUNTIME_DIR (found below - /run/user) of the user, which are all + /run/user/) of the user, which are all writable. For unprivileged system processes, only - /tmp, - /var/tmp and - /dev/shm are writable. If an + /tmp/, + /var/tmp/ and + /dev/shm/ are writable. If an unprivileged system process needs a private writable directory in - /var or /run, it is + /var/ or /run/, it is recommended to either create it before dropping privileges in the daemon code, to create it via tmpfiles.d5 @@ -613,9 +613,9 @@ including regular files, directories, symlinks, character and block device nodes, sockets and FIFOs. - It is strongly recommended that /dev is + It is strongly recommended that /dev/ is the only location below which device nodes shall be placed. - Similarly, /run shall be the only location to + Similarly, /run/ shall be the only location to place sockets and FIFOs. Regular files, directories and symlinks may be used in all directories. @@ -641,23 +641,23 @@ - /usr/bin + /usr/bin/ Package executables that shall appear in the $PATH executable search path, compiled for any of the supported architectures compatible with the operating system. It is not recommended to place internal binaries or binaries that are not commonly invoked from the shell in this directory, such as daemon binaries. As this directory is shared with most other packages of the system, special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files. - /usr/lib/arch-id + /usr/lib/arch-id/ Public shared libraries of the package. As above, be careful with using too generic names, and pick unique names for your libraries to place here to avoid name clashes. - /usr/lib/package + /usr/lib/package/ Private static vendor resources of the package, including private binaries and libraries, or any other kind of read-only vendor data. - /usr/lib/arch-id/package + /usr/lib/arch-id/package/ Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures. Note that this generally does not include private executables since binaries of a specific architecture may be freely invoked from any other supported system architecture. - /usr/include/package + /usr/include/package/ Public C/C++ APIs of public shared libraries of the package. @@ -665,7 +665,7 @@ Additional static vendor files may be installed in the - /usr/share hierarchy to the locations + /usr/share/ hierarchy to the locations defined by the various relevant specifications. During runtime, and for local configuration and state, @@ -684,31 +684,31 @@ - /etc/package - System-specific configuration for the package. It is recommended to default to safe fallbacks if this configuration is missing, if this is possible. Alternatively, a tmpfiles.d5 fragment may be used to copy or symlink the necessary files and directories from /usr/share/factory during boot, via the L or C directives. + /etc/package/ + System-specific configuration for the package. It is recommended to default to safe fallbacks if this configuration is missing, if this is possible. Alternatively, a tmpfiles.d5 fragment may be used to copy or symlink the necessary files and directories from /usr/share/factory/ during boot, via the L or C directives. - /run/package + /run/package/ Runtime data for the package. Packages must be able to create the necessary subdirectories in this tree on their own, since the directory is flushed automatically on boot. Alternatively, a tmpfiles.d5 fragment may be used to create the necessary directories during boot, or the RuntimeDirectory= directive of service units may be used to create them at service startup (see systemd.unit5 for details). - /run/log/package + /run/log/package/ Runtime log data for the package. As above, the package needs to make sure to create this directory if necessary, as it will be flushed on every boot. - /var/cache/package + /var/cache/package/ Persistent cache data of the package. If this directory is flushed, the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary. To create an empty directory, a tmpfiles.d5 fragment or the CacheDirectory= directive of service units (see systemd.unit5) may be used. - /var/lib/package + /var/lib/package/ Persistent private data of the package. This is the primary place to put persistent data that does not fall into the other categories listed. Packages should be able to create the necessary subdirectories in this tree on their own, since the directory might be missing on boot. To create an empty directory, a tmpfiles.d5 fragment or the StateDirectory= directive of service units (see systemd.unit5) may be used. - /var/log/package + /var/log/package/ Persistent log data of the package. As above, the package should make sure to create this directory if necessary, possibly using tmpfiles.d5 or LogsDirectory= (see systemd.unit5), as it might be missing. - /var/spool/package + /var/spool/package/ Persistent spool/queue data of the package. As above, the package should make sure to create this directory if necessary, as it might be missing. @@ -740,19 +740,19 @@ - ~/.local/bin + ~/.local/bin/ Package executables that shall appear in the $PATH executable search path. It is not recommended to place internal executables or executables that are not commonly invoked from the shell in this directory, such as daemon executables. As this directory is shared with most other packages of the user, special care should be taken to pick unique names for files placed here, that are unlikely to clash with other package's files. - ~/.local/lib/arch-id + ~/.local/lib/arch-id/ Public shared libraries of the package. As above, be careful with using too generic names, and pick unique names for your libraries to place here to avoid name clashes. - ~/.local/lib/package + ~/.local/lib/package/ Private, static vendor resources of the package, compatible with any architecture, or any other kind of read-only vendor data. - ~/.local/lib/arch-id/package + ~/.local/lib/arch-id/package/ Private other vendor resources of the package that are architecture-specific and cannot be shared between architectures. @@ -760,7 +760,7 @@ Additional static vendor files may be installed in the - ~/.local/share hierarchy to the locations + ~/.local/share/ hierarchy to the locations defined by the various relevant specifications. During runtime, and for local configuration and state, @@ -779,15 +779,15 @@ - ~/.config/package + ~/.config/package/ User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing. - $XDG_RUNTIME_DIR/package + $XDG_RUNTIME_DIR/package/ User runtime data for the package. - ~/.cache/package + ~/.cache/package/ Persistent cache data of the package. If this directory is flushed, the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary.