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

zfsUnstable: 0.8.4 -> 2.0.0-rc1 #96432

Merged
merged 1 commit into from Aug 31, 2020
Merged

zfsUnstable: 0.8.4 -> 2.0.0-rc1 #96432

merged 1 commit into from Aug 31, 2020

Conversation

hmenke
Copy link
Member

@hmenke hmenke commented Aug 27, 2020

Motivation for this change

New features from https://github.com/openzfs/zfs/releases/tag/zfs-2.0.0-rc1

  • Unified code base for Linux and FreeBSD
  • Redacted zfs send/recv
  • Persistent L2ARC
  • Sequential resilvering
  • zstd compression
  • Log spacemaps
  • Fast clone deletion
  • Sectional zfs/zpool man pages
  • Added zpool wait subcommand
  • Improved zfs share scalability

Also the __vmalloc patch is now part of the tree: openzfs/zfs@080102a

Fixes #96348

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@hmenke
Copy link
Member Author

hmenke commented Aug 27, 2020

@hmenke
Copy link
Member Author

hmenke commented Aug 27, 2020

Result of nixpkgs-review pr 96432 1

6 packages marked as broken and skipped:
- linuxPackages_hardkernel_4_14.zfs
- linuxPackages_hardkernel_4_14.zfsStable
- linuxPackages_hardkernel_4_14.zfsUnstable
- linuxPackages_hardkernel_latest.zfs
- linuxPackages_hardkernel_latest.zfsStable
- linuxPackages_hardkernel_latest.zfsUnstable
1 package blacklisted:
- tests.nixos-functions.nixosTest-test
13 packages failed to build:
- bareos
- deepin.dde-api
- deepin.dde-control-center
- deepin.dde-daemon
- deepin.dde-dock
- deepin.dde-file-manager
- deepin.dde-kwin
- deepin.dde-launcher
- deepin.dde-session-ui
- deepin.deepin-desktop-base
- deepin.deepin-desktop-schemas
- deepin.deepin-wallpapers
- deepin.startdde
87 packages built:
- ceph (ceph-dev)
- ceph-client
- collectd
- collectd-data
- docker-machine-kvm
- docker-machine-kvm2
- easysnap
- gnome3.gnome-boxes
- grub2 (grub2_full)
- grub2_efi
- grub2_pvgrub_image
- grub2_xen
- haskellPackages.libvirt-hs
- haskellPackages.libzfs
- libceph
- libguestfs
- libguestfs-with-appliance
- libvirt
- libvirt-glib
- libvirt_5_9_0
- libvmi
- linuxPackages-libre.zfs (linuxPackages-libre.zfsStable)
- linuxPackages-libre.zfsUnstable
- linuxPackages.zfs (linuxPackages.zfsStable ,linuxPackages_5_4.zfs ,linuxPackages_5_4.zfsStable)
- linuxPackages.zfsUnstable (linuxPackages_5_4.zfsUnstable)
- linuxPackages_4_14.zfs (linuxPackages_4_14.zfsStable)
- linuxPackages_4_14.zfsUnstable
- linuxPackages_4_19.zfs (linuxPackages_4_19.zfsStable)
- linuxPackages_4_19.zfsUnstable
- linuxPackages_4_4.zfs (linuxPackages_4_4.zfsStable)
- linuxPackages_4_4.zfsUnstable
- linuxPackages_4_9.zfs (linuxPackages_4_9.zfsStable)
- linuxPackages_4_9.zfsUnstable
- linuxPackages_5_7.zfs (linuxPackages_5_7.zfsStable)
- linuxPackages_5_7.zfsUnstable
- linuxPackages_5_8.zfs (linuxPackages_5_8.zfsStable ,linuxPackages_latest.zfs ,linuxPackages_latest.zfsStable)
- linuxPackages_5_8.zfsUnstable (linuxPackages_latest.zfsUnstable)
- linuxPackages_hardened.zfs (linuxPackages_hardened.zfsStable)
- linuxPackages_hardened.zfsUnstable
- linuxPackages_latest-libre.zfs (linuxPackages_latest-libre.zfsStable)
- linuxPackages_latest-libre.zfsUnstable
- linuxPackages_latest_hardened.zfs (linuxPackages_latest_hardened.zfsStable)
- linuxPackages_latest_hardened.zfsUnstable
- linuxPackages_latest_xen_dom0.zfs (linuxPackages_latest_xen_dom0.zfsStable)
- linuxPackages_latest_xen_dom0.zfsUnstable
- linuxPackages_latest_xen_dom0_hardened.zfs (linuxPackages_latest_xen_dom0_hardened.zfsStable)
- linuxPackages_latest_xen_dom0_hardened.zfsUnstable
- linuxPackages_testing_bcachefs.zfs (linuxPackages_testing_bcachefs.zfsStable)
- linuxPackages_testing_bcachefs.zfsUnstable
- linuxPackages_xen_dom0.zfs (linuxPackages_xen_dom0.zfsStable)
- linuxPackages_xen_dom0.zfsUnstable
- linuxPackages_xen_dom0_hardened.zfs (linuxPackages_xen_dom0_hardened.zfsStable)
- linuxPackages_xen_dom0_hardened.zfsUnstable
- linuxPackages_zen.zfs (linuxPackages_zen.zfsStable)
- linuxPackages_zen.zfsUnstable
- minikube
- minishift
- nixops
- nixopsUnstable
- nixops_1_6_1
- os-prober
- perl528Packages.SysVirt
- perl530Packages.SysVirt
- python27Packages.guestfs
- python27Packages.libvirt
- python37Packages.guestfs
- python37Packages.libvirt
- python38Packages.guestfs
- python38Packages.libvirt
- rubyPackages.ruby-libvirt (rubyPackages_2_6.ruby-libvirt)
- rubyPackages_2_5.ruby-libvirt
- rubyPackages_2_7.ruby-libvirt
- sambaFull (samba4Full)
- sanoid
- terraform-full
- terraform-providers.libvirt
- terraform_0_11-full
- terragrunt
- vagrant
- virt-manager
- virt-manager-qt
- virt-top
- virt-viewer
- virtlyst
- zfs (zfsStable)
- zfsUnstable
- zfstools

@hmenke
Copy link
Member Author

hmenke commented Aug 27, 2020

bareos is marked as broken and deepin.dde-api (on which all other deepin packages depend) is marked as broken as well. I have no idea why nixpkgs-review tried to build them. (@Mic92?)

@hmenke
Copy link
Member Author

hmenke commented Aug 27, 2020

@ofborg test zfs.stable zfs.unstable

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/274

@jonringer
Copy link
Contributor

* zstd compression

😮 nice

@hmenke
Copy link
Member Author

hmenke commented Aug 28, 2020

@jonringer That has been in the pipeline for a few years now. It was presented at the OpenZFS Developer Summit 2017.
Video: https://www.youtube.com/watch?v=hWnWEitDPlM
Slides: https://openzfs.org/w/images/b/b3/03-OpenZFS_2017_-_ZStandard_in_ZFS.pdf

@jonringer
Copy link
Contributor

yea, but i forgot about it, and seemed like a pipe dream.

And looking at the PR history, it looks like it was slow to adopt

@shadowrylander
Copy link

shadowrylander commented Aug 28, 2020

Actually, there seems to be an issue when using the zstd compression; every feature flag enabling the compression is invalid, including the following:

  1. redaction_bookmarks
  2. redacted_datasets
  3. bookmark_written
  4. log_spacemap
  5. livelist
  6. device_rebuild
  7. zstd_compress

The zfs version registers as zfs-2.0.0-rc1, but the kmod seems to be stuck as 0.8.4-1.

@hmenke
Copy link
Member Author

hmenke commented Aug 28, 2020

@shadowrylander

  1. How did you install this?
  2. Did you reboot? (and did you reboot into the correct generation?)
  3. Did you upgrade your zpool?

On my machine I get

$ modinfo zfs | grep ^version
version:        2.0.0-rc1
$ zfs --version
zfs-2.0.0-rc1
zfs-kmod-2.0.0-rc1

@shadowrylander
Copy link

shadowrylander commented Aug 28, 2020

Alright, so, two things:

  • I'm using it to create a new zpool, using a Gnome3 ISO I created with the module file
  • I just realized that, while I had included zfs in the supported filesystems (the lists of strings), I hadn't included zfsUnstable, which could be why my kmod value didn't change.

I'm trying to create the zpool again with a new ISO with the changes.

@Mic92
Copy link
Member

Mic92 commented Aug 28, 2020

bareos is marked as broken and deepin.dde-api (on which all other deepin packages depend) is marked as broken as well. I have no idea why nixpkgs-review tried to build them. (@Mic92?)

This is fixed in master of nixpkgs-review now. Needs a release.

@shadowrylander
Copy link

shadowrylander commented Aug 28, 2020

Same issue as from my post before. Nothing's changed; however, I forgot to mention I'm on NixOS 20.09, if that makes a difference.

Oh, and I also added the imported overlay to nixpkgs.overlays in the ISO's config file.

@jonringer
Copy link
Contributor

jonringer commented Aug 28, 2020

Same issue as from my post before. Nothing's changed; however, I forgot to mention I'm on NixOS 20.09, if that makes a difference.

you would need to check out the branch, update your configuration.nix to use the zfsUnstable package.

  boot.zfs.enableUnstable = true;

Then you would need to do a nixos-rebuild boot -I nixpkgs=/path/to/nixpkgs to then create a new generation pulling in changes from this PR

EDIT:
Then you would need to reboot and select the new generation

@jonringer
Copy link
Contributor

you could potentially try nixos-rebuild build-vm, but I'm not sure how zfs will react to a guest OS importing pools

@shadowrylander
Copy link

@jonringer
Copy link
Contributor

ah, well, my steps will work generically over all PRs, but either one should work.

@shadowrylander
Copy link

I know; great advice for a newbie such as myself!

@eadwu
Copy link
Member

eadwu commented Aug 29, 2020

Using zstd-3 fine on my end. You probably need to upgrade the pool before using it.

@shadowrylander
Copy link

Yeah, but I'm creating a new one! Why wouldn't that work, though? 🤔

@jonringer
Copy link
Contributor

I thought compression could be enabled/disabled at any time, shouldn't you be able to just say zfs set compression=zstd-3 tank?

@shadowrylander
Copy link

Well, I was going to recreate my pools anyway, so... 😅

@Mic92 Mic92 merged commit f66efe5 into NixOS:master Aug 31, 2020
@shadowrylander
Copy link

Wait! ... Does this work in the end?

@hmenke
Copy link
Member Author

hmenke commented Aug 31, 2020

It seems to work for everyone except you, so it's quite likely that you are doing something wrong.

@shadowrylander
Copy link

shadowrylander commented Aug 31, 2020

Entirely possible; I'll get back to you on that. Am I supposed to be unable to create pools, though? It seems everyone has no trouble upgrading their pools.

@shadowrylander
Copy link

Also, I'm using a ZFS root on all my systems, which is why I can't upgrade in-place; I'd be rebooting with another zfsUnstable version without upgrading the pool, which would render my system inoperable. Rebuilding and switching doesn't seem to work properly on my system(s).

@hmenke
Copy link
Member Author

hmenke commented Aug 31, 2020

I just built an ISO and I can create pools in a VM just fine.

@shadowrylander
Copy link

Can you give me the config file for the iso?

@shadowrylander
Copy link

This is my current config for the ISO, built using nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-graphical-gnome.nix default.nix:

# This module defines a NixOS installation CD that contains GNOME.

{ config, lib, pkgs, ... }:

with lib;

{
  imports = [ ./installation-cd-graphical-base.nix ];

  nixpkgs.overlays = [ (import ../../../../../zfsBackports.nix) ];
  # boot.kernelPackages = pkgs.linuxPackages_zen;
  environment.systemPackages = with pkgs; [ vscodium zfsUnstable black python38 rsync etcher kitty bat exa diskus git nixops sd tmux byobu neovim curl wget xz woeusb ];
  # boot.initrd.kernelModules = [ "zfsUnstable" ];
  # boot.initrd.availableKernelModules = [ "zfsUnstable" ];
  # boot.initrd.supportedFilesystems = [ "zfsUnstable" "xfs" "btrfs" "ext4" "fat" "vfat" ];
  # boot.supportedFilesystems = [ "zfsUnstable" "xfs" "btrfs" "ext4" "fat" "vfat" ];
  # boot.zfs.enableUnstable = true;
  # boot.extraModulePackages = with config.boot.kernelPackages; [ zfsUnstable ];

  isoImage.edition = "gnome";

  services.xserver.desktopManager.gnome3.enable = true;

  services.xserver.displayManager = {
    gdm = {
      enable = true;
      # autoSuspend makes the machine automatically suspend after inactivity.
      # It's possible someone could/try to ssh'd into the machine and obviously
      # have issues because it's inactive.
      # See:
      # * https://github.com/NixOS/nixpkgs/pull/63790
      # * https://gitlab.gnome.org/GNOME/gnome-control-center/issues/22
      autoSuspend = false;
    };
    autoLogin = {
      enable = true;
      user = "nixos";
    };
  };

}

@shadowrylander
Copy link

I can't seem to update the kmod version; it's still stuck at 0.8.4; I also cannot create new pools, with the same errors as before.

@shadowrylander
Copy link

I'm also using a modified version of your overlay, @hmenke:

# From: [u/_hmenke](https://www.reddit.com/user/_hmenke/)
# Answer: https://www.reddit.com/r/NixOS/comments/ihc2se/help_in_packaging_the_latest_zfs_release/g2zifld?utm_source=share&utm_medium=web2x&context=3

self: super: 
let
  patches = [];
  version = "2.0.0-rc1";
  src = self.fetchFromGitHub {
    owner = "openzfs";
    repo = "zfs";
    rev = "zfs-${version}";
    sha256 = "0d1m5zwgqzfwbscvb60zvzkjgl5nkbvas22vjsyci3xygz0qwjsb";
  };
in
{
  linuxPackages_latest = super.linuxPackages_latest.extend (linuxPackagesSelf: linuxPackagesSuper: {
    zfsUnstable = linuxPackagesSuper.zfsUnstable.overrideAttrs (oldAttrs: rec {
      inherit patches version src;
      name = "zfs-kernel-${version}-${linuxPackagesSuper.kernel.version}";
      postPatch = (builtins.replaceStrings [ "./module/zfs/zfs_ctldir.c" ] [ "./module/os/linux/zfs/zfs_ctldir.c" ] oldAttrs.postPatch);
    });
  });

  linuxPackages_latest_xen_dom0 = super.linuxPackages_latest_xen_dom0.extend (linuxPackagesSelf: linuxPackagesSuper: {
    zfsUnstable = linuxPackagesSuper.zfsUnstable.overrideAttrs (oldAttrs: rec {
      inherit patches version src;
      name = "zfs-kernel-${version}-${linuxPackagesSuper.kernel.version}";
      postPatch = (builtins.replaceStrings [ "./module/zfs/zfs_ctldir.c" ] [ "./module/os/linux/zfs/zfs_ctldir.c" ] oldAttrs.postPatch);
    });
  });

  linuxPackages_zen = super.linuxPackages_zen.extend (linuxPackagesSelf: linuxPackagesSuper: {
    zfsUnstable = linuxPackagesSuper.zfsUnstable.overrideAttrs (oldAttrs: rec {
      inherit patches version src;
      name = "zfs-kernel-${version}-${linuxPackagesSuper.kernel.version}";
      postPatch = (builtins.replaceStrings [ "./module/zfs/zfs_ctldir.c" ] [ "./module/os/linux/zfs/zfs_ctldir.c" ] oldAttrs.postPatch);
    });
  });

  zfsUnstable = super.zfsUnstable.overrideAttrs(oldAttrs: rec {
    inherit patches version src;
    name = "zfs-user-${version}";
    postPatch = (builtins.replaceStrings [ "./lib/libshare/nfs.c" ] [ "./lib/libshare/os/linux/nfs.c" ] oldAttrs.postPatch) + ''
      substituteInPlace ./config/zfs-build.m4 --replace "/etc/default" "$out/etc/default"
      substituteInPlace ./contrib/initramfs/conf.d/Makefile.am \
        --replace "/usr/share/initramfs-tools/conf.d" "$out/usr/share/initramfs-tools/conf.d"
      substituteInPlace ./contrib/initramfs/conf-hooks.d/Makefile.am \
        --replace "/usr/share/initramfs-tools/conf-hooks.d" "$out/usr/share/initramfs-tools/conf-hooks.d"
    '';
  });
}

@jonringer
Copy link
Contributor

you'll want:

  boot.supportedFilesystems = [ "zfs" ];
  boot.zfs.enableUnstable = true;

to use the unstable version, and enable zfs

@shadowrylander
Copy link

I tried with both, but they didn't work; I'll try again and confirm.

@jonringer
Copy link
Contributor

actually, looking at your command, nix-build -A config.system.build.isoImage -I nixos-config=modules/installer/cd-dvd/installation-cd-graphical-gnome.nix default.nix this will inherit the nixpkgs from your channels, which probably won't have the changes, you also need to set nixpkgs to somehting that includes the changes.

please see #96432 (comment)

@shadowrylander
Copy link

Didn't work; I set your options in the config and added the the -I nixpkgs-overlays=[relative zfsUnstable overlay path] to the command, but the kmod version still remains at 0.8.4, and the zpool creation errors still occur.

@hmenke
Copy link
Member Author

hmenke commented Aug 31, 2020

RIght now it's a real pain and since you are struggling with correctly building an image, you should just wait for about a week or so until the unstable channel is fixed. Honestly I also don't get why you are so focussed on creating pools with 2.0.0-rc1 rather than just create the pool with 0.8.4, install normally and then upgrade the pool to 2.0.0-rc1 after everything is set up successfully.


With that out of the way, my cdimage.nix reads:

{config, pkgs, ...}:
{
  imports = [
    <nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix>
    <nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
  ];
  boot.kernelPackages = pkgs.linuxPackages_latest;
  boot.supportedFilesystems = [ "zfs" ];
  boot.zfs.enableUnstable = true;
  nix.nixPath = [
    "nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz"
    "nixos-config=/etc/nixos/configuration.nix"
    "/nix/var/nix/profiles/per-user/root/channels"
  ];
}

Note that I have set a custom NIX_PATH that points to the master branch on GitHub so that you can get the correct version of zfsUnstable. This is definitely not a permanent solution because in the long run this will result in countless rebuilds on your local machine, because the binary cache lags behind.

Then to build the image you also have to override NIX_PATH to point to master.

NIX_PATH="nixpkgs=https://github.com/NixOS/nixpkgs/archive/master.tar.gz:nixos-config=cdimage.nix" nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage

Keep in mind that when you are installing from this image, you will have to add the custom NIX_PATH to the configuration.nix generated by nixos-generate-config and you will probably have to pass the --channel argument to nixos-install. Otherwise your system will use the zfsUnstable that is currently on the unstable channel and that is still 0.8.4, so you have an unbootable system. Make sure that the correct kernel module is picked up before you reboot (I haven't actually tried installing from this image, only creating pools).

@shadowrylander
Copy link

Hmm... You're right; too many temporary changes. I'll take your advice and wait for the update in the unstable channel; so a week or so, correct?

@hmenke
Copy link
Member Author

hmenke commented Aug 31, 2020

You can take a look at https://status.nixos.org/. Currently nixos-unstable is blocked by a failing test. You will have to wait until it is “green” again.

@shadowrylander
Copy link

Found it! Thank you all so much for all the help!

@hmenke hmenke deleted the zfsUnstable branch December 14, 2020 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question as to whether it would be possible to update to the lastest ZFS release candidate
6 participants