[Pkg-cryptsetup-devel] Bug#451916: Bug#451916: cryptsetup: loopback device not detached after "/etc/init.d/cryptdisks stop"

René Pavlík rene.pavlik at sysgo.com
Tue Nov 20 02:11:19 UTC 2007


Jonas Meurer wrote:
> On 19/11/2007 Rene Pavlik wrote:
>> There is a not correctly working routine in the mentioned script to handle
>> detaching of loopback devices. After stopping, the device /dev/loopX is still
>> being assigned to the file. Next start of the init script allocates another
>> loopback device.
> 
> Do you mean the case where cryptsetup device setup fails? In this case
> indeed the loopback device is left alone without being removed. I fixed
> that in svn now.
> 
> Or do you mean the regular use case when you successfully setup a file
> as cryptsetup device?

Hi Jonas,

I mean the second case. I set up /etc/crypttab successfully to use a
regular file for crypto-storage. Turning it on by hand works OK and
even turning it on by "/etc/init.d/cryptdisks start" created the
crypto device through a loopback correctly.
The problem was when I made a little tunning change in the
configuration and needed to re-create the device again. So I used
"/etc/init.d/cryptdisks stop" to shut down crypto device. It correctly
detach crypto device from the loopback but NOT detach the loopback
from the regular file.
So I think if the loopback device is allocated by this script it
should be also freed by this script. There is a do_stop() func in the
script (mean in the sourced library). This func tries to do detaching
at the very end:

                # Detach loopback device, if attached
                if [ -f "$src" ] && [ -n "$loopmajor" ] && [
"$loopmajor" = "$major" ]; then
                        losetup -d "/dev/loop$minor" > /dev/null 2>&1
|| true
                fi

but this doesn't work - because of the false condition, especially [
"$loopmajor" = "$major" ].

Regards,

	Rene






More information about the Pkg-cryptsetup-devel mailing list