#759744 debian-cd: loopback.cfg support for booting ISOs from within GRUB

#759744#5
Date:
2014-08-29 21:28:13 UTC
From:
To:
[Cc-ing Colin as requested]

I'm hereby following up our discussion we - Steve McIntyre, Colin
Watson and me - had at DebConf14.

Quoting from http://www.supergrubdisk.org/wiki/Loopback.cfg:

| A loopback.cfg is basically just a grub.cfg that's designed to be
| used to boot a live distribution from an iso file on a filesystem
| rather than an actual physical CD.

This is a very handy feature for booting ISO directly from within
GRUB and it would be great if this feature would be supported by the
official Debian ISOs as well. (For example Ubuntu and Grml support
it since quite some time and it's really useful.)

Quoting tools/boot/utopic/boot-amd64 from
"bzr branch lp:~ubuntu-cdimage/debian-cd/ubuntu debian-cd":

,---- [ debian-cd.bzr/tools/boot/utopic/boot-amd64 ]
|     cat >> $CDDIR/boot/grub/loopback.cfg <<EOF
| menuentry "${livelabel#^}" {
|         set gfxpayload=keep
|         linux   $CASPER_KERNEL $KERNEL_PARAMS $DEFAULT_PRESEED boot=casper$liveparams iso-scan/filename=\${iso_path} quiet splas
| h --
|         initrd  $CASPER_INITRD
| }
| EOF
`----

The options/params would need to be adjusted accordingly
for sure (e.g. like boot=live instead of boot=casper, findiso
instead of iso-scan,...), but the idea should be clear.

regards,
-mika-

#759744#10
Date:
2014-08-29 22:04:09 UTC
From:
To:
Hi,

Cc-ing also debian-live ML to make sure they are aware of the issue.

* Michael Prokop [Fri Aug 29, 2014 at 11:28:13PM +0200]:
[...]

Adrian just pointed out to me that in #757883 he was working on this
feature for supporting it in debian-live, that might be useful for
further development and sharing this feature between debian-cd and
debian-live.

regards,
-mika-

#759744#15
Date:
2014-08-29 22:48:47 UTC
From:
To:
El 30/08/14 00:04, Michael Prokop escribió:

This implementation is not easy as it might seem at first glance.

So, you know in Debian Live we have both fromiso and findiso boot
parametres. You define them in Grub so that they Linux kernel gets them
as a cmdline and then initrd detects fromiso or findiso and acts
accordingly.

So fromiso needs the exact location of the iso (including its device)
and, you might guess the Debian Live is loop mounted and then usual
stuff ocurrs like trying to mount the squashfs big image and the boot of
Debian Live continues.

Findiso does not need the exact location of the iso. The reason is that
it loops all its devices and its partitions till it finds the iso. Then
once it knows its device it acts as fromiso boot parametre does.

So, I will give three examples so that you get the point:

* fromiso=/dev/sda1/live/mydistro.iso
*
fromiso=/dev/disk/by-uuid/c02dcbff-3222-4555-b333-c2351b73f88b/live/mydistro.iso

* findiso=/live/mydistro.iso

Basically if you want loopback.cfg to work you need a findiso alike option.

So, what you need in Debian-cd (or other packages) is a findiso alike
option. This option is not currently available (please read on).

Support for a findiso alike option is already implemented in: #724931 .
However the actual patch status for adding this functionality seems to
affect many packages and I think it has been kind of put aside because
of other higher priorities.

I plan myself on reviewing the patch and discovering why it affects so
many packages ( 3 or 4 ) while Debian Live only needed live-boot to be
modified (well, fromiso boot parametre had already implemented when I
ported grml's findiso code, maybe that explains the reason why I find
Debian Live much more simple).

So, that's it:
* Either someone implements a findiso alike option from scratch that
affects as less packages as possible
* Either current patch is stripped down and fully tested

so that somehow less packages are affected than with the current patch.

* or current patch is fully tested

because, you know, it has some additional features like discovering new
isos that are great. Additional features are, you know, more things to
test, so it makes the patch less likely to be frozen or even considered
so I suppose you have to weight it pros and cons.

By the way if Debian Live's findiso implementation is handy you can find
its associated bug at: #656135.

Feel free to make depend this bug on #724931 if that it makes sense (not
very experienced on BTS and Debian policies).

adrian15

#759744#20
Date:
2014-08-30 13:44:17 UTC
From:
To:
Hi *,

and I hacked stuff up for debian-cd some years ago [1][2][3][4], but the
interest was quite low back then.

Greets
Evgeni

[1] Message-ID: <4EF5B96C.30205@debian.org>,
<20111229160619.GJ8519@dorei.kerker.die-welt.net>,
<20111231174244.GM8519@dorei.kerker.die-welt.net>
[2]
http://anonscm.debian.org/cgit/users/evgeni/tmp/cdrom-detect.git/commit/?id=6129510d3c28dee41d6e03db331009148b9d0fb9
[3]
http://anonscm.debian.org/cgit/users/evgeni/tmp/debian-installer.git/commit/?id=f641a79c2cda851cd067a6daa460203e98f22b67
[4]
http://anonscm.debian.org/cgit/users/evgeni/tmp/iso-scan.git/commit/?id=c61a8073e1c4283e5e426209041c1d082801b7b5