FHS 3.0 – Where to Store Shared Data in FHS 3.0

directory-structurefhs

I'm working on a FHS2-conforming application that used to store data in $sharedstatedir (i.e. $(prefix)/com, e.g. /usr/local/com).

This directory is no more in FHS 3.0, and it seems that we need to start using either

  • /var/lib, which should store

    Variable state information

    or more verbosely,

    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.

    or

  • /var/local, which should store

    Variable data for /usr/local

    (No more information is given about /var/local.)

Which one of these should we use?

Bonus question: Is there a variable for /var/lib / /var/local, similarly to sharedstatedir and friends that we should use, or should we simply hard-code the path into our makefiles?

Best Answer

You should choose /var/lib.

/usr/com does not exist in FHS 2.3 or FHS 3. FHS 2.3 FHS 3.0

sharedstatedir is a concept in GNU autotools and GNU coding standards

GNU and freestandards.org do not always align.

The issue you mention came up in a 2006 mailing list post. In the case of Red Hat, the conclusion was to use /var/lib

Technically, if you're working on an open source project that defaults prefix to /usr/local, you could possibly use /var/local. But I don't believe anybody does that in practice. For one, note that /var/local is probably empty on your system. For two, note that as soon as you or anybody running ./configure changes prefix to /usr, you can't use /var/local, and the only remaining option is /var/lib.

Related Question