Open Source › LamBoot filesystem crates › lambutter
lambutter
Read-only btrfs on SINGLE, DUP and RAID1 profiles, with subvolumes and zstd, zlib and LZO.
What lambutter is for
lambutter is a pure-Rust, allocation-aware, read-only btrfs reader for code that can't link std: UEFI applications, microcontrollers, bare-metal kernels and recovery tools. It's the btrfs counterpart to ext4-view, and covers what /boot needs on stock openSUSE Tumbleweed and Leap, Fedora Workstation, CachyOS and Garuda under Secure Boot.
It's linked into LamBoot as its native btrfs backend and boots openSUSE Tumbleweed end to end under UEFI firmware. The crate can't change a btrfs volume.
Basis: Implemented from the btrfs on-disk format specification, independent of any other btrfs crate.
Add it to your crate
[dependencies]
lambutter = { version = "0.5", features = ["zstd", "zlib", "lzo"] }
Or cargo add lambutter. On Debian unstable or testing, the packaged crate is librust-lambutter-dev (rust-lambutter).
Usage
use lambutter::{Btrfs, Path};
let mut fs = Btrfs::open(reader, device_size_bytes)?;
let kernel = fs.read_file(Path::new(b"/vmlinuz")?)?; // whole file
let inode = fs.resolve(Path::new(b"/vmlinuz")?)?; // or stream it
let n = fs.read_file_at(&inode, 0, &mut buf)?;
The full API, with every type and error, is on docs.rs.
What it reads
| Feature | Status |
|---|---|
| Regular files, symlinks and directory listings | Read |
| SINGLE, DUP, RAID1, RAID1C3 and RAID1C4 profiles | Read |
| Subvolumes | The default one, or one chosen by id or path (as subvolid= and subvol=); nested subvolumes crossed as a Linux mount does |
| A filesystem across several devices | Read from the device given; a chunk with no copy there is refused |
| zstd, zlib and LZO extents | Decoded, each behind a feature |
| Files and directories spanning B-tree leaves | Read |
What it refuses
- RAID0, RAID10, RAID5 and RAID6
- ZONED, RAID_STRIPE_TREE and REMAP_TREE
- fscrypt markers and any unknown incompat feature
Each is a typed error. Data-block checksum verification and snapshot enumeration aren't implemented.
What it depends on, and what it doesn't
Avoids: The GPL btrfs UEFI driver, std and any async runtime. Codecs are opt-in, so a build without them depends on bitflags and crc alone.
Only with a feature
- ruzstd 0.9.1, with
zstd - miniz_oxide 0.9.1, with
zlib - lzokay 2.0, with
lzo
Cargo features
| Feature | Default | What it adds |
|---|---|---|
| zstd | Yes | zstd extents through ruzstd (the Tumbleweed and Fedora default) |
| zlib | No | zlib extents through miniz_oxide (the legacy default) |
| lzo | No | LZO extents through lzokay |
| std | No | An std::error::Error impl for Error |
How it's tested
55 unit tests; 15 oracle tests on kernel-written images (each codec, DUP metadata, NO_HOLES, leaf-spanning extents and directories, subvolumes and snapshots, RAID1 across two devices); 5 cargo-fuzz harnesses; live reads of a Snapper-managed Tumbleweed partition, byte-identical to the kernel.
No GPL drivers in the boot path
Until 2026 LamBoot read most Linux filesystems through about a dozen prebuilt UEFI filesystem driver binaries from the EfiFs (GPL-3.0) and rEFInd (GPL-2.0) projects. Three things ruled them out at once. Debian's free-software guidelines and Fedora's packaging rules reject a prebuilt .efi blob that isn't built from source in the archive. Microsoft doesn't sign GPLv3 code for Secure Boot, and loading a separate UEFI driver binary removes the ShimLock protocol that shim 15.8 relies on. And GPL binaries sit badly beside a permissively licensed loader. These crates replace those drivers with readers compiled into LamBoot itself. The whole family · LamBoot
The other disk filesystem readers
Read-only media formats (lamfold): lamfold · lamfold-iso · lamfold-udf · lamfold-squash · lamfold-erofs · lamfold-cramfs · lamfold-romfs · lamfold-cpio