Zainium Dynamics
Open standard · Version 1.0

Dualayer Hierarchy Standard

A layered filesystem hierarchy in which musl and GNU libc run side by side. Dualayer = dual (two C libraries) + layer (a system built from layers). Zainium OS is its reference implementation.

Why a new hierarchy

The Filesystem Hierarchy Standard puts the vendor's software and the user's software together under /usr, and assumes one C library. That makes it hard to keep the base apart from what users install, to upgrade the base as one unit, and to have a second C library.

DHS gives every part of the system its own layer with a single owner, composes the layers into one view at boot with OverlayFS, and gives each C library a directory of its own. The root holds only /overlayer, user data and virtual filesystems — no /usr, /lib64, /etc or /var. At run time the system layer is read-only; its etc and var are writable layers whose changes are kept in the userland layer.

/
├── overlayer/
│   ├── syshub/        system layer: the base OS
│   │   ├── bin/ lib/ include/ share/ etc/ var/
│   │   └── x86_64-<vendor>-linux-musl/
│   ├── userland/      userland layer
│   │   └── union/
│   │       └── x86_64-<vendor>-linux-gnu/
│   ├── ignition/      kernels, initramfs, boot loader
│   ├── agents/        instructions for AI agents
│   └── .syshub-pending/
└── home/  root/  tmp/  run/  dev/  proc/  sys/

The layers

LayerDHS pathZainium OS
System layer: the base OS, changed only by base upgrades/overlayer/syshubsyshub
Userland layer: software the user installs, the OverlayFS upper layer/overlayer/userlandzexlib
Ignition layer: kernels, initramfs and boot loader, read-only/overlayer/ignitionzaisys

A distribution may give the userland and ignition layers names of its own, as Zainium OS does, if the structure inside them stays the same.

musl and glibc, side by side

Each distribution chooses its primary C library, the one the base is built against. The other is the optional secondary. Whether the secondary ships in the system layer or as a userland package varies by distribution — both conform.

Design A

musl primary, glibc secondary

The base is built against musl; glibc is added for prebuilt glibc software. Used by Zainium OS, with glibc as a userland package.

Design B

glibc primary, musl secondary

The base is built against glibc, as most distributions are today; musl is added for software built for musl distributions or small static programs.

Conflicts the layout prevents

Loader
Each C library's loader lives in its own triplet directory; every program names its own.
Headers
Each C library has its own include directory; each compiler uses only its own.
Shared libraries
The secondary loader never searches the shared lib, so a program never loads a library built for the other C library.
C++ runtime
libstdc++ and libgcc_s exist once per C library.
Tools
Only the primary's cc, ldd and iconv are on PATH; the secondary's compiler has its triplet name.
Configuration
Both read users, DNS and the time zone from the system layer's etc.
Prebuilt binaries
A missing /lib64 or /lib loader path is redirected to the installed loader of the same C library.

Implement DHS in your distribution

The specification is licensed under CC BY-SA 4.0 and written in DocBook, like the FHS it builds on. Issues and pull requests from distribution, toolchain and package-manager maintainers are welcome. See also how Zainium OS implements it.