It seems that cryptsetup (for some times) is able to allocate (or trigger the allocation) of needed loop devices automatically. In such a case, a luksOpen failure won't left useless allocated loop devices. Reproducible: Always Steps to Reproduce: 1. create a luks volume on a regular file 2. configure it in /etc/crypttab 3. when dmcrypt starts, skip it (^D) Actual Results: an allocated loop device has been created Expected Results: the loop devices table should stay clean After this test, if you: - restart dmcrypt and type a correct password : failure (about wrong size loop device or something like this) - restart dmcrypt and type a correct password : this should (finally) work The leftover loop devices and consequent failures due to wrong loop allocations could be avoided, at least with some version of cryptsetup and/or some kernel version and/or some kernel options and this should be the preferred solution.
this is already doable with the current code. instead of doing: mount='crypt-loop-home' source='/dev/loop0' loop_file='/mnt/x' do: mount='crypt-loop-home' source='/mnt/x' we don't want to delete the existing losetup support since it'd break support with older kernels which lack automatic loop device creation.