From 821b428940542e6152f4678d49139b2ca8fa16c2 Mon Sep 17 00:00:00 2001 From: jbailes Date: Tue, 27 Oct 2026 17:23:47 +0100 Subject: [PATCH 1/2] fix(zfs): build OpenZFS's native Debian packages so they declare their dependencies The alien targets (make deb-utils deb-dkms) convert RPMs and drop their requirements: zfs-dkms did not depend on dkms and the libraries declared no shared-library dependencies, which breaks installing them through apt. make native-deb-utils builds OpenZFS's own contrib/debian packaging instead (openzfs-* packages, real Depends), versioned - via the generated changelog. The zfs-2.4.4 patch lane adds Conflicts for the alien-built names upstream only Replaces, so apt removes them on upgrade. check-zfs-dkms now also fails if the DKMS package does not depend on dkms. --- .github/workflows/release.yml | 4 +- README.md | 9 ++- docs/APT_REPO.md | 4 +- docs/BUILDING.md | 10 ++- docs/CI_RELEASES.md | 2 +- docs/DKMS.md | 2 +- docs/INSTALLERS.md | 2 +- docs/KERNEL.md | 2 +- docs/SMOOTHNAS.md | 16 ++-- docs/bumping-kernel.md | 4 +- docs/kernel-config.md | 2 +- docs/signing.md | 2 +- examples/smooth.env | 7 +- examples/smoothnas.env | 7 +- ...n-conflict-with-alien-built-packages.patch | 72 +++++++++++++++++ patches/zfs-2.4.4/README.md | 33 ++++++++ recipes/build-zfs.sh | 80 +++++++------------ recipes/check-zfs-dkms.sh | 4 +- 18 files changed, 173 insertions(+), 89 deletions(-) create mode 100644 patches/zfs-2.4.4/0001-debian-conflict-with-alien-built-packages.patch create mode 100644 patches/zfs-2.4.4/README.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e168a8d..915beef 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -110,10 +110,10 @@ jobs: sudo apt-get install -y \ build-essential bc bison flex libelf-dev libssl-dev libncurses-dev \ libdw-dev pahole rsync debhelper kmod dkms fakeroot dpkg-dev cpio xz-utils zstd \ - autoconf automake libtool gawk alien rpm rpm2cpio dh-python po-debconf \ + autoconf automake libtool gawk dh-python dh-dkms po-debconf lsb-release \ uuid-dev libudev-dev libblkid-dev libtirpc-dev libcurl4-openssl-dev \ libaio-dev libattr1-dev libffi-dev zlib1g-dev libpam0g-dev \ - python3 python3-dev python3-cffi python3-setuptools python3-packaging \ + python3 python3-dev python3-all-dev python3-cffi python3-setuptools python3-packaging python3-sphinx \ python3-distlib parted - name: Check ROCm kernel config diff --git a/README.md b/README.md index 1e5bf76..4238616 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,8 @@ SmoothKernel owns: - `patches/`: ordered, vendored patch lanes for the current kernel line. - `recipes/build-kernel.sh`: kernel.org tarball -> patches -> config -> Debian kernel packages. -- `recipes/build-zfs.sh`: OpenZFS release tarball -> `zfs-dkms` and userspace - Debian packages. +- `recipes/build-zfs.sh`: OpenZFS release tarball -> `openzfs-zfs-dkms` and + userspace Debian packages. - `templates/`: DKMS packaging and kernel compatibility templates for out-of-tree modules in consuming repos. - `docs/`: cross-repo technical documentation for the Smooth* base platform. @@ -112,8 +112,9 @@ linux-headers--smoothkernel_*.deb linux-libc-dev_*.deb ``` -Typical OpenZFS outputs include `zfs-dkms`, `zfsutils-linux`, and supporting -library packages produced by OpenZFS's Debian packaging. +OpenZFS outputs are OpenZFS's native Debian packages: `openzfs-zfs-dkms`, +`openzfs-zfsutils`, `openzfs-zfs-initramfs` and the supporting `openzfs-lib*` +libraries. For host package requirements, resource expectations, output details, and test install commands, see [docs/BUILDING.md](docs/BUILDING.md). diff --git a/docs/APT_REPO.md b/docs/APT_REPO.md index 4bebc4a..fe3604d 100644 --- a/docs/APT_REPO.md +++ b/docs/APT_REPO.md @@ -109,11 +109,11 @@ The Rakuen VPS, as a static tree behind nginx with HTTPS. `smoothapt` documents ## Out-of-tree modules and DKMS -DKMS modules (`zfs-dkms`, `smoothfs`-via-DKMS, NVIDIA if we mirror it) build against the installed SmoothKernel headers on install. The versioned package name is `linux-headers--smoothkernel`; the apt repo may also provide a stable metapackage such as `linux-headers-smoothkernel`. DKMS consumers live in `common` only when multiple flavors can pull them; flavor meta-packages declare Depends on only the modules they actually need. +DKMS modules (`openzfs-zfs-dkms`, `smoothfs`-via-DKMS, NVIDIA if we mirror it) build against the installed SmoothKernel headers on install. The versioned package name is `linux-headers--smoothkernel`; the apt repo may also provide a stable metapackage such as `linux-headers-smoothkernel`. DKMS consumers live in `common` only when multiple flavors can pull them; flavor meta-packages declare Depends on only the modules they actually need. Every flavor meta-package also depends on `smooth-secureboot`, which owns the per-host Secure Boot / MOK bootstrap and DKMS-signing hooks for the shared-kernel model. -- `smoothnas` depends on `zfs-dkms`, `smoothfs` +- `smoothnas` depends on `openzfs-zfs-dkms`, `smoothfs` - `smoothrouter` depends on neither - `smoothhtpc`, `smoothdesktop` may depend on NVIDIA driver packages conditionally (handled via Recommends + install-time detection) diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 564a0ed..a6b3cf4 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -17,10 +17,10 @@ sudo apt-get update sudo apt-get install -y \ build-essential bc bison flex libelf-dev libssl-dev libncurses-dev \ libdw-dev pahole rsync debhelper kmod fakeroot dpkg-dev cpio xz-utils zstd \ - autoconf automake libtool gawk alien rpm rpm2cpio dh-python po-debconf \ + autoconf automake libtool gawk dh-python dh-dkms po-debconf lsb-release \ uuid-dev libudev-dev libblkid-dev libtirpc-dev libcurl4-openssl-dev \ libaio-dev libattr1-dev libffi-dev zlib1g-dev libpam0g-dev \ - python3 python3-dev python3-cffi python3-setuptools python3-packaging \ + python3 python3-dev python3-all-dev python3-cffi python3-setuptools python3-packaging python3-sphinx \ python3-distlib parted ``` @@ -137,8 +137,10 @@ make zfs DEB_ARCH=amd64 make zfs DEB_ARCH=arm64 ``` -The recipe downloads the configured OpenZFS release, runs its packaging build, -and copies resulting `.deb` files to `OUT_DIR`. The `zfs-dkms` package is not +The recipe downloads the configured OpenZFS release, builds it with OpenZFS's +own Debian packaging (`make native-deb-utils`, which declares real package +dependencies) and copies the resulting `openzfs-*` `.deb` files to `OUT_DIR`. +The `openzfs-zfs-dkms` package is not tied to one kernel at package build time; it builds on the target machine against installed SmoothKernel headers. diff --git a/docs/CI_RELEASES.md b/docs/CI_RELEASES.md index e9e5f8e..37990b4 100644 --- a/docs/CI_RELEASES.md +++ b/docs/CI_RELEASES.md @@ -34,7 +34,7 @@ so each build of `main` is distinct and newer than the last: | `linux-libc-dev` | `linux-libc-dev_7.2.10-68_amd64.deb` | | `linux-image-smoothkernel` (metapackage) | `linux-image-smoothkernel_7.2.10-68_amd64.deb` | | `linux-headers-smoothkernel` (metapackage) | `linux-headers-smoothkernel_7.2.10-68_amd64.deb` | -| OpenZFS | `zfs_2.4.4-68_amd64.deb`, `zfs-dkms_2.4.4-68_amd64.deb`, ... | +| OpenZFS | `openzfs-zfsutils_2.4.4-68_amd64.deb`, `openzfs-zfs-dkms_2.4.4-68_all.deb`, ... | The kernel release (`uname -r`) is `7.2.10-68-smoothkernel`, so a new build installs alongside the running kernel rather than replacing its modules, and diff --git a/docs/DKMS.md b/docs/DKMS.md index 3b26051..6e67f42 100644 --- a/docs/DKMS.md +++ b/docs/DKMS.md @@ -6,7 +6,7 @@ not here. Current or expected consumers: -- OpenZFS through `zfs-dkms`. +- OpenZFS through `openzfs-zfs-dkms`. - SmoothNAS `smoothfs`. - Optional NVIDIA modules from Debian's `nvidia-driver-*` packages. diff --git a/docs/INSTALLERS.md b/docs/INSTALLERS.md index ce298c4..28707ca 100644 --- a/docs/INSTALLERS.md +++ b/docs/INSTALLERS.md @@ -83,7 +83,7 @@ Until this lands, the existing `SmoothNAS/iso/` continues to work and other flav ### SmoothNAS -- Optional ZFS-on-root. Needs the installer to load ZFS modules during install (they come from `zfs-dkms` built against the installer kernel, or precompiled for the installer environment — decision deferred). +- Optional ZFS-on-root. Needs the installer to load ZFS modules during install (they come from `openzfs-zfs-dkms` built against the installer kernel, or precompiled for the installer environment — decision deferred). - Multi-disk mgmt during install is out of scope — non-OS disks stay untouched, managed from the web UI post-install. - Default user setup: one admin user, web UI login is separate credential. diff --git a/docs/KERNEL.md b/docs/KERNEL.md index 524a7d1..365a50b 100644 --- a/docs/KERNEL.md +++ b/docs/KERNEL.md @@ -144,7 +144,7 @@ Major version bumps (e.g. 6.x → 7.0) follow the conservative rule from [`bumpi Every flavor that needs out-of-tree kernel code consumes the versioned SmoothKernel headers package, normally via a stable apt metapackage, and DKMS builds against `/lib/modules/$(uname -r)/build`. Current consumers: -- `zfs-dkms` — SmoothNAS. OpenZFS tracks kernel compatibility per release; see [`bumping-kernel.md`](bumping-kernel.md) for the version-pairing rule. +- `openzfs-zfs-dkms` — SmoothNAS. OpenZFS tracks kernel compatibility per release; see [`bumping-kernel.md`](bumping-kernel.md) for the version-pairing rule. - `smoothfs` — SmoothNAS-specific filesystem module. Uses the `compat.h` pattern (see [`kernel-config.md`](kernel-config.md)). - NVIDIA proprietary — optional on HTPC/desktop. Ships via Debian's `nvidia-driver-*` packages (mirrored or pulled directly) which are DKMS-compatible. diff --git a/docs/SMOOTHNAS.md b/docs/SMOOTHNAS.md index aa1b04f..f539259 100644 --- a/docs/SMOOTHNAS.md +++ b/docs/SMOOTHNAS.md @@ -13,7 +13,7 @@ NAS appliance flavor. This doc is the Smooth* cross-repo contract for SmoothNAS: | `smoothfs` | `SmoothNAS` | Out-of-tree kernel module (DKMS) | | `smoothfs-utils` | `SmoothNAS` | Userspace tools for smoothfs | -Shared from `common`: the versioned SmoothKernel image and headers packages (optionally via stable metapackages), `linux-firmware-smooth`, `smooth-base`, `zfs-dkms` (if we host it; otherwise pulled from Debian), `smoothgui-assets` (optional — cached smoothgui build for offline installer). +Shared from `common`: the versioned SmoothKernel image and headers packages (optionally via stable metapackages), `linux-firmware-smooth`, `smooth-base`, `openzfs-zfs-dkms` and `openzfs-zfsutils` (built by SmoothKernel), `smoothgui-assets` (optional — cached smoothgui build for offline installer). ## Meta-package dependencies @@ -31,8 +31,8 @@ Depends: tierd-ui, smoothfs, smoothfs-utils, - zfs-dkms, - zfsutils-linux, + openzfs-zfs-dkms, + openzfs-zfsutils, samba, nfs-kernel-server, tgt, @@ -143,14 +143,9 @@ Everything here is runtime, kernel-neutral, and independently installable — so ## ZFS posture -`zfs-dkms` from DKMS, built against the installed SmoothKernel headers. OpenZFS release pairing follows the rule in [`bumping-kernel.md`](bumping-kernel.md): kernel version <= the OpenZFS release's `Linux-Maximum`. +`openzfs-zfs-dkms` from DKMS, built against the installed SmoothKernel headers. OpenZFS release pairing follows the rule in [`bumping-kernel.md`](bumping-kernel.md): kernel version <= the OpenZFS release's `Linux-Maximum`. -We can either: - -- (a) Mirror `zfs-dkms` and `zfsutils-linux` into `common` (rebuilt when OpenZFS releases). -- (b) Pull from Debian. Lags upstream by months, frustrating when a kernel bump outruns Debian's ZFS. - -Leaning (a) because kernel cadence is the bottleneck and Debian's ZFS will chronically lag. Implementation: extend `smoothkernel`'s existing `build-zfs.sh` recipe to produce signed Debian packages for the `common` suite. +OpenZFS comes from SmoothKernel, not Debian: Debian's ZFS lags upstream by months, and kernel cadence is the bottleneck. `recipes/build-zfs.sh` builds OpenZFS's own Debian packaging (`openzfs-*`) with every kernel build, and `smoothapt` publishes it in the `common` suite. ## Installer considerations @@ -168,6 +163,5 @@ Other Smooth* products will likely adopt the same repo-local aimee pattern as th ## Open questions -- **zfs-dkms custody.** Mirror (a) vs Debian (b) — decision pending; lean (a) as above. - **Installer ZFS modules.** See [`INSTALLERS.md`](INSTALLERS.md). - **Appliance-mode hardening.** Should the `.deb` install disable password login by default and force SSH-key-only? Right posture for an appliance, but increases first-boot friction. Decision deferred. diff --git a/docs/bumping-kernel.md b/docs/bumping-kernel.md index a1c73de..fb0e424 100644 --- a/docs/bumping-kernel.md +++ b/docs/bumping-kernel.md @@ -46,7 +46,7 @@ with a one-line carry patch instead of waiting. **Do not ship `--enable-linux-experimental` as the fix.** It works for a local build but cannot reach the DKMS path — `scripts/dkms.mkconf` hardcodes the -configure arguments used when `zfs-dkms` rebuilds on the target, so the flag +configure arguments used when `openzfs-zfs-dkms` rebuilds on the target, so the flag never reaches an appliance and every on-target rebuild would fail. Carry a `patches/zfs-/` META patch instead, so the raised cap travels with the packaged source. See [`PATCHES.md`](PATCHES.md) and `patches/zfs-2.4.3/README.md`. @@ -123,7 +123,7 @@ find out -maxdepth 2 -name '*.deb' ``` Run `make check-zfs-dkms DEB_ARCH=` on each native builder after both -package builds. It extracts the generated zfs-dkms package and invokes its +package builds. It extracts the generated openzfs-zfs-dkms package and invokes its normal configure/build hook against the complete matching kernel tree, checks `zfs.ko`/`spl.ko` vermagic, and refuses an experimental-cap bypass. CI runs this before uploading or publishing packages. It does not install or load modules. diff --git a/docs/kernel-config.md b/docs/kernel-config.md index b18ab34..7a5efd1 100644 --- a/docs/kernel-config.md +++ b/docs/kernel-config.md @@ -72,7 +72,7 @@ Built in as modules (available but not always loaded): - ext4, xfs, btrfs — all built in as `=m` - bcachefs — external DKMS module, installed from the bcachefs APT repo when a flavor enables it -- ZFS — *not* in-tree (CDDL/GPL); ships as `zfs-dkms` +- ZFS — *not* in-tree (CDDL/GPL); ships as `openzfs-zfs-dkms` - NTFS3 — `=m` (useful for external drives on desktop/HTPC) - f2fs, exfat, FAT — `=m` - Network filesystems: CIFS, NFSv3/v4 — `=m` diff --git a/docs/signing.md b/docs/signing.md index 2e31b17..6f9d754 100644 --- a/docs/signing.md +++ b/docs/signing.md @@ -163,7 +163,7 @@ Release build flow, once signing material is provisioned: 1. CI fetches signing material from KMS / HSM-backed secret storage 2. Kernel build signs packaged modules with the Rakuen release key 3. Resulting `.deb`s are published to the apt repo -4. Test boxes enrolled with `smooth-secureboot` verify that DKMS consumers (`zfs-dkms`, `smoothfs`, optional NVIDIA) rebuild and load successfully +4. Test boxes enrolled with `smooth-secureboot` verify that DKMS consumers (`openzfs-zfs-dkms`, `smoothfs`, optional NVIDIA) rebuild and load successfully ### Repository secrets diff --git a/examples/smooth.env b/examples/smooth.env index c3a9db2..c7fabd8 100644 --- a/examples/smooth.env +++ b/examples/smooth.env @@ -16,9 +16,10 @@ CACHYOS_PATCHSET=cachyos-7.2.10 NOBARA_PATCHSET=nobara-picks POST_NOBARA_PATCHSET=post-nobara-7.2.10 -# OpenZFS 2.4.4 natively supports Linux 7.2, including DKMS rebuilds. -# The older zfs-2.4.3 META carry is no longer needed for this release. -ZFS_PATCHSET= +# OpenZFS 2.4.4 natively supports Linux 7.2, including DKMS rebuilds. The +# zfs-2.4.4 lane only makes the native packages conflict with the +# alien-built names of earlier SmoothKernel releases (see its README). +ZFS_PATCHSET=zfs-2.4.4 # Where the .debs land. Default is $(pwd)/out. OUT_DIR=$(CURDIR)/out/$(DEB_ARCH) diff --git a/examples/smoothnas.env b/examples/smoothnas.env index d5b3952..10915ca 100644 --- a/examples/smoothnas.env +++ b/examples/smoothnas.env @@ -16,9 +16,10 @@ CACHYOS_PATCHSET=cachyos-7.2.10 NOBARA_PATCHSET=nobara-picks POST_NOBARA_PATCHSET=post-nobara-7.2.10 -# OpenZFS 2.4.4 natively supports Linux 7.2, including DKMS rebuilds. -# The older zfs-2.4.3 META carry is no longer needed for this release. -ZFS_PATCHSET= +# OpenZFS 2.4.4 natively supports Linux 7.2, including DKMS rebuilds. The +# zfs-2.4.4 lane only makes the native packages conflict with the +# alien-built names of earlier SmoothKernel releases (see its README). +ZFS_PATCHSET=zfs-2.4.4 # Where the .debs land. Default is $(pwd)/out. OUT_DIR=$(CURDIR)/out/$(DEB_ARCH) diff --git a/patches/zfs-2.4.4/0001-debian-conflict-with-alien-built-packages.patch b/patches/zfs-2.4.4/0001-debian-conflict-with-alien-built-packages.patch new file mode 100644 index 0000000..d169475 --- /dev/null +++ b/patches/zfs-2.4.4/0001-debian-conflict-with-alien-built-packages.patch @@ -0,0 +1,72 @@ +Subject: [PATCH] debian: conflict with the alien-built package names + +SmoothKernel releases up to build 71 shipped OpenZFS as alien-converted +packages (zfs-dkms, libzfs7, libnvpair3, ...). The native packages replace +them, but for these names upstream declares no Conflicts, so apt would keep +both installed -- for zfs-dkms that is two DKMS registrations of zfs/2.4.4. +Conflicts makes apt remove the old package when the new one comes in. + +--- a/contrib/debian/control ++++ b/contrib/debian/control +@@ -35,7 +35,7 @@ + Depends: ${misc:Depends}, ${shlibs:Depends} + Breaks: libnvpair1, libnvpair3 + Replaces: libnvpair1, libnvpair3, libnvpair3linux +-Conflicts: libnvpair3linux ++Conflicts: libnvpair3linux, libnvpair3 + Description: Solaris name-value library for Linux + This library provides routines for packing and unpacking nv pairs for + transporting data across process boundaries, transporting between +@@ -46,7 +46,7 @@ + Architecture: linux-any + Depends: libpam-runtime, ${misc:Depends}, ${shlibs:Depends} + Replaces: libpam-zfs +-Conflicts: libpam-zfs ++Conflicts: libpam-zfs, pam-zfs-key + Description: PAM module for managing encryption keys for ZFS + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, +@@ -61,7 +61,7 @@ + Depends: ${misc:Depends}, ${shlibs:Depends} + Breaks: libuutil1, libuutil3 + Replaces: libuutil1, libuutil3, libuutil3linux +-Conflicts: libuutil3linux ++Conflicts: libuutil3linux, libuutil3 + Description: Solaris userland utility library for Linux + This library provides a variety of glue functions for ZFS on Linux: + * libspl: The Solaris Porting Layer userland library, which provides APIs +@@ -84,7 +84,7 @@ + openzfs-libzpool7 (= ${binary:Version}), + ${misc:Depends} + Replaces: libzfslinux-dev +-Conflicts: libzfslinux-dev ++Conflicts: libzfslinux-dev, libzfs7-devel + Provides: libnvpair-dev, libuutil-dev + Description: OpenZFS filesystem development files for Linux + Header files and static libraries for compiling software against +@@ -102,7 +102,7 @@ + Recommends: libcurl4 + Breaks: libzfs2, libzfs4, libzfs4linux, libzfs6linux, libzfs7linux, openzfs-libzfs4, openzfs-libzfs6 + Replaces: libzfs2, libzfs4, libzfs4linux, libzfs6linux, libzfs7linux, openzfs-libzfs4, openzfs-libzfs6 +-Conflicts: libzfs7linux ++Conflicts: libzfs7linux, libzfs7 + Description: OpenZFS filesystem library for Linux - general support + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, +@@ -130,7 +130,7 @@ + Depends: ${misc:Depends}, ${shlibs:Depends} + Breaks: libzpool2, libzpool5, libzpool6linux, libzpool7linux + Replaces: libzpool2, libzpool5, libzpool6linux, libzpool7linux +-Conflicts: libzpool7linux ++Conflicts: libzpool7linux, libzpool7 + Description: OpenZFS pool library for Linux + OpenZFS is a storage platform that encompasses the functionality of + traditional filesystems and volume managers. It supports data checksums, +@@ -197,6 +197,7 @@ + # suggests debhelper because e.g. `dkms mkdeb -m zfs -v 0.8.2` needs dh_testdir (#909183) + Suggests: debhelper + Breaks: spl-dkms (<< 0.8.0~rc1) ++Conflicts: zfs-dkms + Replaces: spl-dkms, zfs-dkms + Provides: openzfs-zfs-modules + Description: OpenZFS filesystem kernel modules for Linux diff --git a/patches/zfs-2.4.4/README.md b/patches/zfs-2.4.4/README.md new file mode 100644 index 0000000..a90faee --- /dev/null +++ b/patches/zfs-2.4.4/README.md @@ -0,0 +1,33 @@ +# zfs-2.4.4 + +Carry patches applied to the pristine OpenZFS `2.4.4` release tarball before +`autogen.sh` runs. Applied by `recipes/build-zfs.sh` via `ZFS_PATCHSET`, under +the rules in [`../../docs/PATCHES.md`](../../docs/PATCHES.md). + +Current contents: + +- `0001-debian-conflict-with-alien-built-packages.patch` + +## Why this lane exists + +Up to build 71, SmoothKernel built OpenZFS with its alien targets +(`make deb-utils deb-dkms`), which convert RPMs and drop their dependencies: +`zfs-dkms` did not depend on `dkms`, and the libraries declared no shared +library dependencies. It now builds OpenZFS's own Debian packaging +(`make native-deb-utils`), whose packages are named `openzfs-*` and carry +real dependencies. + +The native packages already conflict with most old names (`zfs`, +`zfs-initramfs`, `zfs-dracut`, `zfs-test`, `python3-pyzfs`). For the rest +upstream only declares `Replaces`, which lets apt overwrite their files but +leaves the old package installed. On a box that had the alien packages, that +leaves `zfs-dkms` and `openzfs-zfs-dkms` both registering `zfs/2.4.4` with +DKMS. The patch adds `Conflicts` for those names: `zfs-dkms`, `libnvpair3`, +`libuutil3`, `libzfs7`, `libzpool7`, `libzfs7-devel`, `pam-zfs-key`. + +## Removal condition + +Once no installed system can still carry the alien-built packages, i.e. every +SmoothKernel consumer has moved to the `openzfs-*` packages. Carry the patch +forward on each OpenZFS bump until then (`contrib/debian/control` rarely +changes, so it should apply as is). diff --git a/recipes/build-zfs.sh b/recipes/build-zfs.sh index 61755ff..54b581e 100755 --- a/recipes/build-zfs.sh +++ b/recipes/build-zfs.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash -# build-zfs.sh — fetch an OpenZFS source release and produce zfs-dkms -# + userspace .deb files. DKMS source package is kernel-version- -# independent; it rebuilds against whatever kernel headers are -# installed on the target appliance via the standard DKMS hook. +# build-zfs.sh — fetch an OpenZFS source release and produce +# openzfs-zfs-dkms + userspace .deb files with OpenZFS' own Debian +# packaging (contrib/debian), so every package declares its real +# dependencies. The DKMS source package is kernel-version-independent; +# it rebuilds against whatever kernel headers are installed on the +# target appliance via the standard DKMS hook. # # Required env: # ZFS_VERSION e.g. 2.4.1 @@ -15,10 +17,10 @@ # autogen, e.g. zfs-$ZFS_VERSION. Unset means no patches. # BUILD_NUMBER default recipes/build-number.sh (commit count of HEAD) # -# The build number is the package revision (zfs_2.4.4-), as for the -# kernel, so every build's packages have their own version and a patch -# change reaches systems as an upgrade. The DKMS module version stays -# ZFS_VERSION: OpenZFS takes it from META's Version, not its Release. +# The build number is the package revision (openzfs-zfsutils_2.4.4-), +# as for the kernel, so every build's packages have their own version and +# a patch change reaches systems as an upgrade. The DKMS module version +# stays ZFS_VERSION (the upstream part of the package version). set -euo pipefail @@ -35,31 +37,6 @@ BUILD_DIR="$ROOT/build/zfs-$ZFS_VERSION-$DEB_ARCH" TARBALL="zfs-$ZFS_VERSION.tar.gz" URL="https://github.com/openzfs/zfs/releases/download/zfs-$ZFS_VERSION/$TARBALL" -# alien does not translate these RPM requirements into Debian dependencies. -# The ZFS initramfs hook refuses to run without a BusyBox implementation, -# including on otherwise valid minimal Debian/cloud installations. -add_initramfs_dependencies() { - local deb="$1" tmp control depends - tmp="$(mktemp -d)" - dpkg-deb -R "$deb" "$tmp" >/dev/null - control="$tmp/DEBIAN/control" - depends="$(sed -n 's/^Depends: //p' "$control")" - if ! grep -Eq '(^|[,|])[[:space:]]*initramfs-tools([[:space:],(|]|$)' <<< "$depends"; then - depends="${depends:+$depends, }initramfs-tools" - fi - if ! grep -Eq '(^|[,|])[[:space:]]*busybox(-static)?([[:space:],(|]|$)' <<< "$depends"; then - depends="${depends:+$depends, }busybox | busybox-static" - fi - if grep -q '^Depends:' "$control"; then - sed -i "s/^Depends:.*/Depends: $depends/" "$control" - else - sed -i "/^Version: /a Depends: $depends" "$control" - fi - dpkg-deb -b "$tmp" "${deb}.patched" >/dev/null - mv "${deb}.patched" "$deb" - rm -rf "$tmp" -} - mkdir -p "$BUILD_DIR" "$OUT_DIR" cd "$BUILD_DIR" @@ -111,32 +88,35 @@ if [[ ! -f Makefile ]]; then ./configure --with-config=user >/dev/null fi +# The Debian version comes from the changelog configure generates, which +# upstream fixes at -1. +pkg_version="${ZFS_VERSION}-${BUILD_NUMBER}" +sed -i -E "1s/^(openzfs-linux \([^-)]+)-[^)]*\)/\1-${BUILD_NUMBER})/" contrib/debian/changelog +got="$(dpkg-parsechangelog -l contrib/debian/changelog -S Version)" +[[ "$got" == "$pkg_version" ]] || { + echo "ERROR: contrib/debian/changelog has version $got, expected $pkg_version" >&2; exit 1; +} + echo "==> building (-j${BUILD_THREADS})" date -rpmbuild_cmd="rpmbuild --define '_binary_payload w9.gzdio'" - -# OpenZFS' alien-based deb targets share the source tree and fakeroot/rpm -# tooling; run the target groups sequentially while preserving per-target -# parallelism. -make -j"$BUILD_THREADS" RPMBUILD="$rpmbuild_cmd" deb-utils || { - echo "ERROR: zfs userspace package build failed"; exit 1; -} -make -j"$BUILD_THREADS" RPMBUILD="$rpmbuild_cmd" deb-dkms || { - echo "ERROR: zfs dkms package build failed"; exit 1; +# native-deb-utils copies contrib/debian to debian/ only if debian/ does not +# exist, and dpkg-buildpackage leaves the packages in the parent directory: +# clear both so a rerun cannot pick up a previous build. +rm -rf debian ../*.deb +# Userspace + DKMS source; not native-deb-kmod, which would build modules +# for the build host's kernel. dpkg-buildpackage checks Build-Depends first +# and names whatever is missing. +DEB_BUILD_OPTIONS="nocheck parallel=${BUILD_THREADS}" make native-deb-utils || { + echo "ERROR: zfs package build failed"; exit 1; } -if ! compgen -G "*.deb" >/dev/null; then - echo "ERROR: zfs build failed"; exit 1; -fi date echo "==> collecting .debs into $OUT_DIR" shopt -s nullglob moved=() -for f in *.deb; do - if [[ "$f" == zfs-initramfs_* ]]; then - add_initramfs_dependencies "$f" - fi +for f in ../*.deb; do cp -v "$f" "$OUT_DIR/" moved+=("$f") done +[[ ${#moved[@]} -gt 0 ]] || { echo "ERROR: zfs build produced no .debs"; exit 1; } echo "==> done. Built ${#moved[@]} .debs in $OUT_DIR" diff --git a/recipes/check-zfs-dkms.sh b/recipes/check-zfs-dkms.sh index 8300626..ba53502 100755 --- a/recipes/check-zfs-dkms.sh +++ b/recipes/check-zfs-dkms.sh @@ -21,9 +21,9 @@ kernel_src="$ROOT/build/kernel-$KERNEL_VERSION-$DEB_ARCH/linux-$KERNEL_VERSION" } kernel_release=$(env -u LOCALVERSION -u MAKEFLAGS make -s -C "$kernel_src" ARCH="$kernel_arch" kernelrelease) shopt -s nullglob -packages=("$OUT_DIR"/zfs-dkms_*.deb) +packages=("$OUT_DIR"/openzfs-zfs-dkms_*.deb) [[ ${#packages[@]} -eq 1 ]] || { - echo "Expected exactly one zfs-dkms package in $OUT_DIR" >&2; exit 1; + echo "Expected exactly one openzfs-zfs-dkms package in $OUT_DIR" >&2; exit 1; } check_dir=$(mktemp -d "$ROOT/build/zfs-dkms-check-$DEB_ARCH.XXXXXX") dpkg-deb -x "${packages[0]}" "$check_dir/package" From e9256f3b461643d8fefdaac9a06f0f264cc3b4cd Mon Sep 17 00:00:00 2001 From: jbailes Date: Tue, 27 Oct 2026 17:24:22 +0100 Subject: [PATCH 2/2] fix(check-zfs-dkms): fail when the DKMS package does not depend on dkms --- recipes/check-zfs-dkms.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/recipes/check-zfs-dkms.sh b/recipes/check-zfs-dkms.sh index ba53502..b81e272 100755 --- a/recipes/check-zfs-dkms.sh +++ b/recipes/check-zfs-dkms.sh @@ -25,6 +25,12 @@ packages=("$OUT_DIR"/openzfs-zfs-dkms_*.deb) [[ ${#packages[@]} -eq 1 ]] || { echo "Expected exactly one openzfs-zfs-dkms package in $OUT_DIR" >&2; exit 1; } +# Installed through apt, the package has to bring DKMS itself (the alien-built +# packages before build 72 declared no dependencies at all). +depends=$(dpkg-deb -f "${packages[0]}" Depends) +grep -Eq '(^|, )dkms( |,|$)' <<< "$depends" || { + echo "openzfs-zfs-dkms does not depend on dkms: Depends: $depends" >&2; exit 1; +} check_dir=$(mktemp -d "$ROOT/build/zfs-dkms-check-$DEB_ARCH.XXXXXX") dpkg-deb -x "${packages[0]}" "$check_dir/package" source_dir="$check_dir/package/usr/src/zfs-$ZFS_VERSION"