Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 383545 - sys-kernel/genkernel: openLuks seems to fail
Summary: sys-kernel/genkernel: openLuks seems to fail
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Hosted Projects
Classification: Unclassified
Component: genkernel (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Genkernel Maintainers
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2011-09-18 21:57 UTC by Thomas Bettler
Modified: 2011-11-08 21:44 UTC (History)
1 user (show)

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


Attachments
genkernel-fix_false_luksOpen_error.patch (genkernel-fix_false_luksOpen_error.patch,267 bytes, patch)
2011-09-18 22:06 UTC, Thomas Bettler
Details | Diff
Fix bogus LUKS open error (0001-Fix-return-value-of-crypt_filter-which-caused-bogus-.patch,1.17 KB, patch)
2011-10-31 21:59 UTC, Sebastian Pipping
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Bettler 2011-09-18 21:57:57 UTC
Environment:
System with crypt_swap and a key stored on sdc (usb)

Actual Results:
On booting genkernel reports: "Failed to open LUKS device ${LUKS_DEVICE}"
Even though cryptsetup actually mapped the partition!!!
I consequence I get prompted for LUKS_DEVICE, KEY and KEYDEV.

Expected Results:
No false Error
Comment 1 Thomas Bettler 2011-09-18 22:06:23 UTC
Created attachment 286925 [details, diff]
genkernel-fix_false_luksOpen_error.patch

The proposed patch fixes initrd.scripts with the false error from appearing.

The error appears due to splash set_msg exiting with $?=-1 and thus getting captured after crypt_filter function evaluation at line:872

Many thanks for applying this patch or any similar.
Comment 2 Thomas Bettler 2011-10-31 20:22:59 UTC
Commit f3e0797d42ff2e0a9066a6364b1e063da9679651 makes impossible to evaluate the return value of crypt_filter() at the calling position 862 in initrd.scripts

 861  # At this point, keyfile or not, we're ready!
 862  crypt_filter "${gpg_cmd}cryptsetup ${cryptsetup_options} luksOpen ${LUKS_DEVICE} ${LUKS_NAME}"
 863  if [ $? -eq 0 ]
 864  then
 865      good_msg "LUKS device ${LUKS_DEVICE} opened" ${CRYPT_SILENT}
 866      break
 867  else
 868      bad_msg "Failed to open LUKS device ${LUKS_DEVICE}" ${CRYPT_SILENT}
 869      DEV_ERROR=1
 870      KEY_ERROR=1
 871      KEYDEV_ERROR=1
 872  fi

It might be better to integrate the functionality directly without function call.
Comment 3 Sebastian Pipping gentoo-dev 2011-10-31 21:59:23 UTC
Created attachment 291387 [details, diff]
Fix bogus LUKS open error

The proposed patch could use improvement on the self-explanation front.
Please test my proposed replacement.  Branch "383545" also holds this patch.
Comment 4 Thomas Bettler 2011-11-07 22:44:12 UTC
Hi Sebastian

Thank you very much for your fix. It provides a small and elegant solution, much better and easier than I could imagine.

I tested it and it works as supposed. You may integrate it to the branch.

Thanks a lot!
Comment 5 Sebastian Pipping gentoo-dev 2011-11-08 17:26:24 UTC
Thanks for testing!

Branch "383545" has been merged, genkernel 3.4.20 has been released and added to the main tree:

+*genkernel-3.4.20 (08 Nov 2011)
+
+  08 Nov 2011; Sebastian Pipping <sping@gentoo.org> +genkernel-3.4.20.ebuild:
+  Bump to 3.4.20
+

Closing.
Comment 6 Thomas Bettler 2011-11-08 21:44:53 UTC
Thank you very much, I got 3.4.20 already!