[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /run vs /var/run

Anthony Towns:
> Sorry, I was paraphrasing above. The actual definition is "Essential
> shared libraries and kernel modules", and "The /lib directory contains
> those shared library images needed to boot the system and run the
> commands in the root filesystem, ie. by binaries in /bin and /sbin."
> Shared library image seems a pretty clear reference to .so files, and
> binaries is usually used to talk about ELF executables as opposed to
> scripts ("executables" being the general term).
> /lib is the right place for the above, and the FHS's too-limited
> definition is wrong. To my mind, /lib also seems the right place for a
> /run directory.
> Note the definition for /usr/lib is "Libraries for programming and
> packages" and "/usr/lib includes object files, libraries, and internal
> binaries that are not intended to be executed directly by users or
> shell scripts." and /var/lib is "Variable state information" and "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."
> Combining these two, and adding the "...needed to boot the system"
> qualifier seems like it would perfectly cover the above requirements
> and /run.

Let me see if I have understood the argument.  Let's call the new
directory 'R' for now.

<attempt to paraphrase>
   /lib is, like R, a directory required for programs needed
   to boot the system and run commands in the root filesystem;
   and /var/lib is, like R, a place where data is stored.
   We just heard "lib" twice!  So /lib is the right place for R.
</attempt to paraphrase>

I don't think that an argument from the meaning of "lib" can get
much traction because /lib, /usr/lib and /var/lib are so different.
(I'll guess that these differences are there because:
* /usr/lib contained both application code and application data
  in the old days;
* When application data was removed from /usr/lib it was placed
  in /var/lib, which missed the opportunity to choose a more
  appropriate name such as '/var/data';
* When /usr/share was split out of /usr/lib, no /share was split
  out of /lib.  So whereas scripts can be kept out of /usr/lib,
  they can't be kept out of /lib because there is no better
  place to put them if they have to be on the root filesystem.)

But there are problems with this particular argument as I have
paraphrased it (probably distorting it).  First, if we accept the
reasoning steps then the conclusion ought to be that the right value
for R is "/lib/lib".  What went wrong?  Well, first, we missed the
fact that /lib isn't the only directory required for programs needed
to boot the system and run commands on the root filesystem; /sbin
and /bin and sometimes other top-level directories are also required.
So if we add _another_ directory with the same supporting role as
them then it should be, like them, in the root directory.  Hence R
should be /<something>.  Second, we missed the fact that the
function of R is more analogous to /var/run than to /var/lib, and so
should have a basename of 'run' rather than 'lib'.  Hence R should
be /run.

Briefly, if R is like /var/run except that it supports programs
needed to boot the system and run commands on the root filesystem,
then it should be another "run" directory, but at the top level.

Here's another possible argument:

   Putting R in /lib spoils the otherwise read-only
   character of that directory.

Thomas Hood

Reply to: