On a machine with mainline PPA's Linux 5.11.14 installed, installing
zfs-dkms=0.8.3-1ubuntu12.8 from focal-proposed now correctly blocks the
module from being built.

---
Setting up zfs-dkms (0.8.3-1ubuntu12.8) ...
Loading new zfs-0.8.3 DKMS files...
Building for 5.11.14-051114-generic
Building initial module for 5.11.14-051114-generic
Error!  The /var/lib/dkms/zfs/0.8.3/5.11.14-051114-generic/x86_64/dkms.conf for 
module zfs includes
 a BUILD_EXCLUSIVE directive which
does not match this kernel/arch.  This indicates that it should not be built.
Skipped.
---

Triggering an autoinstall for 5.4 kernel does not error out.

---
$ sudo dkms autoinstall -k 5.4.0-71-generic 

Kernel preparation unnecessary for this kernel.  Skipping...

Running the pre_build script:
...
---


I considered the bug fixed.

** Tags added: verification-done-focal

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to zfs-linux in Ubuntu.
https://bugs.launchpad.net/bugs/1919252

Title:
  zfs-dkms on Focal still allows building on Linux kernel version 5.10+

Status in zfs-linux package in Ubuntu:
  In Progress
Status in zfs-linux source package in Focal:
  Fix Committed

Bug description:
  == SRU update, zfs-dkms, Focal ==

  [Impact]

  Due to a mistake in the BUILD_EXCLUSIVE_KERNEL regex in dkms.conf,
  dkms will still consider zfs-dkms to be buildable on kernel version
  5.10+. This can happen if one installs a mainline kernel from the
  mainline PPA for one reason or another.

  Fixing this will stop users from installing incompatible newer
  versions of the kernel and hence stop dkms build failures on known
  incompatible kernel versions.  The fix is also trivial.

  [The Fix]

  Correctly escape . in regex so that the final sed'd string gets
  modified to produce the correct regex pattern, as follows:

          sed -ie '/^PACKAGE_VERSION/a 
BUILD_EXCLUSIVE_KERNEL="^(4\\.[0-9]+|5\\.[01234])\\."' \
                  '$(CURDIR)/scripts/zfs-dkms.dkms'

  
  [Test Plan]

  Without the fix, install kernels > than versions 5.4. ZFS dkms will
  attempt to be built against these and fail with broken builds.
  Installing earlier kernels such as 4.20, 5.0, 5.4 should succeed.

  With the fix, installing kernels > 5.4 will skip the ZFS dkms build
  phase and report a meaningful error:

  Error!  The /var/lib/dkms/zfs/0.8.3/5.5.19-050519-generic/x86_64/dkms.conf 
for module zfs includes a BUILD_EXCLUSIVE directive which
  does not match this kernel/arch.  This indicates that it should not be built

  Test kernels for the test from https://kernel.ubuntu.com/~kernel-
  ppa/mainline/?C=N;O=D can be used to test this out.

  [Where problems could occur]

  The change is to a regex pattern match. If this is incorrect then
  kernels such a 5.4 will not be allowed to build the dkms zfs driver.
  This will clearly show up as a ZFS dkms build denied failure with an
  error such as:

  Error!  The /var/lib/dkms/zfs/0.8.3/5.5.19-050519-generic/x86_64/dkms.conf 
for module zfs includes a BUILD_EXCLUSIVE directive which
  does not match this kernel/arch.  This indicates that it should not be built

  This fix is relatively low-risk, it fixes am issue with an earlier fix
  to the regex which wasn't quite working for kernels > 5.4 and yet
  didn't cause any major issues blocking legitimate users from using
  known working 5.4 kernels with zfs dkms.

  -----------------------------------------------------------------------

  Due to a mistake in the BUILD_EXCLUSIVE_KERNEL regex in dkms.conf,
  dkms will still consider zfs-dkms to be buildable on kernel version
  5.10+. This can happen if one installs a mainline kernel from the
  mainline PPA for one reason or another [1].

  The following patch to dkms.conf should fix the issue:

  --- ./dkms.conf.orig  2021-03-16 04:15:55.077568974 +0700
  +++ /usr/src/zfs-0.8.3/dkms.conf      2021-03-16 04:17:16.598219797 +0700
  @@ -1,6 +1,6 @@
   PACKAGE_NAME="zfs"
   PACKAGE_VERSION="0.8.3"
  -BUILD_EXCLUSIVE_KERNEL="^(4.[0-9]+|5.[01234])."
  +BUILD_EXCLUSIVE_KERNEL='^(4.[0-9]+|5.[01234])\.'
   PACKAGE_CONFIG="/etc/sysconfig/zfs"
   PRE_BUILD="configure
     --prefix=/usr

  Although it's not convenient for me at the moment to create a debdiff.

  Related: LP: #1902701

  [1] For me it's to get a complete fix for LP: #1887190, as Focal's HWE
  kernel doesn't seem to work.

  ProblemType: Bug
  DistroRelease: Ubuntu 20.04
  Package: zfs-dkms 0.8.3-1ubuntu12.6
  Uname: Linux 5.11.6-051106-generic x86_64
  ApportVersion: 2.20.11-0ubuntu27.16
  Architecture: amd64
  CasperMD5CheckResult: skip
  Date: Tue Mar 16 04:26:08 2021
  InstallationDate: Installed on 2021-03-15 (0 days ago)
  InstallationMedia: Ubuntu 20.04.2.0 LTS "Focal Fossa" - Release amd64 
(20210209.1)
  PackageArchitecture: all
  ProcEnviron:
   TERM=xterm-256color
   PATH=(custom, no user)
   LANG=th_TH.UTF-8
   SHELL=/bin/bash
  SourcePackage: zfs-linux
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/zfs-linux/+bug/1919252/+subscriptions

-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to