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
cryptsetup-2.8.8.tar.xz(11.4 MiB)
sha2563acfa685f2dd7fcc832e0b77bc7093aa7da554a51ce8dafbb4138eaa854eee35
upstream: https://www.kernel.org/pub/linux/utils/cryptsetup/v2.8/cryptsetup-2.8.8.tar.xz
archive copy: sources-1/disk--cryptsetup-2.8.8.tar.xz
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.
--disable-pwquality, line 17: libpwquality (explained with the switches below)
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:
--with-crypto_backend=openssl— Takes hashing, ciphers and key derivation from OpenSSL’s libcrypto. It is upstream’s default, named here; the library is one the initramfs carries.--enable-udev— Uses libdevmapper’s udev synchronisation, so libcryptsetup waits for udev to finish with a device-mapper node it creates or removes. It is upstream’s default.--enable-blkid— Uses util-linux’s libblkid to detect an existing filesystem or other signature on a device before formatting it, and to wipe it. It is upstream’s default.--disable-pwquality,--disable-passwdqc— Check no passphrase against a quality library. Both are off by default.--without-tmpfilesdir— Installs no systemdtmpfiles.dfragment. KDOS has no systemd.--disable-asciidoc— Generates no manual pages with asciidoctor. The switch is on by default, and configure then stops whenasciidoctoris not installed; asciidoctor is not independs. The release tarball carries the pages already built, and configure reuses those, so they are installed either way.--disable-rpath— Turns off the run path that gettext’s library search macros in configure add for the libraries they find, an entry of/usr/lib. The tree’s package lint warns on such an entry, since/usr/libis the default search path; see What the package lint refuses.--disable-ssh-token— Builds no LUKS2 SSH token plugin, which unlocks a container with a key fetched over SSH through libssh.
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.