Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 273029 - sys-fs/cryptsetup-1.0.6-r2: timeout function in dm-crypt-start.sh waiting for removable media breaks config file parsing
Summary: sys-fs/cryptsetup-1.0.6-r2: timeout function in dm-crypt-start.sh waiting for...
Status: RESOLVED DUPLICATE of bug 243216
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: Inclusion
Depends on: 273039
Blocks:
  Show dependency tree
 
Reported: 2009-06-07 12:45 UTC by Marc Schiffbauer
Modified: 2015-04-12 20:24 UTC (History)
0 users

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


Attachments
dm-crypt-start.sh.patch (dm-crypt-start.sh.patch,680 bytes, patch)
2009-06-07 12:48 UTC, Marc Schiffbauer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Schiffbauer gentoo-dev 2009-06-07 12:45:25 UTC
The dmcrypt startup scripts fail severely if its waiting for a USB key and there are more than one crypt-targets configured.

The reason is wrong file descriptor  handling. PATCH attached.

Ending in errors like this:
* Skipping invalid line in /etc/conf.d/dmcrypt: ='/key'
/lib/rcscripts/addons/dm-crypt-start.sh: line 285: =/key: No such file or directory
* source "" for crypt-test2 missing, skipping...


Reproducible: Always

Steps to Reproduce:
1. Have more than one target configured in /etc/conf.d/dmcrypt that need a keyfile
   from removable media
2. start dmcrypt with the removable media missing
3. boom

Actual Results:  
The script fails to configure most of the devices.

Expected Results:  
The sctip should wait until the timeout happens

Its clear to me why this is happening:

the main loop that parses /etc/conf.d/dmcrypt connects that file to stdin.

Now if we need a keyfile and the mount fails we enter the read_abort() function which reads one character from stdin. But stdin is not connected to the terminal but to /etc/conf.d/dmcrypt so it gets many "wrong" answers until it finds a "y" or "n" in the file. (You can see many lines on the screen showing the "Stop waiting after 22 attempts (mount failed)? (yes/No)" message...)

After that parsing of the current line fails because the line is incomplete ending in an error like this:

"/lib/rcscripts/addons/dm-crypt-start.sh: line 285: =/key: No such file or directory"
(The line has been "read away" by the read_abort function until the first "y", the complete line in  my file is "key='/key'")

The solution is to use another filedescriptor for reading /etc/conf.d/dmcrypt that 0.

(Patch will be attached)
Comment 1 Marc Schiffbauer gentoo-dev 2009-06-07 12:48:00 UTC
Created attachment 193791 [details, diff]
dm-crypt-start.sh.patch
Comment 2 SpanKY gentoo-dev 2015-04-12 20:24:03 UTC
was fixed here:
https://sources.gentoo.org/sys-fs/cryptsetup/files/1.0.6-r2-dm-crypt-start.sh?r1=1.1&r2=1.2

and then improved upon here:
https://sources.gentoo.org/sys-fs/cryptsetup/files/1.5.1-dmcrypt.rc?r1=1.2&r2=1.3

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