grub2-fll-fromiso

Started by eriefisher, 2026/05/25, 14:28:04

Previous topic - Next topic

Teriarch

Unfortunately it won't work:
$ sudo ./60_fll-fromiso  
Found fromiso: MX-25.2_KDE_x64.iso on /dev/nvme0n1p4: /srv/ISO/MX-25.2_KDE_x64.iso
Detected bootloader: unknown in MX-25.2_KDE_x64.iso
Skipping MX-25.2_KDE_x64.iso: unrecognised bootloader layout
For some reason MX-* iso images are not "Full Story" compatible.

hendrikL

#16
http://aptosid.com/debian/pool/main/g/grub2-fll-fromiso/

I think you should fetch the whole program, do not pick the cherries.
And I would read the changlog first.

https://github.com/fullstory/grub2-fll-fromiso/blob/master/debian/changelog

Teriarch

Well, they say: "The chain is only as strong as its weakest link" and considering
there is only one (apart from the trivial config file), we can even dive deeper
into the detection logic in order to find it:
detect_bootloader.sh (stripped from /etc/grub.d/60_fll-fromiso):
#!/bin/sh -e
 
ISOINFO="$(which isoinfo)"
OSIRROX="$(which osirrox)"
 
extract_efi_img() {
        local iso="$1"
        local efi_tmp
        efi_tmp=/tmp/efi.img
        if "${OSIRROX}" -indev "${iso}" -extract /efi.img "${efi_tmp}" \
                        >/dev/null 2>&1 && [ -s "${efi_tmp}" ]; then
                echo "${efi_tmp}"
        else
                rm -f "${efi_tmp}"
        fi
}
 
detect_iso_bootloader() {
        local iso="$1"
        echo Iso Image: $iso
        local efi_img="$(extract_efi_img $iso)" # path to extracted efi.img, or empty
        echo Efi Image: $efi_img
        # grub (BIOS hybrid): kernels.cfg on the ISO9660 layer
        if "${ISOINFO}" -R -i "${iso}" -f 2>/dev/null \
                        | grep -q '^/boot/grub/kernels.cfg$'; then
                echo "grub"
                return
        fi
        # ESP-based: distinguish by FAT contents
        if [ -n "${efi_img}" ]; then
                # grub-efi: kernels.cfg inside FAT under /boot/grub/
                if "${MDIR}" -i "${efi_img}" '::/boot/grub/kernels.cfg' >/dev/null 2>&1; then
                        echo "grub-efi"
                        return
                fi
                # systemd-boot: /loader/loader.conf inside FAT
                if "${MDIR}" -i "${efi_img}" '::/loader/loader.conf' >/dev/null 2>&1; then
                        echo "systemd-boot"
                        return
                fi
                # refind: /EFI/BOOT/refind.conf inside FAT
                if "${MDIR}" -i "${efi_img}" '::/EFI/BOOT/refind.conf' >/dev/null 2>&1; then
                        echo "refind"
                        return
                fi
        fi
 
        echo "unknown"
}
 
detect_iso_bootloader $1
Let's see:
$ ./detect_bootloader.sh /srv/ISO//siduction-2025.1.0-Shine_on-kde-amd64-202604141203.iso
Iso Image: /opt/sda5/opt/linux/siduction-2025.1.0-Shine_on-kde-amd64-202604141203.iso
Efi Image: /tmp/efi.img
grub

vs.

./detect_bootloader.sh /srv/ISO/MX-25.2_KDE_x64.iso  
Iso Image: /srv/ISO/MX-25.2_KDE_x64.iso
Efi Image:
unknown

Neither does the code detect the /boot/grub/kernels.cfg in the isofs
(well, there is none), nor is he able to extract the efi partition
(though there is one). Do you really think the whole program could
improve on that?

hendrikL

Quote from: Teriarch on Yesterday at 18:21:23...
Well, they say: "The chain is only as Do you really think the whole program could
improve on that?

I don't know, never tried that, nor do I feel to investigate my spare lifetime on it.
It is interesting, for shure.

My intention is to use the whole thing, because the different parts could fit together. And it is not a problem to downgrade when it doesn't work, or?

Teriarch

> I don't know, never tried that, nor do I feel to investigate my spare lifetime on it.
> It is interesting, for sure. 
We definitely agree on that. As soon as it interests me I pick the problems from
the forum like puzzles waiting to be solved. I don't care whether it's useful or not,
they have intrinsic value far beyond their usefulness in showing how to approach
a problem and developing solution techniques. And if somebody profits, the better... 

eriefisher

Either way, it seems that the fll tools will only work with fll built iso's. There is still away to do it with grub2 so I'll go that route. I still think there should be mention of it in the manual under the grub2-fll-fromiso section. Just to prevent someone else going down this road.
I AM CANADIAN!

Teriarch

Here is my /etc/grub.d/40_custom entry modification, which I put at the very end of that file:
menuentry "MX Linux - Native Loopback Menu" {
    # 1. You MUST name it 'iso_path' so the script inside the ISO can read it
    set iso_path="/srv/ISO/MX-25.2_KDE_x64.iso"
    export iso_path
   
    # 2. Locate the physical partition housing the file
    search --no-floppy --fs-uuid --set=root 5ebb0972-4bac-423f-8890-f7dacea82935 
 
    # 3. CRITICAL: Extract the partition UUID and export it as buuid for the kernel
    insmod probe
    probe -u $root --set=buuid
    export buuid
 
    # 4. Mount the ISO virtually inside GRUB
    loopback loop $iso_path
   
    # 5. Hand off root control to the loop mount
    set root=loop
   
    # 6. Execute the file you found
    configfile /boot/grub/loopback.cfg
}
You can easily adapt it to your heart's content. After an "update-grub" it worked for me
and all that remains is a modification of grub2-fll-fromiso to include the MX- ISO's.