Bug#538221: [codesite-noreply at google.com: Issue 34 in cryptsetup: Command failed: device-mapper: create ioctl failed: Device or resource busy]

Jonas Meurer jonas at freesources.org
Thu Aug 27 21:51:36 UTC 2009


clone 538221 -1
severity -1 minor
reassign -1 dmsetup
retitle -1 wrong udev rule for dm devices
reassign 538221 cryptsetup
close 538221
thanks

hey,

On 27/08/2009 Stuart Pook wrote:
> On 27/08/09 01:59, Jonas Meurer wrote:
> >great, thanks a lot. please also give information about whether you have
> >setup any custom udev rules.
> 
> I have just done a apt-get update && apt-get dist-upgrade
> 
> I think that the problem comes from the fact that I'm unlocking a
> snapshot when I have the orginal already unlocked.

yes, now i get the picture ...

> This first sequence works.
> 
> + kpartx -d /dev/mapper/services_ROOT_snapshot
> + '[' -b /dev/mapper/services_ROOT1 ']'
> + '[' -b /dev/mapper/services_ROOT_snapshot ']'
> + cryptsetup remove services_ROOT_snapshot
> + '[' -b /dev/mapper/services_ROOT ']'
> + '[' -b /dev/vg0/services_ROOT_snapshot ']'
> + lvremove --force /dev/vg0/services_ROOT_snapshot
> + '[' true ']'
> + lvcreate --size 256M --snapshot --name services_ROOT_snapshot /dev/vg0/services_ROOT
> + unlock services_ROOT_snapshot
> + local -r name=services_ROOT_snapshot
> + '[' '!' -b /dev/mapper/services_ROOT_snapshot ']'
> + /lib/cryptsetup/scripts/passdev ????????????????????????????
> + cryptsetup luksOpen /dev/mapper/vg0-services_ROOT_snapshot services_ROOT_snapshot --key-file -
> + readonly disk0=/dev/mapper/services_ROOT_snapshot
> + disk0=/dev/mapper/services_ROOT_snapshot
> + kpartx -a /dev/mapper/services_ROOT_snapshot
> 
> Now it becomes more complicated. I luksOpen vg0-services_ROOT and run kpartx on it and then luksOpen on the snapshot fails (with cryptsetup                        2:1.0.7-1).
> 
> + kpartx -d /dev/mapper/services_ROOT_snapshot
> + '[' -b /dev/mapper/services_ROOT1 ']'
> + '[' -b /dev/mapper/services_ROOT_snapshot ']'
> + cryptsetup remove services_ROOT_snapshot
> + '[' -b /dev/mapper/services_ROOT ']'
> + '[' -b /dev/vg0/services_ROOT_snapshot ']'
> + lvremove --force /dev/vg0/services_ROOT_snapshot
> + unlock services_ROOT
> + local -r name=services_ROOT
> + '[' '!' -b /dev/mapper/services_ROOT ']'
> + /lib/cryptsetup/scripts/passdev ?????????????????????????????????
> + cryptsetup luksOpen /dev/mapper/vg0-services_ROOT services_ROOT --key-file -
> + kpartx -a /dev/mapper/services_ROOT
> + '[' true ']'
> + lvcreate --size 256M --snapshot --name services_ROOT_snapshot /dev/vg0/services_ROOT
> + unlock services_ROOT_snapshot
> + local -r name=services_ROOT_snapshot
> + '[' '!' -b /dev/mapper/services_ROOT_snapshot ']'
> + /lib/cryptsetup/scripts/passdev ???????????????????????????????????????
> + cryptsetup luksOpen /dev/mapper/vg0-services_ROOT_snapshot services_ROOT_snapshot --key-file -
> + logger -s -t start-services -p daemon.err luksOpen with ??????????????????????????????? failed
> start-services: luksOpen with ??????????????????????????????????????????????????? failed

you try to luksOpen the device twice, first the lvm volume, and then the
lvm snapshot. This is blocked by cryptsetup. You can overwrite the block
by adding the commandline option '--non-exclusive' to second luksOpen,
but be aware that might lead to other problems. It should be save with
--readonly though.

I finally was able to reproduce your error with the following commands:

lvcreate -L 100M -n test01 vg0
cryptsetup luksFormat /dev/vg0/test01
cryptsetup luksOpen /dev/vg0/test01 ctest01
lvcreate -s /dev/vg0/test01 -L 20M -n test01_snapshot
cryptsetup luksOpen /dev/vg0/test01_snapshot ctest01_snapshot

using the following commandline instead worked for me:

cryptsetup --readonly --non-exclusive luksOpen \
	/dev/vg0/test01_snapshot ctest01_snapshot

> : root; apt-get -t testing install cryptsetup/testing
> Selected version 2:1.0.6+20090405.svn49-1 (Debian:testing) for cryptsetup
> dpkg: warning: downgrading cryptsetup from 2:1.0.7-1 to 2:1.0.6+20090405.svn49-1.
> 
> with the old cryptsetup, it works

yes, this feature (--non-exclusive) was just added in cryptsetup 1.0.7.
unfortunately the --non-exclusive option and it's drawbacks aren't
discussed in the cryptsetup manpage yet, even though the commandline
help of cryptsetup suggests to read the manpage for more information.

i hope that will be fixed soon.

in my opinion the original bug of this report has been found:
--non-exclusive was not used for luksOpening a device that is already
unlocked.

thus this mail will clone the bugreport, retitle the clone to 'wrong udev
rule for dm devices', and close the original one.

greetings,
 jonas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-lvm-maintainers/attachments/20090827/1538f0e4/attachment.pgp>


More information about the pkg-lvm-maintainers mailing list