Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Add support for building DKMS ZFS and SPL binaries for Debian/Ubuntu #6044

Closed
jwittlincohen opened this issue Apr 20, 2017 · 24 comments · Fixed by #6731
Closed
Labels
Component: Packaging custom packages Type: Building Indicates an issue related to building binaries Type: Feature Feature request or new feature

Comments

@jwittlincohen
Copy link
Contributor

jwittlincohen commented Apr 20, 2017

Describe the problem you're observing

Feature Request: Currently, the build scripts for ZFS/SPL only allow building kmod packages for Debian and Ubuntu. In contrast, it is possible to build DKMS packges for CentOS/RHEL and Fedora. It would be very useful to have DKMS packages for Debian and Ubuntu so that the ZFS and SPL modules can be automatically rebuilt after a kernel upgrade. This is described here.

Describe how to reproduce the problem

Upgrading the kernel with the kmod package requires rebuilding the ZFS and SPL packages for the new kernel.

@Conan-Kudo
Copy link
Contributor

@jwittlincohen The ZFS build system will produce dkms packages that work on Debian/Ubuntu if the prerequisites are installed. In addition, that distribution family has taken over maintenance and development of packaging officially as zfs-linux downstream.

Is there something else you wanted?

@jwittlincohen
Copy link
Contributor Author

jwittlincohen commented Apr 21, 2017

@Conan-Kudo I just want to be clear that you are talking about building the ZFS and SPL packages found on the ZoL website. The documentation states, "DKMS (rpm-only): Building rpm-based DKMS and user packages can be done as follows. However, be aware that the build system currently does does [sic] support building deb-based DKMS packages." If it is indeed possible to build DKMS packages for Debian/Ubuntu using the sources from http://zfsonlinux.org/, could you provide the appropriate instructions, as the ones here only show the option to build DKMS RPMs?

If you are referring to the DKMS packages provided by Debian's repositories, I already know they exist. My goal was to create DKMS binaries of 0.70-rc3 for testing. As of this time neither Ubuntu nor Debian provide 0.7.0 packages in any of their repositories as it is not an official release.

@zrav
Copy link

zrav commented Apr 21, 2017

Also note that Ubuntu does not provide up-to-date packages for 16.04 LTS so a documented way of building DKMS packages for it would be welcome.

@jwittlincohen
Copy link
Contributor Author

I checked the Makefile in the ZFS 0.7.0-rc3 source package. All references to DKMS relate to the script rpm-dkms build script. As the name suggests, this only produces RPMs. :)

@ryao ryao added Type: Building Indicates an issue related to building binaries Type: Feature Feature request or new feature Component: Packaging custom packages labels Apr 24, 2017
@MasterCATZ
Copy link

but how do we build deb for 0.7 ?
trying to get something working with kernel 4.11 on ubuntu

the 0.7 spl built and installed fine
but zfs, not much luck so far
also trying to work out how to get the latest spl-dkms

Unpacking zfs-dkms (0.6.5.9-5ubuntu4) over (0.6.5.9-5ubuntu4) ...
Setting up zfs-dkms (0.6.5.9-5ubuntu4) ...
Loading new zfs-0.6.5.9 DKMS files...
Building for 4.11.0-041100-generic
Building initial module for 4.11.0-041100-generic
configure: error:
*** Please make sure the kmod spl devel package for your
*** distribution is installed then try again. If that fails you
*** can specify the location of the spl objects with the
*** '--with-spl-obj=PATH' option.
ERROR (dkms apport): kernel package linux-headers-4.11.0-041100-generic is not supported
Error! Bad return status for module build on kernel: 4.11.0-041100-generic (x86_64)

@gmelikov
Copy link
Member

@MasterCATZ v0.6.5.9 doesn't support 4.11 kernel, next time please read package description. Build beta 0.7.0 or wait for 0.6.5.10.

@Trucido
Copy link

Trucido commented May 14, 2017

There's multiple issues with this issue.

  1. Both Debian and Ubuntu already have zfs-dkms packages, last I checked.
  2. Ubuntu kernels (and forks like proxmox) provide zfs/spl in-tree (this requires extra work if wanting to use your own)
  3. Debian definitely does have dkms packages for zfs via the zfs-dkms package (and zfs-initramfs if needing zfs on boot)
  4. This is a downstream issue, zfsonlinux doesn't mean "provide easy access to the latest bleeding edge versions for every distro", especially when the distro(s) in question maintain their own zfs. One or more of the RPM-based distros likely contributed code for the upstream dkms stuff. I don't think it's being treated special intentionally, but it /is/ kind of a special case due to zfs being intended moreso for large scale server of which many servers run on RPM based distros. Large scale businesses that use ZoL likely also have a vested interest in maturing the code as well. Probably also is a headache for the developers to remain compatible with older system libraries and kernels.

Regarding the issue though, If using an Ubuntu kernel and wanting to use a different zfs/spl, dkms actually is a blocker because it detects an existing zfs/spl and doesn't automatically build out of tree versions and as far as I know there's no way to globally override dkms to --force it to use your own (it checks version number only, and version != version across all debian variants).

When I was testing some Ubuntu kernels on Debian I ran into this issue with dkms. You kinda have to do some variant of this;
dkms build --force -m spl -v $SPLVER -k $KVER
dkms build --force -m zfs -v $ZFSVER -k $KVER
dkms install --force -m spl -v $SPLVER -k $KVER
dkms install --force -m zfs -v $ZFSVER -k $KVER
This is, of course, assuming that your zfs/spl packages HAVE dkms config files and source trees (usually in /usr/src). Back when I was using ubuntu-based kernels I had an ugly hackjob script to auto rebuild my modules, if anyone finds it useful the link is below (updated slightly today to support multiple kernels and zfs source trees, but not well tested. original code is still in the comments): https://gist.github.com/Trucido/17481dfecd01a8befa5a2308f4b45569

If wanting to use a newer version of zfs, the existing dkms files in from the package repos would likely work but may need some slight modification.
HOWEVER, this also presents another issue of mismatched zfsutils-linux and friends. (libzfs2linux, libzpool2linux, zfs-zed, etc). All of this stuff is tightly integrated, and even moreso on Ubuntu than Debian.

This is more of a downstream issue though and I don't believe it belongs here. You could check some of the downstream repos though (like unstable/experimental has 4.11 kernels, so their zfs source repository may have newer versions as well). Likewise for Ubuntu you could check their testing/unstable repos (usually the next distribution release codename). However, this requires advanced apt pinning of packages and repos if you want upgrades to work properly.

@MasterCATZ
Copy link

Thanks Trucido
I will give that script a go tomorrow

still, no idea where to find "beta 0.7.0" for Ubuntu

@kernelOfTruth
Copy link
Contributor

@MasterCATZ
Copy link

MasterCATZ commented Jun 3, 2017

thanks when I last looked that was last updated 162 weeks ago
so I thought it was no longer valid
will try that after Trucido's script finishes

@kernelOfTruth
Copy link
Contributor

@MasterCATZ yeah, not sure why it isn't updated daily when it clearly notes that it is updated daily "Native ZFS for Linux daily builds"

@MasterCATZ
Copy link

MasterCATZ commented Jun 3, 2017

W: The repository 'http://ppa.launchpad.net/zfs-native/daily/ubuntu zesty Release' does not have a Release file.

looks like I still have to wait for Ubuntu to do the zfs update on their end
any other idea's

spl, 0.6.5.9, 4.10.0-22-generic, x86_64: installed
spl, 0.6.5.9, 4.10.12-041012-generic, x86_64: installed
spl, 0.6.5.9, 4.10.6-041006-generic, x86_64: installed
spl, 0.6.5.9, 4.10.8-041008-generic, x86_64: installed
zfs, 0.6.5.9, 4.10.0-22-generic, x86_64: installed
zfs, 0.6.5.9, 4.10.12-041012-generic, x86_64: installed
zfs, 0.6.5.9, 4.10.6-041006-generic, x86_64: installed
zfs, 0.6.5.9, 4.10.8-041008-generic, x86_64: installed

downside being I need kernel 4.11 for my AMD ryzen CPU to work

I have used alien to convert 0.7 rpm - deb , but does not seem to get zfs working for me still

gitclone build attempt with zfs
https://pastebin.com/ug0ZnAQ5

gitclone build of spl seems to work
https://pastebin.com/vXzzwhf8

well after some more attempts and git clean -dfx

something seems to have worked or kernel 4.11.3 worked?
however I think I have some conflicting packaged like zfs-fuse

thankfully the pool imported I have only been without it for a bit over a month now

pool: ZFSRaidz2
id: 1240625230436445622
state: ONLINE

SPL
https://pastebin.com/C0ykPYPa

ZFS
https://zerobin.net/?dd542773747bb460#+fU5ZpiSZxLh+tx0T1HB1AAsGoSxolEvCuAjGMOgEwg=

the only issue now is getting dkms to actually install it
I can not seem to get past this issue ( but my pool is running so not too worried for now )

Error! Could not locate dkms.conf file.
File: /usr/src/spl-0.7.0/dkms.conf does not exist.

@beren12
Copy link
Contributor

beren12 commented Aug 10, 2017

Just need a debian package now :-/

@yuqingdeng
Copy link

I build rpm first and use alien to convert dkms noarch.rpm to deb. That works.

@satmandu
Copy link
Contributor

Do running commands like "zpool status" from installs of alien converted rpms of 0.7.x on a debian system still give you errors like this:

:~$ zpool status
Permission denied the ZFS utilities must be run as root.

@jwittlincohen
Copy link
Contributor Author

Does the RPM --> DEB method install working systemd unit files? When I build the kmod packages for Stretch, I have to manually mount my /home partition because systemd zfs.target service doesn't start. See #6435.

@yuqingdeng
Copy link

I only converted dkms rpm to deb. Same problem, I have to import zfs by hand after 0.7 upgrade.

@tristan-k
Copy link

tristan-k commented Aug 31, 2017

This is so annoying. I'm using Kernel 4.11.2-041102 with help of the Ukuu Kernel Update Utility on Ubuntu 16.04 and I'm unable to use ZFS. This PPA only supports Trusty. Right now I dont know how to get ZFS to play well with Ubtuntu 16.04 and a newer Kernel.

Loading new zfs-0.6.5.6 DKMS files...
First Installation: checking all kernels...
Building only for 4.11.2-041102-generic
Building initial module for 4.11.2-041102-generic
configure: error: 
	*** Please make sure the kmod spl devel <kernel> package for your
	*** distribution is installed then try again.  If that fails you
	*** can specify the location of the spl objects with the
	*** '--with-spl-obj=PATH' option.
ERROR (dkms apport): kernel package linux-headers-4.11.2-041102-generic is not supported
Error! Bad return status for module build on kernel: 4.11.2-041102-generic (x86_64)
Consult /var/lib/dkms/zfs/0.6.5.6/build/make.log for more information.

@satmandu
Copy link
Contributor

You need to make the change in the spl source mentioned here:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=836578

in the spl debian/dkms:

-POST_INSTALL="cp
+POST_BUILD="cp
   ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/spl_config.h
   ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/module/Module.symvers
   ${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/${kernelver}/${arch}/

behlendorf pushed a commit that referenced this issue Oct 15, 2017
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes #6044 
Closes #6731
tonyhutter pushed a commit that referenced this issue Oct 18, 2017
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes #6044
Closes #6731
wli5 pushed a commit to wli5/zfs that referenced this issue Oct 20, 2017
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes openzfs#6044
Closes openzfs#6731
@jwittlincohen
Copy link
Contributor Author

I was able to successfully build and install SPL and ZFS 0.7.3 DKMS packages. DKMS built the kernel modules for both SPL and ZFS on installation. However, something is wrong because when I run update-initramfs -u -k all the resulting initrd does not contain the ZFS modules, even if I run depmod -a first. As a result, I can't use the resulting initrd to boot my ZFS root pool. If I compile with kmod packaging, the initrd contains the necessary modules.

It's possible I'm just doing something wrong since the custom build guide was not updated for DKMS on Debian. Here were the steps I took:

SPL:

  1. autoreconf --force --install
  2. ./configure
  3. make pkg-utils deb-dkms
  4. for file in *.deb; do sudo gdebi -q --non-interactive $file; done

ZFS:

  1. autoreconf --force --install
  2. ./configure --with-config=srpm
  3. make pkg-utils deb-dkms
  4. for file in *.deb; do sudo gdebi -q --non-interactive $file; done
  5. sudo depmod -a 4.13.0-amd64
  6. sudo update-initramfs -u -k all
  7. lsinitramfs initrd.img-4.13.0-1-amd64 | grep zfs (to verify that ZFS modules are in the initrd)

@MyPod-zz
Copy link

@jwittlincohen could you try to check what update-initramfs is doing verbosely and also whether you have /usr/share/initramfs-tools/hooks/zfs properly importing the needed modules?

@sjau
Copy link

sjau commented Oct 25, 2017

Sorry, wrong issue thread :)

Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this issue Nov 4, 2017
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes openzfs#6044
Closes openzfs#6731
Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this issue Nov 6, 2017
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes openzfs#6044
Closes openzfs#6731
@pstch
Copy link

pstch commented Dec 19, 2017

@jwittlincohen I spent a bit of time reading the build scripts, and from what I've gathered, you want to use --with-config=user to build proper DKMS packages. --with-config=srpm expects all of the configuration to come from the source package, removing the ZFS_AC_CONFIG_USER function from the configuration.

When I build with --with-config=user, I get proper DKMS packages with systemd unit files and modules-load.d preset.

Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this issue Jan 29, 2018
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes openzfs#6044
Closes openzfs#6731
Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this issue Feb 13, 2018
* config/deb.am: Enable building DKMS packages for Debian
* rpm/generic/zfs-dkms.spec.in: Adjust spec to be Debian-compatible
  * Condition kernel-devel Req to RPM distros
  * Adjust the DKMS Req to have a minimum of a version only
  * Ensure that --rpm_safe_upgrade isn't used on non-RPM distros
* config/deb.am: Drop CONFIG_KERNEL and CONFIG_USER guards
* Makefile.am: Add pkg-dkms target

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Neal Gompa <ngompa@datto.com>
Closes openzfs#6044
Closes openzfs#6731
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Packaging custom packages Type: Building Indicates an issue related to building binaries Type: Feature Feature request or new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

16 participants