• Bug#266053: loopback support for cryptsetup

    From Dmitry Borodaenko@1:229/2 to All on Mon Aug 16 16:40:10 2004
    From: [email protected]

    Package: cryptsetup
    Version: 0.1-3
    Severity: wishlist
    Tags: patch

    Attached patch to /etc/init.d/cryptdisks allows to initialize loopback encrypted filesystems.

    It works fine for me, but has several drawbacks: 1) it only works with
    loopback files situated on root partition; 2) umountfs is run before
    cryptdisks on shutdown, so root fs is busy at the moment it's being
    umounted; 3) it uses brute-force method of assigning and detaching loop devices, which can probably break on more complicated loopback setups.

    Related sysvinit bugs: #49670, #138040.

    -- System Information:
    Debian Release: 3.1
    APT prefers unstable
    APT policy: (990, 'unstable')
    Architecture: i386 (i686)
    Kernel: Linux 2.6.5-1-686
    Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8

    Versions of packages cryptsetup depends on:
    ii dmsetup 2:1.00.19-2 The Linux Kernel Device Mapper use ii libc6 2.3.2.ds1-16 GNU C Library: Shared libraries an ii libdevmapper1.00 2:1.00.19-2 The Linux Kernel Device Mapper use ii libpopt0 1.7-4 lib for parsing cmdline parameters

    -- no debconf information

    --- cryptdisks.dpkg-dist 2004-08-14 15:17:12.000000000 +0300
    +++ cryptdisks 2004-08-14 16:23:41.000000000 +0300
    @@ -93,6 +93,24 @@
    PARAMS="$PARAMS $PARAM $VALUE"
    done

    + # Set up loopback devices
    + if test -f "$src" ; then
    + modprobe loop || SKIP=yes
    + LOOP_ID=
    + for i in 0 1 2 3 4 5 6 7 ; do
    + if test "x`cat /sys/block/loop$i/size`" = "x0" ; then
    + LOOP_ID=$i
    + break
    + fi
    + done
    + if test "x$LOOP_ID" = "x" ; then
    + SKIP=yes
    + else
    + losetup /dev/loop$LOOP_ID $src || SKIP=yes
    + src=/dev/loop$LOOP_ID
    + fi
    + fi
    +
    if test "x$SKIP" = "xyes" ; then
    continue
    fi
    @@ -125,6 +143,16 @@
    echo -n "(stopped)"
    fi
    done
    +
    + # Attempt to detach all loopback devices
    + if lsmod | grep -q loop ; then
    + for i in 0 1 2 3 4 5 6 7 ; do
    + if test ! "x`cat /sys/block/loop$i/size`" = "x0" ; then + losetup -d /dev/loop$i
    + fi
    + done
    + fi
    +
    echo "."
    ;;
    restart|reload|force-reload)

    --- SoupGate