Bug 911106 - cryptsetup fails silently
Summary: cryptsetup fails silently
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cryptsetup
Version: 18
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Milan Broz
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-02-14 11:38 UTC by Karel Volný
Modified: 2013-04-05 23:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-04-05 23:10:46 UTC


Attachments (Terms of Use)

Description Karel Volný 2013-02-14 11:38:18 UTC
Description of problem:
While experimenting with lvm, I've got into a state when I cannot deconfigure the things' I've set up.
But cryptsetup does not bother to inform that the action has failed.

Version-Release number of selected component (if applicable):
cryptsetup-1.6.0-1.fc18.x86_64

How reproducible:
always

Steps to Reproduce:
1. break your encrypted lvm setup
2. cryptsetup close bla
3. echo $?
4. cryptsetup status bla
  
Actual results:
[root@kvolny mnt]# cryptsetup close bla
[root@kvolny mnt]# echo $?
0
[root@kvolny mnt]# cryptsetup status bla
/dev/mapper/bla is active and is in use.
  type:    LUKS1
  cipher:  -
  keysize: 0 bits
  device:  (null)
  offset:  4040 sectors
  size:    975743032 sectors
  mode:    read/write

Expected results:
[root@kvolny mnt]# cryptsetup close bla
Error: cannot close 'bla' because of ...
[root@kvolny mnt]# echo $?
1

Additional info:

Comment 1 Milan Broz 2013-02-14 11:45:29 UTC
Yes, it should return error code.

Please attach log with added --debug (cryptsetup close bla --debug) and
"dmsetup table bla; dmsetup info -c bla".

How did you created/activated that bla device? (Table seems kind of broken from the status).

Comment 2 Karel Volný 2013-02-14 14:14:28 UTC
(In reply to comment #1)
> Yes, it should return error code.
> 
> Please attach log with added --debug (cryptsetup close bla --debug) and

[root@kvolny sdb]# cryptsetup close bla --debug
# cryptsetup 1.6.0 processing "cryptsetup close bla --debug"
# Running command close.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating crypt device context by device bla.
# Initialising device-mapper backend library.
# dm version   OF   [16384] (*1)
# dm versions   OF   [16384] (*1)
# Detected dm-crypt version 1.11.0, dm-ioctl version 4.23.0.
# Device-mapper backend running with UDEV support enabled.
# dm status bla  OF   [16384] (*1)
# Releasing device-mapper backend.
# Allocating crypt device (null) context.
# Initialising device-mapper backend library.
Zařízení nižší úrovně pod šifrovaným zařízením bla zmizelo.
# dm table bla  OFW    [16384] (*1)
# Releasing crypt device (null) context.
# Releasing device-mapper backend.
# Unlocking memory.
Příkaz úspěšně vykonán.


> "dmsetup table bla; dmsetup info -c bla".

0 975743032 crypt aes-xts-plain 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:18 4040
Name             Maj Min Stat Open Targ Event  UUID                                            
bla              253   2 L--w    2    1      0 CRYPT-LUKS1-a90272ab010f43789b1e43cd98085515-bla


> How did you created/activated that bla device? (Table seems kind of broken
> from the status).

I've used these commands:

cryptsetup luksOpen /dev/sdb2 bla
vgchange -a y

the thing is that running "vgchange -a n" says there are no volume groups
but trying the same without step 1(*), it worked for me to call "cryptsetup close" without having to do "vgchange -a n" at first

(*) in my case, I got things broken by controller reset - hardware problem, which may be possibly simulated by pulling out the cable

Comment 3 Karel Volný 2013-02-14 14:16:02 UTC
oops, right after submitting I've noticed the translations ... once again for colleagues who do not speak Czech:

[root@kvolny sdb]# LANG=C cryptsetup close bla --debug
# cryptsetup 1.6.0 processing "cryptsetup close bla --debug"
# Running command close.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating crypt device context by device bla.
# Initialising device-mapper backend library.
# dm version   OF   [16384] (*1)
# dm versions   OF   [16384] (*1)
# Detected dm-crypt version 1.11.0, dm-ioctl version 4.23.0.
# Device-mapper backend running with UDEV support enabled.
# dm status bla  OF   [16384] (*1)
# Releasing device-mapper backend.
# Allocating crypt device (null) context.
# Initialising device-mapper backend library.
Underlying device for crypt device bla disappeared.
# dm table bla  OFW    [16384] (*1)
# Releasing crypt device (null) context.
# Releasing device-mapper backend.
# Unlocking memory.
Command successful.

Comment 4 Milan Broz 2013-02-19 11:38:22 UTC
I added upstream issue for it here
http://code.google.com/p/cryptsetup/issues/detail?id=149

Comment 5 Karel Volný 2013-02-19 13:31:06 UTC
(In reply to comment #4)
> I added upstream issue for it here
> http://code.google.com/p/cryptsetup/issues/detail?id=149

thankyou

btw, as for the testcase, my problem happens with a broken harddrive which I'm about to return for replacement - would that be worthy to keep it (possibly passing that to you ... if you're stilll nearby :-)) for testing, or is the above output enough?

Comment 6 Milan Broz 2013-03-17 20:28:25 UTC
Fixed in devel git
http://code.google.com/p/cryptsetup/source/detail?r=f64064fe71363a14ab0c62359e451f9cdc39dc50#

I'll release 1.6.1 soon.

For that harddrive - I am not going to RH office anytime soon, perhaps just trash it away... Anyway, thanks.

I simulated bug just by removing device node, that's more friendly to my hw :-)
(It can be done with USB drive too I think.)

Comment 7 Karel Volný 2013-03-22 13:37:27 UTC
cool, thanks

Comment 8 Fedora Update System 2013-03-31 17:37:20 UTC
cryptsetup-1.6.1-1.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/cryptsetup-1.6.1-1.fc18

Comment 9 Fedora Update System 2013-04-01 03:35:36 UTC
Package cryptsetup-1.6.1-1.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cryptsetup-1.6.1-1.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-4621/cryptsetup-1.6.1-1.fc18
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-04-05 23:10:48 UTC
cryptsetup-1.6.1-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.