Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 390079 - sys-kernel/genkernel starts lvm in the "wrong" place when dmcrypt is used
Summary: sys-kernel/genkernel starts lvm in the "wrong" place when dmcrypt is used
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords:
: 520788 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-11-10 11:09 UTC by Patrick Lauer
Modified: 2015-12-30 04:39 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
genkernel-3.4.52.3-lvm-twice.png (genkernel-3.4.52.3-lvm-twice.png,14.97 KB, image/png)
2015-12-28 16:17 UTC, Thomas Deutschmann (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Lauer gentoo-dev 2011-11-10 11:09:33 UTC
In the following scenario genkernel fails to enable lvm volumes:

One harddisk, completely encrypted, with lvm volumes inside

As lvm starts before cryptsetup in the linuxrc it cannot enable the lvm-in-crypt volumes, thus failing to start and forcing the user to use the rescue shell at every boot.

--- /usr/share/genkernel/defaults/linuxrc       2011-11-04 23:47:23.000000000 +0100
+++ linuxrc     2011-11-09 22:31:03.756117585 +0100
@@ -334,6 +334,9 @@
        fi
 fi
 
+# need to start here
+startVolumes
+
 mkdir -p "${NEW_ROOT}"
 CHROOT="${NEW_ROOT}"

This small patch starts lvm again after cryptsetup - worst case it just re-finds all the devices (no obvious side-effects), but it allows both combinations of crypt-in-lvm and lvm-in-crypt
Comment 1 Xake 2011-11-11 06:15:18 UTC
TBH I think I have not seen crypt-in-lvm (i.e. individual LVs being crypted), just lvm-in-crypt (i.e. the volumegroup is crypted).

So I will look into this.
Comment 2 Rick Farina (Zero_Chaos) gentoo-dev 2015-08-20 16:10:00 UTC
*** Bug 520788 has been marked as a duplicate of this bug. ***
Comment 3 Rick Farina (Zero_Chaos) gentoo-dev 2015-08-20 16:14:54 UTC
I agree, this causes not pain to just detect volumes again.

accepted, thanks
Comment 4 Thomas Deutschmann (RETIRED) gentoo-dev 2015-12-28 16:17:35 UTC
Created attachment 421012 [details]
genkernel-3.4.52.3-lvm-twice.png

@ Rick: Are you sure this was still needed?

From my understanding I have a setup which would require these changes (lvm-in-crypt):

I have two disks (sda and sdb) in mdraid 1 (mirror). md0 is my unencrypted boot partition and md1 (the rest) is encrypted with LUKS. In (on top of) my encrypted partition (md1) I have my LVM layer with partitions for "/", "/home" and swap.

When I now boot with an initramfs containing your patch  (https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=33c3c90cce2a242a7d6e45effa48ebbd91f63cff, first released with sys-kernel/genkernel-3.4.52.3) I'll see this:

1. mdadm will assemble my RAID

2. I'll see the first LVM scan (which will detect nothing on my system, because my LVM volumes resides on the still encrypted partition).

3. I'll get the LUKS prompt which will open "md1".

4. The second LVM scan is started (which will now find my LVM volumes).

5. A third LVM scan is started (this is new!).

[genkernel-3.4.52.3-lvm-twice.png]

So for me it looks like that this bug 390079 was fixed long time ago and this change isn't required anymore.
Comment 5 Thomas Deutschmann (RETIRED) gentoo-dev 2015-12-29 10:35:56 UTC
After reading the commit logs/source code up to 2009 I would call this bug invalid: For me it looks like the original reporter (Patrick) didn't used CRYPT_ROOT.

If you set CRYPT_ROOT we are already re-scanning for LVM volumes after opening LUKS, see https://gitweb.gentoo.org/proj/genkernel.git/tree/defaults/initrd.scripts#n1292

I vote for reverting commit 33c3c90cce2a242a7d6e45effa48ebbd91f63cff because from my view it doesn't make _any_ sense. But if I miss something it would be glad if somebody could explain. Thanks.
Comment 6 Rick Farina (Zero_Chaos) gentoo-dev 2015-12-30 04:39:03 UTC
agreed, but next time please open a new bug for the new issue and simply reference the old bug

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=c7a2fbef56b808b97135307621dc43b4fe970a44