Skip to content

Commit 801eefd

Browse files
authored
Merge pull request #155 from keszybz/libexec-not-recommend
Clearly mark parts of the hierarchy that are in-use but are not recommended.
2 parents 7b78073 + edad184 commit 801eefd

1 file changed

Lines changed: 39 additions & 25 deletions

File tree

specs/linux_file_system_hierarchy.md

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ Some directories like `/var/spool/` are not covered,
3434
even though it might make sense to include them
3535
in the structure of an actually deployed OS.
3636

37+
Some directories are described for compatibility with current Linux distributions,
38+
but their use is not recommended.
39+
The subsections that describe those directories are marked with ⚠️.
40+
3741
Many of the paths described here can be queried with the
3842
[`systemd-path(1)`](https://www.freedesktop.org/software/systemd/man/systemd-path.html)
3943
tool, on systems where this tool is available.
@@ -81,8 +85,8 @@ following the
8185
[Configuration Files Specification](configuration_files_specification.md).
8286

8387
If `/opt/` is supported (see below),
84-
then the `/etc/opt/` subdirectory is the location where third-party software installed in `/opt/` may store
85-
their configuration.
88+
then the `/etc/opt/` ⚠️ subdirectory is the location where
89+
third-party software installed in `/opt/` may store its configuration.
8690
The same naming convention as directories under `/opt/` is used for directories under `/etc/opt/`.
8791

8892
### `/home/`
@@ -98,15 +102,27 @@ Applications should generally not reference this directory directly,
98102
but via the per-user `$HOME` environment variable,
99103
or via the home directory field of the user database.
100104

101-
### `/opt/`
105+
### `/opt/` ⚠️
106+
107+
A secondary location for third-party vendor directories.
108+
This directory is optional,
109+
as not all systems allow installing third-party software.
102110

103-
The location for third-party vendor directories.
104-
Third-party vendors (i.e.: unrelated to the OS provider) use a directory,
111+
Each third-party vendor (i.e.: unrelated to the OS provider) may use a subdirectory,
105112
typically named after the vendor or the software, under this location.
106113
It is usually read-only, but this is not required.
107114
This directory should not be modified by the administrator,
108115
except when installing or removing third-party-supplied software.
109-
This directory is optional, as not all systems allow installing third-party software.
116+
117+
Using `/opt/` is not recommended.
118+
It is not integrated with the rest of the distribution:
119+
a package which uses `/opt/` may need to install
120+
binaries or links in `/usr/bin/`
121+
and other supplementary files,
122+
e.g. desktops files or manual pages,
123+
into their appropriate locations under `/usr`.
124+
Instead of using a subdirectory under `/opt/`,
125+
a third party vendor should put their directory under `/usr/lib/`.
110126

111127
### `/root/`
112128

@@ -162,12 +178,6 @@ Runtime system logs.
162178
System components may place private logs in this directory.
163179
Always writable, even when `/var/log/` might not be accessible yet.
164180

165-
### `/run/opt/`
166-
If `/opt/` is supported (see above),
167-
then the `/run/opt/` subdirectory is the location where third-party software installed in `/opt/` stores its
168-
runtime, variable data.
169-
The same naming convention as directories under `/opt/` is used for directories under `/run/opt/`.
170-
171181
### `/run/user/`
172182

173183
Contains per-user runtime directories,
@@ -229,18 +239,21 @@ Such binaries may be for any architecture supported by the system.
229239
Do not place public libraries in this directory,
230240
use `$libdir` (see below), instead.
231241

232-
### `/usr/libexec/`
242+
### `/usr/libexec/` ⚠️
233243

234-
Vendor binaries or other programs that are not regularly invoked from a shell.
235-
Such binaries may be for any architecture supported by the system.
244+
A secondary location for
245+
vendor binaries or other programs that are not regularly invoked from a shell
246+
that is used by some distributions.
247+
Packages may either place such programs
248+
in a subdirectory of `/usr/lib/`,
249+
directly in `/usr/libexec/`,
250+
or in a subdirectory of `/usr/libexec/` named after the package.
251+
The first option is the recommended approach.
252+
`/usr/libexec/` is used by some distributions,
253+
so it is mentioned here too,
254+
but its use is not encouraged.
236255

237-
Packages may either place such programs directly in `/usr/libexec/`,
238-
in a subdirectory of `/usr/libexec/` named after the package,
239-
or in some subdirectory of `/usr/lib/`.
240-
Using `/usr/libexec/` is better if the package only has a single such file,
241-
and a subdirectory under `/usr/lib/` is better if the package
242-
has other non-executable files and needs to have directory there anyway.
243-
This document does not mandate any specific choice.
256+
Binaries in `/usr/libexec/` may be for any architecture supported by the system.
244257

245258
### `/usr/lib/arch-id/`
246259

@@ -321,10 +334,11 @@ though it is recommended to do most logging via the
321334
[`sd_journal_print(3)`](https://www.freedesktop.org/software/systemd/man/sd_journal_print.html)
322335
calls.
323336

324-
### `/var/opt/`
337+
### `/var/opt/` ⚠️
338+
325339
If `/opt/` is supported (see above),
326-
then the `/var/opt/` subdirectory is the location where third-party software installed in `/opt/` stores its
327-
persistent, variable data.
340+
then the `/var/opt/` subdirectory is the location where third-party software installed in `/opt/`
341+
stores its persistent, variable data.
328342
The same naming convention as directories under `/opt/` is used for directories under `/var/opt/`.
329343

330344
### `/var/tmp/`

0 commit comments

Comments
 (0)