Mexit / MultiOS-USB

Boot operating systems directly from ISO files
GNU General Public License v3.0
270 stars 31 forks source link

Unable to locate .SQFS file #11

Closed JonnyTech closed 9 months ago

JonnyTech commented 9 months ago

I am trying to boot the latest Parted Magic ISO

Snipped contents of grub.cfg:

set default_settings=""
set live_settings="boot=live eject=no"
set linux="/pmagic/bzImage"
set initrd_img="/pmagic/initrd.img /pmagic/fu.img /pmagic/m.img"
set default=2
set message="Loading kernel and initramfs. Please wait..."

menuentry "1. Default settings (Runs from RAM 4GB+)"{
    echo $message
    set gfxpayload=keep
    linux $linux $default_settings
    initrd $initrd_img
}

This is what I am testing:

# For Parted Magic

iso_subdir="partedmagic"
iso_pattern="pmagic_*.iso"
grub_configfile=""

for isofile in $iso_dir/$iso_pattern $iso_dir/$iso_subdir/$iso_pattern; do
    if [ -e "$isofile" ]; then
        regexp --set=isoname "$iso_dir/(.*)" "$isofile"

        submenu "$isoname ->" "$isofile" {
            iso_path="$2"
            loopback loop $iso_path
            isocfg=""
            bootoptions=""
            linux_path="(loop)/pmagic/bzImage"
            initrd_path="(loop)/pmagic/initrd.img (loop)/pmagic/fu.img (loop)/pmagic/m.img"

            menuentry "Parted Magic - 1. Default settings (Runs from RAM 4GB+)" {
                echo "Loading kernel and initramfs. Please wait..."
                set gfxpayload=keep
                linux $linux_path $bootoptions $isocfg
                initrd $initrd_path
            }
        }
    fi
done

The ISO boots correctly and loads the above images.

Then it tries to load a .SQFS file which is the main OS in a compressed file. But it fails to locate it and drops out to a shell.

Frome there I try to locate the contents of the ISO but cannot find where it is mounted.

Any ideas what I can do to locate the file and boot?

Mexit commented 9 months ago

As Parted Magic ISO is not publicly available I can only suggest reasons why the ISO image is not visible from initrd. 1) Most important is the ISO configuration - the scripts in initrd don't know where the ISO is. According to Distrowatch Parted Magic is/was based on Slackware - check the slackware ISO configuration. 2) No support for the file system where the ISO is located 3) No support for booting from ISO in initrd

Check that the drive the ISO is on was mounted by initrd when drops out to a shell.

JonnyTech commented 9 months ago

Thanks for your reply

As Parted Magic ISO is not publicly available I can only suggest reasons why the ISO image is not visible from initrd.

Yes, I am a paying customer, sorry should have mentioned that.

1. Most important is the ISO configuration - the scripts in initrd don't know where the ISO is. According to [Distrowatch](https://distrowatch.com/table.php?distribution=partedmagic) Parted Magic is/was based on Slackware

Yes, it does seem to be Slackware:

cat /etc/os-release
NAME=Slackware
VERSION="15.0"
ID=slackware
VERSION_ID=15.0
PRETTY_NAME="Slackware 15.0 x86_64"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:slackware:slackware_linux:15.0"
HOME_URL="http://slackware.com/"
SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
VERSION_CODENAME=stable

Although this Ubuntu detail is confusing:

uname -a
Linux PartedMagic 6.5.0-10-generic #10-Ubuntu SMP PREEMPT_DYNAMIC Fri Oct 13 13:49:38 UTC 2023 x86_64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz GenuineIntel GNU/Linux
check the slackware ISO [configuration](https://github.com/Mexit/MultiOS-USB/blob/2ea72fcb989c5dc943c6a8fac3a0d272cf52fec2/config/slackware/slackware_live.cfg#L14).

OK, cool, these lines are different, shall try them next time:

isocfg="livemedia=$imgdevpath:$iso_path"
bootoptions="load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 kbd=uk tz=Europe/London locale=en_GB.utf8"
2. No support for the file system where the ISO is located

It is a FAT32 file-system which is generally pretty universal.

3. No support for booting from ISO in initrd

The ISO does boot and loads stuff correctly, it is just when it looks for the SQFS that is fails.

Check that the drive the ISO is on was mounted by initrd when drops out to a shell.

Yes, when it exits to the shell I can see the drive with lsblk and can mount the partitions too. But I cannot remember if it was actually mounted, tbh I do not think that it was.

Mexit commented 9 months ago

The ISO does boot and loads stuff correctly

This is not necessarily the case. In a nutshell. The script you provided loads the kernel and initrd into memory and then runs them. In the next step, the scripts in the initrd image must mount the partition where the ISO is located, then the ISO image itself. If the partition you have the ISO on is not mounted, there is no chance of loading the SQFS file. Even if you manually mount this partition, there is no guarantee that the scripts will be able to mount the ISO image.

Even if a PM is based on Slackware, it does not necessarily have support for booting from ISO. Very possibly, something has been changed and it is not possible to boot from the ISO image without any modifications.

a1ive commented 9 months ago

As far as I know, Parted Magic used to support the iso_filename=/path/to/pmagic.iso cheatcode for mounting ISO files during boot. I'm not sure if it still supports it now.

JonnyTech commented 9 months ago

Thanks @Mexit and @a1ive, the grub.cfg file contains:

submenu "List of Cheat Codes"{
menuentry "directory=        Directory containing the pmagic folder"{set}
menuentry "iso_filename=     [path to/]iso filename"{set}
menuentry "root=             SQFS boot device by partition id"{set}
menuentry "label=            SQFS boot device by label"{set}
menuentry "uuid=             SQFS boot device by [partial] uuid"{set}

I shall experiment with those.

Mexit commented 9 months ago

In fact, everything is in the file you attached... I didn't look at the end.

Then try something like this: isocfg="uuid=$rootuuid iso_filename=$iso_path"

If you can, please:

Let me know if it works, I will add the configuration Configuration for efi (without syslinux): pmagic.cfg.txt

JonnyTech commented 9 months ago

Then try something like this: isocfg="uuid=$rootuuid iso_filename=$iso_path"

@Mexit you are a genius - it works, I don't understand how or why, but it works - thank you very much!

This is my current partedmagic.cfg - I have kept it as close to the one in the ISO as possible. There re still a few items that I need to review, for example: there are additional set commands (ie line 87...) that may not be necessary.

For the moment, I am happy that it boots.

Currently I am looking at why Super Grub2 Disk (line 92) boots then fails when trying to detect items, and I may raise another issue for that.