On 20/11/2007 René Pavlík wrote: > 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" ].
You're correct, and i don't understand why this code has been implemented in the first time. checking for matching $loopmajor and $major doesn't work at all. The question is rather how else we could verify that a loopback device has been used and needs to be deleted at stop. I cannot imagine any way to get the loopback device from the source file except something like losetup -a | grep -m1 "($src)$" | sed -e 's/:.*//g' which is a rather unclean solution. David, do you have any better solution? i guess you do ;-) greetings, jonas -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]