From 3974fb283ac02045c9769b74faffe9661ea11458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Thu, 19 Sep 2013 14:19:10 +0200 Subject: [PATCH 1/2] Updating lvm2 to 2.02.100. --- .../linux/lvm2/assume-uevent-generated.patch | 39 ------------------- pkgs/os-specific/linux/lvm2/default.nix | 11 +++--- 2 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 pkgs/os-specific/linux/lvm2/assume-uevent-generated.patch diff --git a/pkgs/os-specific/linux/lvm2/assume-uevent-generated.patch b/pkgs/os-specific/linux/lvm2/assume-uevent-generated.patch deleted file mode 100644 index 4098d042fd53..000000000000 --- a/pkgs/os-specific/linux/lvm2/assume-uevent-generated.patch +++ /dev/null @@ -1,39 +0,0 @@ -Work around LVM/cryptsetup errors like: - - semid 32768: semop failed for cookie 0xd4d41f4: incorrect semaphore state - Failed to set a proper state for notification semaphore identified by cookie value 223166964 (0xd4d41f4) to initialize waiting for incoming notifications. - -and (when running "cryptsetup --debug"): - - Uevent not generated! Calling udev_complete internally to avoid process lock-up. - -Here for some reason libdm *thinks* that the uevent hasn't been -emitted, so it calls udev_complete. But the uevent actually *has* -been emitted, so udev calls ‘dmsetup udevcomplete’ as well, leading to -a race. - -This is probably a reoccurence of the problem described here: - - http://www.redhat.com/archives/dm-devel/2011-August/msg00075.html - http://www.redhat.com/archives/linux-lvm/2011-September/msg00023.html - -which was fixed in the kernel, so it's not clear why it's surfacing -again. Maybe netlink_broadcast_filtered() has started returning some -other bogus error code. - -diff -ru -x '*~' LVM2.2.02.98/libdm/ioctl/libdm-iface.c LVM2.2.02.98-new/libdm/ioctl/libdm-iface.c ---- LVM2.2.02.98/libdm/ioctl/libdm-iface.c 2012-10-15 10:24:58.000000000 -0400 -+++ LVM2.2.02.98-new/libdm/ioctl/libdm-iface.c 2012-10-15 14:19:06.774363736 -0400 -@@ -1754,9 +1754,12 @@ - - if (ioctl_with_uevent && dm_udev_get_sync_support() && - !_check_uevent_generated(dmi)) { -+ log_debug("warning: Uevent might not be generated!"); -+#if 0 - log_debug("Uevent not generated! Calling udev_complete " - "internally to avoid process lock-up."); - _udev_complete(dmt); -+#endif - } - - if (!_dm_ioctl_unmangle_names(dmt->type, dmi)) diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix index ec68304c9355..a3bbfa834b18 100644 --- a/pkgs/os-specific/linux/lvm2/default.nix +++ b/pkgs/os-specific/linux/lvm2/default.nix @@ -1,19 +1,17 @@ { stdenv, fetchurl, pkgconfig, udev, utillinux, coreutils }: let - v = "2.02.98"; + v = "2.02.100"; in stdenv.mkDerivation { name = "lvm2-${v}"; src = fetchurl { - url = "ftp://sources.redhat.com/pub/lvm2/old/LVM2.${v}.tgz"; - sha256 = "0r6q6z8ip6q5qgkzng0saljassp4912k6i21ra10vq7pzrc0l0vi"; + url = "ftp://sources.redhat.com/pub/lvm2/releases/LVM2.${v}.tgz"; + md5 = "9629cf5728544d7e637cafde1f73d777"; }; - patches = [ ./assume-uevent-generated.patch ]; - configureFlags = "--disable-readline --enable-udev_rules --enable-udev_sync --enable-pkgconfig --enable-applib"; @@ -25,6 +23,9 @@ stdenv.mkDerivation { --replace /usr/bin/tr ${coreutils}/bin/tr substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \ --replace /usr/sbin/lvm $out/sbin/lvm + + sed -i /DEFAULT_SYS_DIR/d Makefile.in + sed -i /DEFAULT_PROFILE_DIR/d conf/Makefile.in ''; #patches = [ ./purity.patch ]; From c0fd88748a66c9ca38092fdbf7e97f765c8e411d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Fri, 20 Sep 2013 09:20:14 +0200 Subject: [PATCH 2/2] Making lvm2 install systemd stuff, and combine all in a single derivation. --- pkgs/os-specific/linux/lvm2/default.nix | 5 +++++ pkgs/top-level/all-packages.nix | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix index a3bbfa834b18..8cdd317b7b17 100644 --- a/pkgs/os-specific/linux/lvm2/default.nix +++ b/pkgs/os-specific/linux/lvm2/default.nix @@ -40,6 +40,11 @@ stdenv.mkDerivation { '' substituteInPlace $out/lib/udev/rules.d/13-dm-disk.rules \ --replace $out/sbin/blkid ${utillinux}/sbin/blkid + + # Systemd stuff + mkdir -p $out/etc/systemd/system $out/lib/systemd/system-generators + cp scripts/blk_availability_systemd_red_hat.service $out/etc/systemd/system + cp scripts/lvm2_activation_generator_systemd_red_hat $out/lib/systemd/system-generators ''; meta = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 21a3a3c87d00..b2066e823882 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6805,6 +6805,15 @@ let systemd = callPackage ../os-specific/linux/systemd { }; + # In nixos, you can set systemd.package = pkgs.systemd_with_lvm2 to get + # LVM2 working in systemd. + systemd_with_lvm2 = pkgs.lib.overrideDerivation pkgs.systemd (p: { + name = p.name + "-with-lvm2"; + postInstall = p.postInstall + '' + cp ${pkgs.lvm2}/lib/systemd/system-generators/* $out/lib/systemd/system-generat + ''; + }); + sysvinit = callPackage ../os-specific/linux/sysvinit { }; sysvtools = callPackage ../os-specific/linux/sysvinit {