Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 245266 - sys-fs/cryptsetup-1.0.6-r2 - dmcrypt fails to open multiple passphrase luksvolumes
Summary: sys-fs/cryptsetup-1.0.6-r2 - dmcrypt fails to open multiple passphrase luksvo...
Status: RESOLVED DUPLICATE of bug 243216
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major with 1 vote (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: REGRESSION
Depends on:
Blocks: 259253
  Show dependency tree
 
Reported: 2008-11-02 11:55 UTC by fabian
Modified: 2009-12-08 15:33 UTC (History)
8 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fabian 2008-11-02 11:55:51 UTC
sys-fs/cryptsetup-1.0.6-r2: using multiple targets in /etc/conf.d/dmcrypt cryptsetup fails to invoke those properly. it fails with an error that no matching passphrase is found, without even asking for one.

Reproducible: Always

Steps to Reproduce:
enter multiple targets in /etc/conf.d/dmcrypt eg:
# /etc/conf.d/dmcrypt

target='crypt-home'
source='/dev/sda5'

target='crypt-data'
source='/dev/sdb1'

target=crypt-backup
source='/dev/hdb1'
2. start dmcrypt /etc/init.d/dmcrypt start, (i have manually opened the home-volume to be able to post this ;) )
Actual Results:  
maya / # /etc/init.d/dmcrypt start
 * Caching service dependencies ...                                                                 [ ok ]
 * Setting up dm-crypt mappings ...
 * dm-crypt mapping crypt-home is already configured
 * dm-crypt map crypt-data ...
 * cryptsetup will be called with :   luksOpen /dev/sdb1 crypt-data
Command failed: No key available with this passphrase.

 * failure running cryptsetup                                                                       [ !! ]
 * source "" for crypt-backup missing, skipping...
 * Failed to setup dm-crypt devices                                                                 [ !! ]


Expected Results:  
it should ask for each passwd and open the volumes then

i'm running baselayout-2.0.0 with openrc-0.3.0-r1
/etc/init.d/dmcrypt is in runlevel boot
Comment 1 fabian 2008-11-06 00:55:10 UTC
the error seems to originate in /lib/rcscripts/addons. cryptsetup is invoked before the source parameter is eval-ed.
Comment 2 Tim Weber 2008-11-16 17:22:24 UTC
No. The error occurs in /lib/rcscripts/addons/dm-crypt-start.sh, but not because of an empty source parameter.

The main "while read targetline" loop has its stdin redirected from /etc/conf.d/dmcrypt (see the "done" line). This will read each config line and look for "swap=" or "target=" lines.

If the current line is none of these, the variable it defines will be set. If it _is_ a "swap" or "target" line, the dm_crypt_execute_dmcrypt() function will be called with all of the variables that are set, _before_ the last line that has been read is evaluated. This is a kind of queueing mechanism: Before starting to read a new section, all data that has been read will be evaluated. Finally, after all lines have been read, a last evaluation run will be started.

There's nothing wrong with this, except for one thing: If the current dmcrypt volume isn't the last one defined, dm_crypt_execute_dmcrypt() will be called from _within_ the while loop, and stdin will not be the keyboard, but /etc/conf.d/dmcrypt, and it's rather unlikely that the rest of the file will correspond to your passphrase. ;)

This also explains the second error message where no source has been set: cryptsetup reads all of stdin, i.e. everything after the "target" line of the last section. Now stdin has been read completely, the while loop terminates, and dm_crypt_execute_dmcrypt() is called without any of the variables that would follow the "target" line are set.

So. That's the _problem_. Let's talk about solving it. I'll try hacking around on the script in a moment.
Comment 3 Tim Weber 2008-11-16 17:33:33 UTC
Downgrading to sys-fs/cryptsetup-1.0.6-r1 works, because there cryptsetup will be fed /dev/console explicitly. However, as mentioned in the ChangeLog, this will probably cause trouble when e.g. running under X, so a more elaborate solution is needed. Since I currently don't have X installed on the machine I use cryptsetup on, I'm afraid I can't work on one, though.
Comment 4 fabian 2008-11-16 17:46:08 UTC
ok. I see. I'll downgrade for now, as I don't need it working with X either. Thanks a lot.
Comment 5 Victor Mataré 2009-02-24 14:47:09 UTC
well if we talk about X, that redirecting-stdin thingy becomes quite messy. I say there cannot be any stdin redirections when cryptsetup is called. Everything else is bogus&bloat. That means we'll have to fix the config parser. Maybe just use a different FD than stdin. I'll try that once I find the time (next week or so).
Comment 6 Marc Schiffbauer gentoo-dev 2009-02-24 17:30:27 UTC
please also see #257556

If I add a commect line between the target and the source line all is fine.... so I do not know if this bug really is dup of #257556
Comment 7 Sven Wegener gentoo-dev 2009-04-15 22:37:01 UTC

*** This bug has been marked as a duplicate of bug 243216 ***