From 0afbbc68db2613e404f484b3cb18577842855bac Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Sep 29 2011 00:26:24 +0000 Subject: Workaround for the crypto-on-lvm-on-crypto disk layout Resolves: #741655 --- diff --git a/fedora-crypto-lvm-hack b/fedora-crypto-lvm-hack new file mode 100755 index 0000000..c7c4313 --- /dev/null +++ b/fedora-crypto-lvm-hack @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Test if the given device is an LVM PV. If yes, activate its VG. +# +# Suggested by Milan Brož in +# https://bugzilla.redhat.com/show_bug.cgi?id=741655#c19 + +device="$1" +[ -b "$device" ] || exit 1 + +blkid -t TYPE=LVM2_member "$device" > /dev/null && \ + vgchange -a y $(pvs --noheadings -o vg_name "$device") diff --git a/fedora-crypto-lvm-hack.patch b/fedora-crypto-lvm-hack.patch new file mode 100644 index 0000000..30789cf --- /dev/null +++ b/fedora-crypto-lvm-hack.patch @@ -0,0 +1,23 @@ +Fedora workaround for bz741655 + +After unlocking a crypto device, give LVM a chance to assemble a VG from it. +Needed to make the crypto-on-lvm-on-crypto disk layout work. + +Non-upstream patch. Will be obsoleted as soon as LVM gets the planned +'policy daemon which will activate LV according to some system policy'. + +Index: systemd-36/src/cryptsetup-generator.c +=================================================================== +--- systemd-36.orig/src/cryptsetup-generator.c ++++ systemd-36/src/cryptsetup-generator.c +@@ -132,8 +132,10 @@ static int create_disk( + "RemainAfterExit=yes\n" + "TimeoutSec=0\n" /* the binary handles timeouts anyway */ + "ExecStart=" SYSTEMD_CRYPTSETUP_PATH " attach '%s' '%s' '%s' '%s'\n" ++ "ExecStartPost=/lib/systemd/fedora-crypto-lvm-hack '/dev/mapper/%s'\n" + "ExecStop=" SYSTEMD_CRYPTSETUP_PATH " detach '%s'\n", + name, u, strempty(password), strempty(options), ++ name, + name); + + if (has_option(options, "tmp")) diff --git a/systemd.spec b/systemd.spec index 1c88aa1..3375e0a 100644 --- a/systemd.spec +++ b/systemd.spec @@ -2,7 +2,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Version: 36 -Release: 3%{?dist} +Release: 4%{?dist} License: GPLv2+ Group: System Environment/Base Summary: A System and Service Manager @@ -44,8 +44,12 @@ Source1: macros.systemd Source2: systemd-sysv-convert # Stop-gap, just to ensure things work out-of-the-box for this driver. Source3: udlfb.conf +# Workaround https://bugzilla.redhat.com/show_bug.cgi?id=741655 +Source4: fedora-crypto-lvm-hack # We revert this one for https://bugzilla.redhat.com/show_bug.cgi?id=741078 Patch0: 0001-unit-fix-complementing-of-requirement-deps-with-Afte.patch +# Workaround https://bugzilla.redhat.com/show_bug.cgi?id=741655 +Patch100: fedora-crypto-lvm-hack.patch # For sysvinit tools Obsoletes: SysVinit < 2.86-24, sysvinit < 2.86-24 @@ -109,6 +113,7 @@ SysV compatibility tools for systemd %prep %setup -q %patch0 -p1 -R +%patch100 -p1 %build %configure --with-rootdir= --with-distro=fedora --with-rootlibdir=/%{_lib} @@ -167,6 +172,9 @@ install -m 0755 %{SOURCE2} %{buildroot}%{_bindir}/ mkdir -p %{buildroot}%{_sysconfdir}/modprobe.d/ install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/modprobe.d/ +# install the Fedora crypto-LVM hack +install -m 0755 %{SOURCE4} %{buildroot}/lib/systemd/ + %clean rm -rf $RPM_BUILD_ROOT @@ -260,6 +268,7 @@ fi /usr/bin/systemd-stdio-bridge /usr/bin/systemd-analyze /lib/systemd/systemd-* +/lib/systemd/fedora-crypto-lvm-hack /lib/udev/rules.d/*.rules /lib/systemd/system-generators/systemd-cryptsetup-generator /lib/systemd/system-generators/systemd-getty-generator @@ -353,6 +362,10 @@ fi %{_bindir}/systemd-sysv-convert %changelog +* Thu Sep 29 2011 Michal Schmidt - 36-4 +- Workaround for the crypto-on-lvm-on-crypto disk layout +- Resolves: #741655 + * Sun Sep 25 2011 Michal Schmidt - 36-3 - Revert an upstream patch that caused ordering cycles - Resolves: #741078