1

In the history, I can use iso_scan or loopback.cfg to boot:

loopback loop $isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=${isofile} verbose
initrd (loop)/casper/initrd*

Or

loopback loop "$isofile"
root=(loop)
configfile /boot/grub/loopback.cfg
loopback --delete loop

The 20iso_scan report it cannot mount /dev/sr0 and cannot find the (hdx,gpt)/...iso but the iso apparently is there otherwise, we cannot load the initrd and vmlinuz.

The second method, try to use the loopback.cfg come from the cd itself. However, it yield /init. line49: can't open /dev/sr0: No medium found.

Any idea, what is the correct way to do it nowadays?

There should be a way to directly give the squash file paths already when I loop mount it? why it needs to scan the iso and mount again?

update

now I understood more about the livecd boot procedure.

  • After we call the linux and initrd, the kernel take the ownership. Thus all the loopback devices created inside the grub are invisible to kernel.
  • The kernel will reinitiate everything like it sees them the first time.
  • The squash mount happens inside the kernel. At this time kernel can see the actual iso file on the real disk. It can mount the iso file and unpack the squashfs then.

However, the bootloader should still be able to give the kernel a ram disk as the initrd command. Ideally a bootloader should create a ram disk from squashfs (loopback does not create ram disk). Then kernel can mount it as a device. Or the bootloader may inject the entire iso into the initramfs. Some tool can already partially do that: ipxe's initrd.magic module for example. grub so far does not have this feature nor plan to provide one.

Wang
  • 725

2 Answers2

2

I just used this. It has a data partition - data_nvme on NVMe drive with folder /ISO. Getting path correct is often a major issue. I now prefer to use labels over UUID or devices to find partition.

menuentry "Ubuntu 22.10 Kinetic amd64" {
set isofile="/ISO/kubuntu-22.10-desktop-amd64.iso"
insmod part_gpt
#rmmod tpm
search --set=root --label data_nvme --hint hd0,gpt5
loopback loop (${root})$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile toram
initrd (loop)/casper/initrd
}

Having ISO downloaded, / partition already defined and using toram with NVMe drive, let me do full install in less than 5 minutes. Installs to USB3 flash drives still take over 40 minutes.

oldfred
  • 12,583
0

I think this may be a duplicate

of: 20.04 booting .iso from GRUB menu

However, There are alternatives to the standard answer.

If you create a small FAT32 partition on your hard drive, say about 5 to 10 GB, You can extract the ISO to it and let UEFI boot Ubuntu without needing to mess with GRUB.

You may need to choose the option by pressing F9, F10, F12, or what ever combination your computer uses to select boot disk.

C.S.Cameron
  • 20,530
  • 12
  • 78
  • 125