Comment 31 for bug 684280

Revision history for this message
Martin Laclaustra (martin-laclaustra) wrote :

Disconnecting the loop device may not always be desired after using "toram": See https://bugs.launchpad.net/ubuntu/+source/lupin/+bug/1960457/comments/33

Thus, it may be advisable to ask for that explicitly. I propose using "detach". So the system should be booted with "toram detach".

Solving this problem requires less than 10 lines. I hope that developers can add the patch below.

For this patch to work it is necessary to fix the issue mentioned previously beforehand: https://bugs.launchpad.net/ubuntu/+source/lupin/+bug/1960457/comments/34 first (4 lines)

Here is the patch:

--- scripts/casper_1477
+++ scripts/casper
@@ -75,6 +75,8 @@
                 export TORAM="Yes" ;;
             todisk=*)
                 export TODISK="${x#todisk=}" ;;
+ detach)
+ export DETACH="Yes" ;;
             hostname=*)
                 export CMD_HOST="${x#hostname=}" ;;
             userfullname=*)
@@ -1042,6 +1044,13 @@
     run_scripts /scripts/casper-bottom
     [ "$quiet" != "y" ] && log_end_msg

+ if [ "${live_dest}" ] && [ -z "$PERSISTENT" ] && [ "$DETACH" ]; then
+ if grep -q '^[^ ]* /root/isodevice ' /proc/mounts; then
+ losetup -d /dev/loop0
+ umount /root/isodevice
+ fi
+ fi
+
     # Close the fd's associated with debconf-communicate.
     exec 3>&- 4<&-
     rm -f /tmp/debconf-in.fifo

There are other options for implementing this, for example:
a) detaching as the default behavior and allowing for a "nodetach" argument in cmdline
b) removing "/root" from the patch (in the 2 lines where it appears), will make this work without fixing https://bugs.launchpad.net/ubuntu/+source/lupin/+bug/1960457/comments/34 first.