Zfs: Error module compile on kernel 4.20.3

Created on 20 Jan 2019  Â·  4Comments  Â·  Source: openzfs/zfs

System information


Type | Version/Name
--- | ---
Distribution Name | Fedora Linux
Distribution Version | 29
Linux Kernel | 4.20.3-200.fc29.x86_64
Architecture | x86_64
ZFS Version | 0.7.12
SPL Version | 0.7.12

Describe the problem you're observing

dkms module building works on kernel 4.19.*, but failed on 4.20:

# dkms autoinstall
...
Building module:
cleaning build area...
make -j8 KERNELRELEASE=4.20.3-200.fc29.x86_64..........(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.20.3-200.fc29.x86_64 (x86_64)
Consult /var/lib/dkms/zfs/0.7.12/build/make.log for more information.

Relevant part of log /var/lib/dkms/zfs/0.7.12/build/make.log:

  CC [M]  /var/lib/dkms/zfs/0.7.12/build/module/zfs/abd.o                                                                                                                                                      
In file included from /var/lib/dkms/zfs/0.7.12/build/include/zpios-internal.h:39,                                                                                                                              
                 from /var/lib/dkms/zfs/0.7.12/build/module/zpios/pios.c:42:                                                                                                                                   
/var/lib/dkms/zfs/0.7.12/build/include/zpios-ctl.h: In function ‘zpios_timespec_now’:                                                                                                                          
/var/lib/dkms/zfs/0.7.12/build/include/zpios-ctl.h:186:11: error: implicit declaration of function ‘current_kernel_time’; did you mean ‘current_kernel_time64’? [-Werror=implicit-function-declaration]        
  ts_now = current_kernel_time();                                                                                                                                                                              
           ^~~~~~~~~~~~~~~~~~~                                                                                                                                                                                 
           current_kernel_time64                                                                                                                                                                               
/var/lib/dkms/zfs/0.7.12/build/include/zpios-ctl.h:186:9: error: incompatible types when assigning to type ‘struct timespec’ from type ‘int’                                                                   
  ts_now = current_kernel_time();                                                                                                                                                                              
         ^                                                                                                                                                                                                     
cc1: some warnings being treated as errors                                                                                                                                                                     
make[5]: *** [scripts/Makefile.build:292: /var/lib/dkms/zfs/0.7.12/build/module/zpios/pios.o] Error 1                                                                                                          
make[4]: *** [scripts/Makefile.build:516: /var/lib/dkms/zfs/0.7.12/build/module/zpios] Error 2                                                                                                                 
make[4]: *** Waiting for unfinished jobs....

Full log: make.log

Describe how to reproduce the problem

dnf upgrade zfs*

Most helpful comment

I concenated the information in this issue as well from #8394 to help others with a guide with all the steps if anyone should need it.
This applies to Fedora 29.

  1. Make sure that you are running the kernel that you want to build the module for:
    uname -srm Linux 4.20.7-100.fc28.x86_64 x86_64

  2. Reinstall zfs and spl packages to have a clean environment:
    dnf reinstall zfs-dkms spl-dkms zfs

  3. Download ubuntu's zfs-linux tarball: https://mirrors.edge.kernel.org/ubuntu/pool/main/z/zfs-linux/zfs-linux_0.7.12-1ubuntu5.debian.tar.xz

  4. Extract the archive
    tar xjf zfs-linux_0.7.12-1ubuntu5.debian.tar.xz

  5. Enter the patches dir: cd debian/patches

  6. Apply the patch to the zfs source: sudo patch -p1 /var/lib/dkms/zfs/0.7.12/source/include/zpios-ctl.h <3204-Add-4.20-timespec-compat-fix.cd patch

  7. Remove the modules that dnf built upon installation of the package:
    sudo dkms remove spl/0.7.12 --all; sudo dkms remove zfs/0.7.12 --all;

  8. Build the modules anew from the patched source code:
    sudo dkms --force install spl/0.7.12 sudo dkms --force install zfs/0.7.12

  9. Load the module: modprobe zfs
    Now you should be able to restart the zfs-services and mount your pool(s), or just reboot your machine to make the changes to take effect.

All 4 comments

Duplicate of #8258
Will be fixed in #8305

I had the same problem. The quick fix is debian/patches/3204-Add-4.20-timespec-compat-fix.patch in https://mirrors.edge.kernel.org/ubuntu/pool/main/z/zfs-linux/zfs-linux_0.7.12-1ubuntu4.debian.tar.xz .

I had the same problem. The quick fix is debian/patches/3204-Add-4.20-timespec-compat-fix.patch in https://mirrors.edge.kernel.org/ubuntu/pool/main/z/zfs-linux/zfs-linux_0.7.12-1ubuntu4.debian.tar.xz .

This worked for me, with a few tweaks - I had to grab https://mirrors.edge.kernel.org/ubuntu/pool/main/z/zfs-linux/zfs-linux_0.7.12-1ubuntu5.debian.tar.xz instead (as it looks like it replaces 1ubuntu4), extract the mentioned patch file 3204-Add-4.20-timespec-compat-fix.patch from the archive, and apply it in /var/lib/dkms/zfs/0.7.12/source with patch -p1 <3204-Add-4.20-timespec-compat-fix.patch.

DKMS modules for ZFS then build fine on 4.20.4-200.fc29.x86_64.

I concenated the information in this issue as well from #8394 to help others with a guide with all the steps if anyone should need it.
This applies to Fedora 29.

  1. Make sure that you are running the kernel that you want to build the module for:
    uname -srm Linux 4.20.7-100.fc28.x86_64 x86_64

  2. Reinstall zfs and spl packages to have a clean environment:
    dnf reinstall zfs-dkms spl-dkms zfs

  3. Download ubuntu's zfs-linux tarball: https://mirrors.edge.kernel.org/ubuntu/pool/main/z/zfs-linux/zfs-linux_0.7.12-1ubuntu5.debian.tar.xz

  4. Extract the archive
    tar xjf zfs-linux_0.7.12-1ubuntu5.debian.tar.xz

  5. Enter the patches dir: cd debian/patches

  6. Apply the patch to the zfs source: sudo patch -p1 /var/lib/dkms/zfs/0.7.12/source/include/zpios-ctl.h <3204-Add-4.20-timespec-compat-fix.cd patch

  7. Remove the modules that dnf built upon installation of the package:
    sudo dkms remove spl/0.7.12 --all; sudo dkms remove zfs/0.7.12 --all;

  8. Build the modules anew from the patched source code:
    sudo dkms --force install spl/0.7.12 sudo dkms --force install zfs/0.7.12

  9. Load the module: modprobe zfs
    Now you should be able to restart the zfs-services and mount your pool(s), or just reboot your machine to make the changes to take effect.

Was this page helpful?
0 / 5 - 0 ratings