[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#724931: loop-mounted ISO images



On Mon, 30 Sep 2013 13:10:01 +0200
Andreas Cadhalpun <andreas.cadhalpun@googlemail.com> wrote:

> <joey@kitenet.net> wrote:
>
>> iso-scan is part of the Debian installer.
>>
>> However, it is only included in the hd-media initrd. There is no
>> reason to include it on the regular CD initrd, because isohybrid
>> allows mounting the USB stick directly.
> 
> How can isohybrid replace the findiso option? At least for me it makes
> a huge difference, whether I can use my 32 GB stick for ONE
> netinst.iso or ONE HUNDRED.

I said the same thing, in my post to the mailing list:

    This is unnecessarily destructive, and makes it hard to install
    multiple distributions on the same flashdrive, or to use it for
    other purposes. The smallest flashdrive you can currently buy is
    8GB; it makes no sense that you would have to have a different one
    for every live ISO you might want to use.

> Aside from that it is an unnecessary complexity to download the
> hd-media initrd, which is why I never did that, but instead only
> downloaded the loop.ko.

Even if you did download the hd-media initrd, it still wouldn't allow
you to use a boot parameter to specify the pathname of the ISO image
file you want to use. It appears that it just grabs anything it can find
that looks like a Debian ISO, and asks the user to confirm it.

Note that "loop.ko" is included on the ISO (but not the initrd), in the
form of /pool/main/l/linux/loop-modules-*.udeb packages.

> By the way, I think that it is reason enough to include findiso on the
> regular CD, when several persons request it. One always has to balance
> gain and cost and the only cost that I can see, is that the ISO will
> be larger. I don't know how big findiso is, but probably less then 100
> kB. The loop.ko file is 37 kB, so together this gives 137 kB. Since
> the netinst.iso is about 270 MB, it would grow by about 0.05 %. Who
> will be hurt by that?

My patch, which seems to do everything that's necessary, is a few
hundred BYTES (uncompressed). So including that and the "loop.ko" module
in the initrd will increase the size of the ISO image by about one part
in ten thousand, which certainly doesn't seem worth worrying about.

> On the other hand according to many post etc. on the subject, which I
> read in the course of the last two years or so, I imagine that a lot
> of people would like it. I certainly would have installed Debian
> earlier, if this option had been included on the netinst.iso.

As you point out next, it appears that this functionality is included on
the Debian live CD. What possible rationale could there be for having it
there, but not on the installer image?

I actually didn't think to investigate the live CD. It never occurred to
me that one might have it, and the other not.

> <ian_bruce@fastmail.net> wrote:
>
>> As for the iso-scan package, if you search the source code for the
>> string "findiso", you will not find it.
> 
> I don't know about the hd-media initrd, but there is a debian live ISO
> at: http://live.debian.net/
>
> There the option 'findiso=$iso' works as advertised

The hd-media initrd is no different from the ones on the standard
installer ISO, in this regard:

    $ zcat debian-7.1.0-amd64-i386-netinst/install.{386,amd}/{,gtk/}initrd.gz |
          strings | grep -i findiso
    $ 

    $ zcat debian-7.1.0-amd64-hd-media/{,gtk/}initrd.gz |
          strings | grep -i findiso
    $ 

My "loopmount=" patch is again attached to this message, for the sake of
the bug report.


-- Ian Bruce
--- debian-7.1.0-amd64.orig/var/lib/dpkg/info/cdrom-detect.postinst	2013-09-10 17:45:08.305375296 -0700
+++ debian-7.1.0-amd64/var/lib/dpkg/info/cdrom-detect.postinst	2013-09-28 00:14:38.058505180 -0700
@@ -17,9 +17,10 @@
 try_mount() {
 	local device=$1
 	local type=$2
+	local options=$3
 
 	local ret=1
-	if mount -t $type -o $OPTIONS $device /cdrom; then
+	if mount -t $type -o $options $device /cdrom; then
 		log "CD-ROM mount succeeded: device=$device fstype=$type"
 		if [ -e /cdrom/.disk/info ]; then
 			CDNAME=$(cat /cdrom/.disk/info)
@@ -68,6 +69,7 @@
 		CDFS=iso9660
 		FATFS=vfat
 		OPTIONS=ro,exec
+		LOOPFS=vfat,ext4,iso9660
 		;;
 	hurd)
 		CDFS=iso9660fs
@@ -95,6 +97,19 @@
 
 mkdir /cdrom 2>/dev/null || true
 
+for arg in $(cat /proc/cmdline); do
+	case $arg in
+	loopmount=*)
+		LOOPMOUNT=${arg#loopmount=}
+		LOOPMOUNT=${LOOPMOUNT#/}
+		;;
+	esac
+done
+
+if [ "$LOOPMOUNT" ]; then
+	mkdir /loop 2>/dev/null || true
+fi
+
 # Need to wait for the usb device scan to complete
 if [ "$OS" = "linux" ]; then
   for count in 1 2 3 4 5 6 8 9 10; do
@@ -109,26 +124,45 @@
 fi
 
 while true; do
-	WRONG=
+	WRONG=''
 
-	devices="$(list-devices cd; list-devices maybe-usb-floppy)"
-	for device in $devices; do
-		if try_mount $device $CDFS; then
-			break 2
-		fi
-	done
-	
-	devices="$(list-devices usb-partition)"
-	for device in $devices; do
-		if try_mount $device $CDFS; then
-			db_set cdrom-detect/hybrid true
-			break 2
-		fi
-		if try_mount $device $FATFS; then
-			db_set cdrom-detect/usb-hdd true
-			break 2
-		fi
-	done
+	if [ "$LOOPMOUNT" ]
+	then
+
+		loopfile=/loop/${LOOPMOUNT}
+		devices="$(list-devices partition; list-devices cd)"
+		for device in $devices; do
+			if mount -o $OPTIONS -t $LOOPFS $device /loop; then
+				if [ -f $loopfile ] && try_mount $loopfile $CDFS loop,$OPTIONS; then
+					break 2
+				else
+					umount /loop
+				fi
+			fi
+		done
+
+	else
+
+		devices="$(list-devices cd; list-devices maybe-usb-floppy)"
+		for device in $devices; do
+			if try_mount $device $CDFS $OPTIONS; then
+				break 2
+			fi
+		done
+
+		devices="$(list-devices usb-partition)"
+		for device in $devices; do
+			if try_mount $device $CDFS $OPTIONS; then
+				db_set cdrom-detect/hybrid true
+				break 2
+			fi
+			if try_mount $device $FATFS $OPTIONS; then
+				db_set cdrom-detect/usb-hdd true
+				break 2
+			fi
+		done
+
+	fi
 
 
 	if [ "$WRONG" ]; then

Reply to: