How can I add ISOs from a directory to Grub to boot any of them?

I boot from an external SSD. A small portion of this is my full install Garuda Linux, with a large portion being an exFAT partition. My garuda portion is encrypted, if that matters.

What I'd like to be able to do is, after entering my decryption password and landing on Grub, I'd like to be able to select a menu option to boot from an ISO that's living on the unencrypted exFAT partition. I'd like to keep a directory of different ISOs to live boot from.

How can I do this? I've tried in the past and ended up with errors and non-boots. Is there a simple solution?

Define simple and my 0,02 $, no.

:slight_smile:

1 Like

You can create manual grub entries for each ISO. That being said, I don't know if I would call it simple or not.

Something like this:

3 Likes

First search hit:

exFAT, as an extension of FAT, is not capable of storing discretionary access control metadata. This is why all the files on an exFAT volume appear to be 777 permissions.

2 Likes

For what it's worth, I boot my multiboot machine purely from custom entries in a /boot/grub/custom.cfg file that I created in the distro that controls grub on my machine.

Custom.cfg file is governed by the /etc/grub.d/41_custom script which I rename 09_custom so it will show up before the standard grub entries governed by the 10_linux script.

Using that rather than adding custom entries directly into the 40_custom file means I never need to run sudo update-grub after I edit it. If I change isos and then change the custom.cfg file accordingly, that is very convenient.

All the isos I wish to direct-boot are saved onto a separate partition labeled "ISO-LIVE". All my partitions are labelled.

The custom entries for all but Rescuezilla were copied/adapted from tutorials/posts from Manjaro and MX Linux forums, since those 2 are my main workhorse distros. Had to do further web research for Rescuezilla's grub entries because simply adapting Clonezilla's didn't work.

You can see there are differences in the entries, apart from just the naming of their respective kernel and initrd files. I don't know the reasons and complexities behind that (I just know how to research and adapt), but it's likely the distros use slightly different live boot techniques, requiring different boot parameters. Especially MX/antiX with their highly developed live system.

So here are my entries for direct boot of isos:

menuentry "CloneZilla ISO" {
  # The string between " and " below is the actual name of the ISO file you just downloaded
  # and copied to the relevant directory and is the current 
  # version as of the last edit to this [HowTo].
  set ISOFile="/clonezilla-live-20210609-hirsute-amd64.iso"
  search --no-floppy -f --set=root --label ISO-LIVE 
  loopback loop ($root)$ISOFile
  linux (loop)/live/vmlinuz boot=live components config findiso=$ISOFile ip=frommedia toram=filesystem.squashfs union=overlay
  initrd (loop)/live/initrd.img
}
menuentry "Rescuezilla ISO" {
  insmod ext2
  set ISOFile="/rescuezilla-2.2-64bit.hirsute.iso"
  search --no-floppy -f --set=root --label ISO-LIVE 
  loopback loop ($root)$ISOFile
  linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$ISOFile quiet noeject fastboot toram fsck.mode=skip noprompt splash
  initrd (loop)/casper/initrd.lz
}
menuentry "MX Workbench 2020 (MX19) ISO"  {
    set isofile="/MX-Workbench_2020-Final_x64.iso"
	set bootparms="from=all quiet"
    search --no-floppy -f --set=root --label ISO-LIVE 
    loopback loop $isofile
    linux  (loop)/antiX/vmlinuz fromiso=$isofile $bootparms
    initrd  (loop)/antiX/initrd.gz
}
menuentry "MX19.4 AHS June 2021 ISO"  {
    set isofile="/MX-19.4_June_ahs.iso"
	set bootparms="from=all quiet"
    search --no-floppy -f --set=root --label ISO-LIVE 
    loopback loop $isofile
    linux  (loop)/antiX/vmlinuz fromiso=$isofile $bootparms
    initrd  (loop)/antiX/initrd.gz
}
menuentry "Manjaro July 2021 ISO with Timeshift"  {
    set isofile="/manjaro-xfce-21.0.7-210614-linux510.iso"
    set dri="free"
    set lang="en_US"
    search --no-floppy -f --set=root --label ISO-LIVE 
    probe -u $root --set=abc
    set pqr="/dev/disk/by-uuid/$abc"
    loopback loop $isofile
    linux  (loop)/boot/vmlinuz-x86_64  img_dev=$pqr img_loop=$isofile driver=$dri tz=$timezone lang=$lang copytoram
    initrd  (loop)/boot/intel_ucode.img (loop)/boot/initramfs-x86_64.img
}

Bottom line? For each different distro's iso, it would help you to check the corresponding forum or wiki. There may be slight differences. if there isn't much info for a distro, adapt from what material you have and reboot to see if your entry works. YOu may need to experiment a bit before you get it.

4 Likes

Might be simpler to look into Ventoy - keep multiple ISOs ready to boot on USB instead...

I know - too easy....

2 Likes

My direct-boot isos are for rescue and cloning purposes for my computer, eg MX's Boot Repair and Chroot Rescue Scan tools, MX Workbench's whole suite of tools, Clonezilla for cloning my partitions, Manjaro because it had Timeshift preinstalled (yes, I could remaster my MX isos to include Timeshift in the live iso, but I couldn't be bothered). This way I don't have to dig up a live USB, I just boot straight into the iso I need.

Rescuezilla was a test because I'd read it was Clonezilla with a nice GUI. But I found that due to the GUI interface, it presented very limited options and it took forever to scan and list my numerous partitions. So I went back to just using original Clonezilla .

Any other isos I want to test run I just do in VM.

1 Like

Oops, I use the same custom.cfg (learned from gohlip :slight_smile: ) , maybe the part with uncrypted and crypted make me confused.

Why not refind? :thinking: :wink: :blush:

Same. He was the grub master!

2 Likes

Nicely done!
Although it might be better or easier to use configfile, to get ISO's original grub menu, instead of sweating finding specific parameters, different for each ISO. :wink:

I have written a couple of tutorials about this (Manjaro and Garuda). I guess forum search or Tutorials index doesn't work well. :laughing:

1 Like

No idea if it does this or not - it’s only the answer to everything else! :grin:

1 Like

I didn't search for those tutorials because I'd already found sufficient boot live iso tutorials in Manjaro and mx forums, and it didn't occur to me that a live iso might have a grub config file.

For MX, live boot is via syslinux bootloader and I don't know if there is even a grub config on the live media.

Anyway, it works for me.

I do use the configfile method in most of my grub entries for actually-installed distros.

2 Likes

Not all do. Arch uses syslinux, but for example, Garuda and Manjaro use grub, and others.
A live ISO has a complete OS/FS when opened/booted. When it uses grub, you can loop-boot it with one of the two methods. Without configfile, you have to find kernel params, which may change in time from the distro. With configfile, you use the ISO grub, with possible AI features, like Garuda (and Manjaro) provide. :wink:

2 Likes

I learnt something new. Thanks @petsam!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.