Skip to content

Environment Variables ​

Reference for all environment variables onelf reads or sets.

Set by the runtime (visible to the packed app) ​

VariableValue
ONELF_DIRAbsolute path to the package root (FUSE mount, tmpfs, runtime directory, or cache dir). Empty string in memfd mode.
ONELF_ACTIVE_MODEmemfd, fuse, tmpfs, rundir, cache, or dev (set by onelf run)
ONELF_INTERPSet only when the host's glibc is newer than the bundled one: the private copy of the host loader, closed to the loader's compiled-in default search directories, that every bootstrapped binary in the process tree runs under. When no closed copy can be made, the bundled loader and libc are used and this stays unset. Another packed app launched from that tree drops the inherited value and decides for itself. Ignored by a set-uid, set-gid, or capability-raised executable, as glibc ignores LD_PRELOAD there
ONELF_ARGV0Original argv[0] before multicall resolution
ONELF_EXECAbsolute path to the packed binary
ONELF_ENTRYPOINTResolved entrypoint name
ONELF_ENTRYPOINT_EXPORTEDThe same name, so a package the app launches ignores an inherited ONELF_ENTRYPOINT when it selects its own entrypoint
ONELF_LAUNCH_DIROriginal cwd at launch time
ONELF_ANCHOR_DIRSet only for a package that anchors directories: the private per-launch directory descriptor 77 is open on. A bundled program started with that descriptor closed reopens it from here before its own code runs

onelf run sets ONELF_DIR (the AppDir), ONELF_ACTIVE_MODE=dev, ONELF_ARGV0, ONELF_EXEC, ONELF_ENTRYPOINT and ONELF_ENTRYPOINT_EXPORTED, but not ONELF_LAUNCH_DIR. When the recipe's working-dir moves the app to another directory, it passes the original one as ONELF_USER_CWD.

Library and GPU paths (auto-set if applicable) ​

VariableSet whenPoints to
LD_LIBRARY_PATHonly for an ELF entrypoint without an $ORIGIN run path that the kernel startsthe bundled lib dirs only. The runtime never adds or extends this variable otherwise, and a recipe that assigns it as [env] is refused
ONELF_LIB_PATHlib/ contains .so filesthe bundled lib dirs, kept for scripts that export it as LD_LIBRARY_PATH
GCONV_PATHlib/gconv/ exists<pkg>/lib/gconv, the bundled glibc's charset converters. Replaces a value the caller set.
LIBGL_DRIVERS_PATHlib/dri/ exists<pkg>/lib/dri
LIBVA_DRIVERS_PATHlib/dri/ exists<pkg>/lib/dri
GBM_BACKENDS_PATHlib/gbm/ exists<pkg>/lib/gbm
__EGL_VENDOR_LIBRARY_DIRSshare/glvnd/egl_vendor.d/ exists or host has onemerged list of dirs
VK_DRIVER_FILESthe package and the host both describe one Vulkan driver, or the package's own libvulkan.so.1 loads, and the caller set none of VK_DRIVER_FILES, VK_ICD_FILENAMES and VK_ADD_DRIVER_FILEScolon-joined list of ICD files, one per driver; see Vulkan drivers
LIBDRM_IDS_PATHshare/libdrm/ existsthat dir
LIBDECOR_PLUGIN_DIRshare/libdecor/plugins-1/ existsthat dir. Replaces a value the caller set.
DRIRC_CONFIGDIRshare/drirc.d/ existsthat dir
XKB_CONFIG_ROOTshare/X11/xkb/ existsthat dir
XDG_DATA_DIRSshare/ exists<pkg>/share (prepended)
FONTCONFIG_FILEthe package or a set has share/fonts/a generated config in the private runtime directory that includes the host's fonts.conf, or the caller's FONTCONFIG_FILE in its place, then the bundled font dirs
QT_PLUGIN_PATHthe package or a set has lib/qt6/plugins or lib/qt5/pluginscolon-joined list of every such dir, so relocatable Qt finds its platform plugin. Replaces a value the caller set.
GIO_MODULE_DIRlib/gio/modules/ exists in the packagethat dir. It replaces GLib's default module directory, so the host's modules, built for the host's GLib, never load. Replaces a value the caller set.
GIO_EXTRA_MODULESa set carries lib/gio/modules/ toocolon-joined list of the sets' module dirs. Replaces a value the caller set.
GTK_PATHlib/gtk-3.0/ exists in the package or a setcolon-joined list of those dirs, for GTK 3's modules, theme engines and print backends. Replaces a value the caller set.
GDK_PIXBUF_MODULE_FILElib/gdk-pixbuf-2.0/<version>/loaders.cache existsthat cache, rewritten to absolute module paths (GTK resolves relative cache paths against the cwd). Replaces a value the caller set.
GTK_IM_MODULE_FILElib/gtk-3.0/immodules.cache existsthat cache, absolutised the same way, so the bundle's input-method modules are used. Replaces a value the caller set.
GST_PLUGIN_SYSTEM_PATH_1_0, GST_PLUGIN_SYSTEM_PATHa library directory of the package or a set has gstreamer-1.0/colon-joined list of those dirs. Replaces a value the caller set.
GST_PLUGIN_SCANNER_1_0, GST_PLUGIN_SCANNERthe bundle carries gst-plugin-scanner in gstreamer-1.0/, gstreamer1.0/gstreamer-1.0/ or libexec/gstreamer-1.0/that scanner. Replaces a value the caller set.
PIPEWIRE_MODULE_DIR, SPA_PLUGIN_DIRa library directory has pipewire-0.3/ or spa-0.2/colon-joined list of those dirs. Replaces a value the caller set.
PIPEWIRE_CONFIG_DIRshare/pipewire/ existsthat dir, which holds the carried client.conf. PipeWire then reads its client configuration there alone, so drop-ins under ~/.config/pipewire are not read. A value the caller set wins.
ALSA_PLUGIN_DIRa library directory has alsa-lib/the first such dir. Replaces a value the caller set.
GI_TYPELIB_PATHa library directory has girepository-1.0/colon-joined list of those dirs. Replaces a value the caller set.
LIBHEIF_PLUGIN_PATHa library directory has libheif/colon-joined list of their plugins/ subdirs, or of the dirs themselves where they have none. Replaces a value the caller set.
BABL_PATH, GEGL_PATHa library directory has babl-0.1/ or gegl-0.4/colon-joined list of those dirs. Replaces a value the caller set.
TCL_LIBRARY, TK_LIBRARYa library directory or share/tcltk/ has tcl<version>/init.tcl or tk<version>/tk.tclthat dir. Replaces a value the caller set.
ALSA_CONFIG_DIRthe package or a set has share/alsa/that dir. Replaces a value the caller set: the carried alsa.conf hook is anchored at the data directory.
ALSA_CONFIG_PATHshare/alsa/ has alsa.conf and the caller set no ALSA_CONFIG_PATHa list of alsa.conf followed by each *.conf in its alsa.conf.d/, in alsa-lib's numeric order; a fallback for alsa-lib builds with no conf.d hook. Left unset rather than set broken when a path holds a space.
XLOCALEDIRshare/X11/locale/ existsthat dir
MAGICshare/file/misc/magic.mgc or share/misc/magic.mgc existsthat file
TEXTDOMAINDIRshare/locale/ existsthat dir
LOCPATHa bundle lib dir has locale/C.utf8/, the host has no /usr/lib/locale/locale-archive, and the caller did not set itcolon-joined list of those locale/ dirs
SSL_CERT_FILE, CURL_CA_BUNDLEthe host has no CA bundle at the usual paths, the package or a set carries one, and the caller set neitherthe carried bundle
TERMINFO_DIRSthe package or a set has share/terminfo/ or lib/terminfo/the caller's list, or else the host's usual terminfo dirs, then the bundled ones

The driver and data variables in this table keep a value the caller set; the module variables replace it. Any of them that arrives pointing into another onelf package is dropped first. See Which values the caller can override.

The runtime removes the caller's LD_LIBRARY_PATH from the app's environment and restores it only for the host programs the app runs. Bundled binaries find their libraries through their $ORIGIN run path, and the host libraries the resolver chose and the libraries of the package's shared sets are shown as symlinks in the bundle's library directory, where that run path finds them. On an explicit linker invocation the runtime also passes --library-path, which no child process inherits. No host directory is ever searched: what the host supplies is chosen per library by the resolver. See Environment.

The one exception is an ELF entrypoint without an $ORIGIN run path that the kernel has to start, such as a self-extracting binary or an executable bundle-libs could give no run path. It gets the bundled lib dirs in LD_LIBRARY_PATH, since nothing else leads it to its libraries, and the programs it runs inherit them.

A script entrypoint (shebang target) runs under a host interpreter that must not see the bundled libraries, so it gets none of this. The bundled binaries it runs find their libraries on their own. ONELF_LIB_PATH is still published for scripts written to export it.

VK_ADD_DRIVER_FILES is never set by the runtime, but it is honored as a guard, as are VK_DRIVER_FILES and VK_ICD_FILENAMES: if the app or the user sets one, the runtime stays out of Vulkan's way entirely and does not build VK_DRIVER_FILES.

Private to onelf ​

The runtime sets these for the onelf-env exec hooks, which give a program outside the package the environment the app was launched with (see Programs the app starts). Neither reaches such a program, and neither is meant to be read or set by anything else.

VariableValue
ONELF_HOST_ENVOne entry per variable the runtime set, changed or removed, in the form NAME=<applied><original>;. <applied> is the 64-bit FNV-1a hash of the value the runtime set, as 16 lowercase hex digits, - when the runtime removed the variable, or * to restore it whatever it holds (ONELF_INTERP, which the launch may set on the exec itself). <original> is <len>:<bytes>, the value the runtime was started with and its length in bytes, or - when it was unset. A hook restores a variable only while its value still hashes to <applied>. A runtime that inherits this variable applies it before anything else.
ONELF_ROOTSThe canonical package root and dependency set roots, :-separated. A program below one of them is the package's own and gets the app's environment unchanged.

Read by the runtime (user-settable) ​

VariableEffect
ONELF_MODEForce a specific execution mode: memfd, fuse, tmpfs, rundir or cache. On failure the runtime errors instead of falling back. Read only; the mode chosen is reported as ONELF_ACTIVE_MODE, so a packed app that launches another does not force a mode on it.
ONELF_GC_MAX_AGECache GC threshold in days (default 30; 0 disables auto-GC). Also the age past which a launch that used a GL build or a set removes the stored builds and sets nothing has used, unless ONELF_NO_PLATFORM_FETCH is set.
ONELF_ENTRYPOINTSelect the entrypoint by name, ahead of argv[0] and the default, unless it equals the inherited ONELF_ENTRYPOINT_EXPORTED. See Entrypoints.
ONELF_FUSE_NO_NAMESPACEAny value other than empty or 0 forces the fusermount3 fallback path even when user namespaces are available, and keeps [paths] from being mounted. Useful for debugging mount visibility.
FUSERMOUNT_PROGPath or name of the setuid helper the FUSE mode mounts through when it cannot use a user namespace, instead of fusermount3 or a setuid fusermount on PATH. The AppImage runtime reads the same variable.
ONELF_FUSE_NO_SHAREAny value other than empty or 0 gives this launch a FUSE mount and server of its own instead of running from the mount a running instance of the package serves. See Instances share a mount.
ONELF_FUSE_CACHE_BYTESByte ceiling for the FUSE server's cache of decompressed blocks. Default 32 MiB; a value that does not parse or is zero keeps the default. A shared mount's server takes the value of the launch that started it.
ONELF_CACHE1 (any value other than empty or 0) allows the persistent cache as the last execution mode for this launch. Without it, or [package] cache = true at pack time, the runtime stops at the runtime directory and reports failure rather than leaving an extraction on disk.
ONELF_NO_RESOLVER1 launches with nothing taken from the host, as if the package were packed with host-libs = never. The way to tell whether a failure is the resolver's doing.
ONELF_LD_CACHEPath of the loader cache image the resolver reads instead of /etc/ld.so.cache, so a fixture can describe a host of its own.
ONELF_TRACEPath of a file to record the sysroot path of every file the app opens, for capturing a trace to prune a sysroot build. Recording starts when the app is launched, so the runtime's own reads are left out. Appended, so runs accumulate. Records in fuse mode only, so set ONELF_MODE=fuse when capturing. A traced launch never shares a running instance's mount.
ONELF_PROFILEPath of a file to record every block a run reads, as path<TAB>offset in the order first read, for onelf pack --prefetch. Recording starts with the mount, so the runtime's own reads before the launch are included. Appended, so runs accumulate. Records in fuse mode only. A profiled launch never shares a running instance's mount. See Prefetching a startup.
ONELF_NO_PLATFORM_FETCH1 stops the runtime from fetching the pinned GL build or dependency set on a host without one. A build already in the store is still used, and the launch removes no stored build, however long unused. The launch warns and continues.
ONELF_PLATFORM_URLFetch the pinned GL build from this URL instead of the package's. The pinned hash still has to match, so a mirror cannot substitute content. Ignored when the runtime runs as root.
ONELF_PLATFORM_STOREDirectory holding fetched GL builds and dependency sets instead of platform/ under the cache root. bundle-libs and build also look there for a set's build, under the ownership rule below. A packer running as root takes the hinted store only when it belongs to uid 0 and is neither group nor other writable, and otherwise uses platform/ under /var/cache/onelf. An ordinary launch exports the store it resolved to the app and its children under this name, so a bundled helper looks where the launch did. The value is a lookup hint only: no library directory, no execution view, and no authority over another uid's state. A uid takes it as its own store only when the store's root directory belongs to that uid; root never does. Otherwise acquisition imports from it: a regular file found there without following symlinks is copied into the uid's own store and verified against the package's pin before use, and the hinted store is never modified.
ONELF_SET_MODEmount serves a dependency set from its stored build, the default; extract copies it out through the package cache. A host that cannot mount falls back to extract.
XDG_RUNTIME_DIRThe private per-user directory for mountpoints and rundir trees. Without a usable one the runtime creates /tmp/onelf-<uid> with mode 0700
XDG_CACHE_HOMEThe onelf cache lives in its onelf/ subdirectory: the cache mode's packages and the fetched GL builds and dependency sets. Falls back to $HOME/.cache. A relative value is ignored, and root ignores both variables in favour of its own private base
XDG_DATA_HOMEWhere onelf integrate installs .desktop files and icons (falls back to $HOME/.local/share). Its onelf/platform/ is also the first place a launch looks for a provided build
XDG_DATA_DIRSEach entry's onelf/platform/ is searched for a provided build after XDG_DATA_HOME's (/usr/local/share:/usr/share when unset). Root ignores both variables and searches only those two directories

Portable directory redirection ​

When the corresponding file exists next to the packed binary, the runtime points the variable at it and moves the original value to REAL_*:

Sibling fileRedirectsSaved as
<binary>.homeHOMEREAL_HOME
<binary>.configXDG_CONFIG_HOMEREAL_XDG_CONFIG_HOME
<binary>.shareXDG_DATA_HOMEREAL_XDG_DATA_HOME
<binary>.cacheXDG_CACHE_HOMEREAL_XDG_CACHE_HOME

See Portable Directories for the full story.

Read by onelf at pack time ​

VariableEffect
ONELF_PATCHELFPath to a patchelf binary, used by bundle-libs to add a fresh DT_RUNPATH to binaries without an existing slot and to inject the onelf-env constructor as a DT_NEEDED of every executable that runs under the bundled loader. Falls back to looking up patchelf in PATH.
SOURCE_DATE_EPOCHAn integer Unix timestamp that clamps file mtimes for reproducible output. A value that is not an integer is ignored. --mtime overrides it. See Reproducible Builds.
ONELF_PACK_CHUNK_BYTESIn-flight compression chunk budget in bytes (default 64 MiB). Purely a memory bound: it caps how many files are compressed before their blocks are written back; output bytes are unaffected. A value that does not parse or is zero keeps the default.
NO_COLORWhen set (any value, per the NO_COLOR convention), disables the bundler's ANSI colorized status output in bundle-libs and sysroot. Color also requires a terminal stderr.

Build-time (compiling the onelf crate) ​

These are read by onelf's build script, not by the tools or the runtime. They exist to cross-compile the embedded runtimes and payloads and to offer escape hatches for toolchain-less builds; a plain cargo build on Linux needs none of them beyond the prerequisites in Building and Testing onelf.

VariableEffect
ONELF_MUSL_CCNames the musl cross C compiler used to build the embedded onelf-rt runtimes (e.g. x86_64-linux-musl-gcc). When set, a miss is a hard error; without it the build script searches CC_<triple>, <arch>-linux-musl-gcc and musl-gcc on PATH, then common Nix and Bootlin locations, and fails with instructions if nothing is found.
ONELF_RT_PATHEmbed a prebuilt slim onelf-rt binary instead of building one from source. The file must exist and pass ELF and architecture checks. This is how cargo install builds without a musl toolchain.
ONELF_RT_UPDATE_PATHSame, for the update-capable runtime variant. Defaults to ONELF_RT_PATH when unset, so a toolchain-less build ships the slim binary for both slots (self-update packages then carry a runtime without update code).
ONELF_PAYLOAD_DIRDirectory of prebuilt payload artifacts (bootstrap_<arch>.bin, onelf_env_<arch>.so for x86_64/aarch64/i686), embedded instead of compiling the payloads. Architectures with no file get an inert placeholder.
ONELF_PAYLOAD_ALLWhen set (=1), build payloads for all three architectures instead of only the host's. Needs a working cross toolchain per architecture (ONELF_PAYLOAD_CC_<ARCH>).
ONELF_PAYLOAD_CC_<ARCH>C compiler that links one architecture's freestanding payloads; suffixes are X86_64, AARCH64, I686 (e.g. ONELF_PAYLOAD_CC_AARCH64=/opt/bootlin/.../aarch64-linux-gcc). A set name is a hard requirement; unset names fall back to the host cc for a native Linux host, then Bootlin paths.
ONELF_OBJCOPYPath to an objcopy used to flatten the bootstrap payload ELF into a raw binary. Falls back to the rustc sysroot's llvm-objcopy, then rust-objcopy/llvm-objcopy on PATH (rustup component add llvm-tools supplies it).

Released under the MIT License.