Skip to content

Commit

Permalink
cryptsetup, lvm2, systemd: Break cyclic dependency at a different point
Browse files Browse the repository at this point in the history
The cyclic dependency of systemd → cryptsetup → lvm2 → udev=systemd
needs to be broken somewhere.  The previous strategy of building
cryptsetup with an lvm2 built without udev (#66856) caused the
installer.luksroot test to fail.  Instead, build lvm2 with a udev built
without cryptsetup.

Fixes #96479.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
  • Loading branch information
andersk committed Sep 3, 2020
1 parent 02a2649 commit f4b2c9d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
8 changes: 3 additions & 5 deletions nixos/modules/system/boot/stage-1.nix
Expand Up @@ -87,9 +87,7 @@ let
# copy what we need. Instead of using statically linked binaries,
# we just copy what we need from Glibc and use patchelf to make it
# work.
extraUtils = let
# Use lvm2 without udev support, which is the same lvm2 we already have in the closure anyways
lvm2 = pkgs.lvm2.override { udev = null; }; in pkgs.runCommandCC "extra-utils"
extraUtils = pkgs.runCommandCC "extra-utils"
{ nativeBuildInputs = [pkgs.buildPackages.nukeReferences];
allowedReferences = [ "out" ]; # prevent accidents like glibc being included in the initrd
}
Expand All @@ -113,8 +111,8 @@ let
copy_bin_and_libs ${pkgs.utillinux}/sbin/blkid
# Copy dmsetup and lvm.
copy_bin_and_libs ${getBin lvm2}/bin/dmsetup
copy_bin_and_libs ${getBin lvm2}/bin/lvm
copy_bin_and_libs ${getBin pkgs.lvm2}/bin/dmsetup
copy_bin_and_libs ${getBin pkgs.lvm2}/bin/lvm
# Add RAID mdadm tool.
copy_bin_and_libs ${pkgs.mdadm}/sbin/mdadm
Expand Down
1 change: 0 additions & 1 deletion nixos/tests/installer.nix
Expand Up @@ -317,7 +317,6 @@ let
texinfo
unionfs-fuse
xorg.lndir
(lvm2.override { udev = null; }) # for initrd (extra-utils)

# add curl so that rather than seeing the test attempt to download
# curl's tarball, we see what it's trying to download
Expand Down
13 changes: 7 additions & 6 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -17246,11 +17246,7 @@ in

criu = callPackage ../os-specific/linux/criu { };

cryptsetup = callPackage ../os-specific/linux/cryptsetup {
# cryptsetup only really needs the devmapper component of cryptsetup
# but itself is used as a library in systemd (=udev)
lvm2 = lvm2.override { udev = null; };
};
cryptsetup = callPackage ../os-specific/linux/cryptsetup { };

cramfsprogs = callPackage ../os-specific/linux/cramfsprogs { };

Expand Down Expand Up @@ -18032,7 +18028,12 @@ in

lsscsi = callPackage ../os-specific/linux/lsscsi { };

lvm2 = callPackage ../os-specific/linux/lvm2 { };
lvm2 = callPackage ../os-specific/linux/lvm2 {
# udev is the same package as systemd which depends on cryptsetup
# which depends on lvm2 again. But we only need the libudev part
# which does not depend on cryptsetup.
udev = udev.override { cryptsetup = null; };
};
lvm2_dmeventd = callPackage ../os-specific/linux/lvm2 {
enableDmeventd = true;
enableCmdlib = true;
Expand Down

0 comments on commit f4b2c9d

Please sign in to comment.