Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

98.17. cryptsetup-2.8.8

Used to set up transparent encryption of block devices using the kernel crypto API

Version 2.8.8, release 1
Shelf disk — Block devices: partitioning, RAID, LVM, block encryption, SMART, NVMe, recovery, image writing and async I/O
Phase 41_system (System), 398 of 1047 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later
Homepage https://gitlab.com/cryptsetup/cryptsetup
Build time 0.8 SBU
Installed size 1.5 MiB in 48 files
Recipe ports/core/disk/cryptsetup/kpkgbuild

About

cryptsetup sets up LUKS and other dm-crypt encrypted block devices: cryptsetup luksFormat creates an encrypted container and cryptsetup open maps it to a plain device under /dev/mapper, through the kernel’s device mapper and crypto API. libcryptsetup is the library under it.

It is on the ISO, not only on an installed system, for two reasons. kinstall creates the LUKS container for an encrypted install, and script/phases/70_image/090_initramfs.sh copies cryptsetup and its libraries into the initramfs, where the boot unlocks an encrypted root before it looks for a filesystem; see Unlocking an encrypted root. The desktop unlocks an encrypted stick or disk through udisks2, whose libblockdev crypto plugin links libcryptsetup; see Removable media and devices. libblockdev, volume_key, kpmcore and gparted depend on it.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/disk.txt:

LUKS. Needed on the ISO rather than only on an installed system: kinstall creates the container, and script/phases/70_image/090_initramfs.sh copies cryptsetup into the initramfs so an encrypted root can be unlocked at boot.

Sources

Dependencies

Depends on: openssl, popt, json-c, lvm2, util-linux.

Required by (4): gparted, kpmcore, libblockdev, volume_key.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install cryptsetup'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/disk/cryptsetup.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/disk/cryptsetup
echo '3acfa685f2dd7fcc832e0b77bc7093aa7da554a51ce8dafbb4138eaa854eee35  cryptsetup-2.8.8.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/cryptsetup
SRC=$SRC_ROOT/cryptsetup-2.8.8
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf cryptsetup-2.8.8.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

./configure \
	--prefix=/usr \
	--with-crypto_backend=openssl \
	--enable-udev \
	--enable-blkid \
	--disable-pwquality \
	--disable-passwdqc \
	--without-tmpfilesdir \
	--disable-asciidoc \
	--disable-nls \
	--disable-rpath \
	--disable-ssh-token
make
make DESTDIR=$PKG install

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/cryptsetup, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf cryptsetup-2.8.8-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/cryptsetup, and runs the triggers its paths call for.

Contents

Installed programs: cryptsetup, integritysetup, veritysetup.

Installed libraries: libcryptsetup.so.

Installed directories: /usr/lib/cryptsetup, /usr/share/licenses/cryptsetup.

Short descriptions

cryptsetup utility for configuring and managing encrypted storage devices
integritysetup utility for configuring and managing dm-integrity devices
veritysetup utility for configuring and managing dm-verity devices
libcryptsetup.pc cryptsetup library

Notes

The initramfs carries cryptsetup with an explicit list of libraries: libcryptsetup, libdevmapper, libjson-c, libpopt, OpenSSL’s two libraries, libargon2, libuuid, libblkid and libz, each copied when /usr/lib has it. A switch here that makes cryptsetup or libcryptsetup link a further library has to add it to that list in 090_initramfs.sh. Until it does, the closure check at the end of that step stops the image build and names the missing library, since an initramfs cryptsetup that cannot start leaves an encrypted root locked at boot.

--disable-nls builds no translations, which the package prune would remove anyway, and it means the build needs no libintl; see Gettext on musl.