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

Bug #1919252 reported by Ratchanan Srirattanamet
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zfs-linux (Ubuntu)
Fix Released
Medium
Colin Ian King
Focal
Fix Released
Undecided
Unassigned

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)

Revision history for this message
Ratchanan Srirattanamet (peat-new) wrote :
description: updated
description: updated
description: updated
Changed in zfs-linux (Ubuntu):
importance: Undecided → Medium
assignee: nobody → Colin Ian King (colin-king)
status: New → In Progress
summary: - zfs-dkms on Focal still allow building on Linux kernel version 5.10+
+ zfs-dkms on Focal still allows building on Linux kernel version 5.10+
Revision history for this message
Chris Halse Rogers (raof) wrote : Please test proposed package

Hello Ratchanan, or anyone else affected,

Accepted zfs-linux into focal-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/zfs-linux/0.8.3-1ubuntu12.8 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-focal to verification-done-focal. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-focal. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in zfs-linux (Ubuntu Focal):
status: New → Fix Committed
Revision history for this message
Ratchanan Srirattanamet (peat-new) wrote :

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
Revision history for this message
Colin Ian King (colin-king) wrote :

Thanks for testing.

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for zfs-linux has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package zfs-linux - 0.8.3-1ubuntu12.8

---------------
zfs-linux (0.8.3-1ubuntu12.8) focal; urgency=medium

  * Prevent build of the zfs-dkms binary package for kernels later than 5.4.
    This is a re-working of the fix for bug #1902701 with the \ escaped
    so that 5.10+ kernels get detected correctly (LP: #1919252)

 -- Colin Ian King <email address hidden> Wed, 07 Apr 2021 13:44:14 +0100

Changed in zfs-linux (Ubuntu Focal):
status: Fix Committed → Fix Released
Changed in zfs-linux (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.