Page 1 of 1

Booting FR/KL distros from iso

Posted: Fri Sep 01, 2023 8:20 am
by wiak

If you have a working grub2 you can boot any and all FR/KL distros straight from their iso using the following grub.cfg stanza formats. I used these (alternative options) to boot KLU-jam-XFCEbase-1.0 iso, but just straight into normal grub.cfg and not using or needing the likes of Ventoy, SG2D or ISObooter3.
This is a well-known method for using grub2 to boot live isos straight from the iso file. For example: https://www.linux.com/training-tutorial ... iso-grub2/
https://forums.gentoo.org/viewtopic-t-7 ... 2+iso.html
https://community.linuxmint.com/tutorial/view/1846
https://www.gnu.org/software/grub/manua ... l#loopback

However, it would certainly be a great convenience if a script was used to auto-construct the stanza in similar way to wd_grubconfig. I have never tried any release of ISObooter (though intended to), but imagine from reading posts in its thread that it likely provides such a script that is tailored for several distros.

NOTE1 from below that I had a partition on my SSD harddrive that had label "archive", so I just used that one in the following, which worked and save2flash successfully saved to my /dev/nvme0n1p8 partition (that had LABEL "archive" and into /Sessions folder there, which was made automatically by following grub.cfg stanza (i.e. no need to create the savedir folder manually). Can change the setpart= to any labelled partition anywhere on your system (including into the usb stick if you wish)
NOTE2 that the isopath below is for iso in / directory of the partition. If in, say, /KLU-jam, change to 'set isopath=/KLU-jam/KLU-jam-XFCEbase-1.0.iso':

Code: Select all

menuentry "KLU-jam-XFCEbase-1.0.iso" {
  echo "Booting ..."
  set isopath=/KLU-jam-XFCEbase-1.0.iso
  set distname=KLU-jam-XFCEbase
  set revision=1.0
  set savepart=archive
  set savedir=Sessions
  search --no-floppy --file --set=root $isopath
  loopback loop $isopath
  set root=(loop)
  linux (loop)/vmlinuz w_bootfrom=$isopath w_changes=LABEL=${savepart}=/${savedir}/${distname}-${revision} w_changes1=RAM2
  initrd (loop)/initrd.gz
}

Note that if you haven't labelled any partition (or either way) you could alternatively use the UUID method such as:

Code: Select all

menuentry "KLU-jam-XFCEbase-1.0.iso" {
  echo "Booting ..."
  set isopath=/KLU-jam-XFCEbase-1.0.iso
  set distname=KLU-jam-XFCEbase
  set revision=1.0
  set savedir=Sessions
  search --no-floppy --file --set=root $isopath
  loopback loop $isopath
  set root=(loop)
  linux (loop)/vmlinuz w_bootfrom=$isopath w_changes=UUID=7d34b88e-bc8e-4bb6-86cf-d619c3b545a9=/${savedir}/${distname}-${revision} w_changes1=RAM2
  initrd (loop)/initrd.gz
}

Use your own UUID where you want save folder to be of course.

NOTE3 therefore that no, you don't need Ventoy, or SDG2, or ISObooter3 for that matter; all you need to do is manually add stanza like the above to your typical grub2 set up. However, I think ISObooter3, if it provided this KL-variant grub2 stanza via its grub stanza construct script would be a nice convenience. Like Ventoy (or to a lesser extent SG2D) I presume you could then simply drop isos into a prepared location and boot them immediately without any manual intervention.
NOTE also that above doesn't really need that currently provided distname or revision in the stanza, but better to do so in case you want to boot from multiple different KL isos including these that are simply different revisions... That way alternative subdirs are used for each KL distro's upper_changes save folders (which is also the arrangement of KL distros for Ventoy use). i.e. avoids clash of different distro revision save folder location. Basically, all FR-based distros work fine with all typical modes when booted from iso per the above methodology.


Re: Booting FR/KL distros from iso

Posted: Fri Sep 01, 2023 1:34 pm
by wiak

Whilst I myself only rarely boot from iso, in case it proves useful to anyone, for example maybe with Qemu booting, I have included a variation of the above in wd_grubconfig utility since it was an easy addition. You can download that new version using:

Code: Select all

wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/wd_grubconfig && chmod +x wd_grubconfig

The boot from iso grub.cfg stanzas generated (one for LABEL and one for UUID) are intended for the scenario when you simply download the KL/FR iso into an empty directory that you wish to be your bootfrom directory on partition of choice (usually Linux formatted for persistence). For example you might make an empty directory /KLU-jam and put the KL iso in there along with a copy of wd_grubconfig. There is no need to extract anything from the iso.

If you then open a terminal at that directory and run the command:

Code: Select all

./wd_grubconfig

As usual, you will get exact/correct grub.cfg stanzas for your system and bootfrom location (albeit you need to use the boot from iso grub stanzas that wd_grubconfig will include in its output for this scenario (or look in the created report file grubconfig.txt, which stores a copy of the generated report). The boot from iso stanzas are simple versions of the first post of this thread, especially created for this simple boot iso in own directory case. On then booting the KL distro using the appropriate stanza provided, the upper_changes folder will get automatically created in the same directory the iso has been stored in.

NOTE WELL: That's all there is to it; you do not need to extract anything from the KL iso - just use it without extraction. All the usual w_changes persistence modes will be usable. By default the wd_grubconfig provided stanzas are for w_changes=RAM2 save on demand mode.

EDIT: Make sure you have progname="wd_grubconfig"; version="1.0.2"; revision="-rc5" since I made a last minute blunder and had to upload a few times...


Re: Booting FR/KL distros from iso

Posted: Fri Sep 01, 2023 2:29 pm
by wiak

Please double check above since late at night and I messed up again so re-uploaded. Current download should now be progname="wd_grubconfig"; version="1.0.2"; revision="-rc5"

Have to sleep now - please let me know if you find it isn't booting the iso. Should be now though.


Re: Booting FR/KL distros from iso

Posted: Fri Sep 01, 2023 2:43 pm
by rockedge
wiak wrote: Fri Sep 01, 2023 2:29 pm

Please double check above since late at night and I messed up again so re-uploaded. Current download should now be progname="wd_grubconfig"; version="1.0.2"; revision="-rc5"

Have to sleep now - please let me know if you find it isn't booting the iso. Should be now though.

Ahhhh the miracle of git pull!

Yes the version numbers look correct. Testing it out during the course of the day.