Bug#724931: loop-mounted ISO images

2013-09-30 Thread Andreas Cadhalpun
[Now follows a somewhat lengthy text. If you are bored, jump directly to 
the conclusion.]

On 30.09.2013 01:58, wrote ian_br...@fastmail.net:

you wrote:


Please include the kernel module loop.ko in all installation ISOs.

It would be awesome, if you could also add iso-scan to the install
ISOs, so that one can use the 'findiso=' boot option. This would make
it possible to install from the ISO without having to mount it
manually during the installation.


I refer you to my recent posts (including patch) on exactly this
subject:

http://lists.debian.org/debian-boot/2013/09/msg00292.html

http://lists.debian.org/debian-boot/2013/09/msg00509.html

-- which have so far been completely ignored.

As for the iso-scan package, if you search the source code for the
string findiso, you will not find it.

http://packages.debian.org/wheezy/iso-scan

You can confirm this by looking through the hd-media images directly:

 $ zcat initrd.gz | strings | grep -i findiso
 $

http://ftp.us.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/hd-media/

So if this functionality was present at one time, it is not now.

Here is some relevant prior discussion:

http://lists.debian.org/debian-boot/2009/10/threads.html#00064

An unnecessarily complex solution was eventually adopted:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=564441

You will note that my patch does exactly what was asked for then, and
what you are requesting now. I will post this information to bug
#724931; hopefully we can get my patch, or something like it, applied to
the standard installer ISOs, and not just the hd-media images, which
apparently are the only ones to include the iso-scan package, but do not
even allow specification of the ISO image file via a boot parameter.


When installing from the Debian netinstall ISO using Grub2's loopback
method, and manually mounting the ISO to /cdrom, the installation
process gets stuck at apt-setup


I suggest to you that if you copy the kernel and initrd files out of the
ISO image, into the USB flashdrive(?) filesystem, you do not have to use
GRUB, you can just use Syslinux, as the ISO usually does. This means
that you can potentially use the existing Syslinux menu system, if this
is also copied out of the ISO image.

Could you tell me what exactly is the significance of
Grub2-Multiboot-ISO-USB? Is there some package or utility by that
name?


-- Ian Bruce



Hi Ian,

thank you for this information on bug #724931. I read your posts and it 
seems that the developers are aware of the problem, but choose not to act:


On Thu, 5 Sep 2013 11:44:54 -0400
Joey Hess j...@kitenet.net wrote:

iso-scan is part of the Debian installer[1].

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. 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.
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? 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.


On 30.09.2013 01:58, wrote ian_br...@fastmail.net:

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 and indeed:
$ zcat initrd.img | strings | grep -i findiso
if [ -n $FINDISO ]  [ ${TORAM} ]
if is_mountpoint /root/lib/live/mount/findiso
umount /root/lib/live/mount/findiso
rmdir --ignore-fail-on-non-empty 
/root/lib/live/mount/findiso \
findiso=*)
FINDISO=${_PARAMETER#findiso=}
export FINDISO
if [ -n ${FINDISO} ]
if [ -f ${mountpoint}/${FINDISO} ]
mkdir -p /live/findiso
mount -t ${fstype} -o ro,noatime ${devname} 
/live/findiso
loopdevname=$(setup_loop /live/findiso/${FINDISO} loop 
/sys/block/loop* 0 )




I 

Bug#724931: loop-mounted ISO images

2013-09-30 Thread ian_bruce
On Mon, 30 Sep 2013 13:10:01 +0200
Andreas Cadhalpun andreas.cadhal...@googlemail.com wrote:

 j...@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_br...@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
-