Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 152441 - Improved LUKS encrypted root support
Summary: Improved LUKS encrypted root support
Status: VERIFIED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2006-10-22 14:46 UTC by postmodern
Modified: 2006-11-13 11:20 UTC (History)
0 users

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


Attachments
linuxrc.patch (linuxrc.patch,1.37 KB, patch)
2006-10-22 14:50 UTC, postmodern
Details | Diff
linuxrc.patch (professional) (linuxrc.patch,1.20 KB, patch)
2006-10-23 18:05 UTC, postmodern
Details | Diff
initrd.scripts.patch (professional) (initrd.scripts.patch,1.21 KB, patch)
2006-10-23 18:14 UTC, postmodern
Details | Diff
linuxrc.patch (against genkernel rev 453) (linuxrc.patch,642 bytes, patch)
2006-10-24 13:03 UTC, postmodern
Details | Diff
initrd.scripts.patch (against genkernel rev 450) (initrd.scripts.patch,1.18 KB, patch)
2006-10-24 13:09 UTC, postmodern
Details | Diff
patch adding support for resuming from encrypted swap (genkernel-3.4.4.patch,2.78 KB, patch)
2006-10-29 09:31 UTC, bmgomail
Details | Diff
patch adding support for resuming from encrypted swap (genkernel-3.4.4.patch,2.78 KB, patch)
2006-10-29 09:34 UTC, bmgomail
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description postmodern 2006-10-22 14:46:56 UTC
I have changed genkernel's generic linuxrc to add improved LUKS encrypted root support. Instead of pre-appending real_root with "luks:" I added a new kernel argument "crypt_root". If crypt_root is specified but real_root is empty, real_root defaults to /dev/mapper/root. Otherwise startVolumes is invoked again in case the crypto_root contains LVM2/EVMS partitions which real_root references.

I currently use this improved linuxrc script to boot my full hard-disk encrypted Gentoo installs which use LUKS+LVM2.
Comment 1 postmodern 2006-10-22 14:50:26 UTC
Created attachment 100240 [details, diff]
linuxrc.patch

Patch to genkernel's linuxrc that adds improved LUKS encrypted root support. Already tested and used on my own systems.
Comment 2 Chris Gianelloni (RETIRED) gentoo-dev 2006-10-23 09:21:45 UTC
Added to subversion
Comment 3 postmodern 2006-10-23 18:05:52 UTC
Created attachment 100335 [details, diff]
linuxrc.patch (professional)

I updated the code to be more in-line with the genkernel scripting style. Renamed the variable CRYPT_ROOT to LUKS_ROOT, since we're dealing with only LUKS devices. Also added the function startLUKS to handle the initialization of LUKS devices in a similar fashion as other system media.

This patch is against generic/linuxrc of genkernel-3.4.1.
Comment 4 postmodern 2006-10-23 18:14:54 UTC
Created attachment 100336 [details, diff]
initrd.scripts.patch (professional)

Moved the LUKS initialization code into initrd.scripts where all the other media initialization functions reside, so as to follow the genkernel initrd scripting style.

Created the function startLUKS to handle the initialization of LUKS devices. Added the old error-checking/error-messages that the origional LUKS code had. 

Since startVolumes can be called twice I added code to check if /dev/device-mapper exists AND /dev/mapper/control does not exist, to prevent needless recreation of the symbolic-link between the two.

This patch is against generic/initrd.scripts of genkernel-3.4.1.
Comment 5 postmodern 2006-10-23 18:15:27 UTC
Comment on attachment 100240 [details, diff]
linuxrc.patch

Marked obsolete due to new "professional" patches.
Comment 6 Chris Gianelloni (RETIRED) gentoo-dev 2006-10-24 12:37:40 UTC
Ehh... patches against 3.4.1 don't help much, since it means I have to edit everything by hand.

Got a patch against 3.4.3 + your original patch, instead?
Comment 7 postmodern 2006-10-24 13:03:19 UTC
Created attachment 100405 [details, diff]
linuxrc.patch (against genkernel rev 453)

Professional linuxrc patch against genkernel svn -r 453.
Comment 8 postmodern 2006-10-24 13:09:59 UTC
Created attachment 100407 [details, diff]
initrd.scripts.patch (against genkernel rev 450)

Professional initrd.scripts patch against genkernel svn -r 450.
Comment 9 Chris Gianelloni (RETIRED) gentoo-dev 2006-10-25 15:44:39 UTC
Updated with the newest patches... thanks...
Comment 10 Chris Gianelloni (RETIRED) gentoo-dev 2006-10-25 15:57:20 UTC
Fixed in 3.4.4
Comment 11 bmgomail 2006-10-29 09:31:49 UTC
Created attachment 100724 [details, diff]
patch adding support for resuming from encrypted swap
Comment 12 bmgomail 2006-10-29 09:34:59 UTC
Created attachment 100725 [details, diff]
patch adding support for resuming from encrypted swap

Since I needed support for an encrypted swap device to resume from, I added an additional parameter "crypt_swap", which, if set, opens the given device as "/dev/mapper/swap".

By using "resume2=swap:/dev/mapper/swap" with "crypt_swap", one is able to resume from the encrypted swap device. (Of course, one has to configure the swap device and "/etc/conf.d/cryptfs" accordingly)

In the course of adding support for this, I added the functionality to drop to a shell if cryptsetup fails. Alternatively, one may skip opening the particular device as well.

Attached patch is against genkernel-3.4.4
Comment 13 Chris Gianelloni (RETIRED) gentoo-dev 2006-11-13 11:20:46 UTC
OK.  I've added this patch, too.  Please open new bugs for any new patches.