I used grml-rescueboot to generate a menu entry and I modified it based on the ISO file place in my hard disk:
# super_grub2_disk
menuentry "super_grub2_disk" --class recovery{
insmod part_msdos
insmod ntfs
set root='hd0,msdos3'
iso_path="/super_grub2_disk_hybrid_2.04s1.iso"
export iso_path
kernelopts=" "
export kernelopts
# support booting recent GRUB versions on UEFI systems
rmmod tpm
loopback loop "/super_grub2_disk_hybrid_2.04s1.iso"
set root=(loop)
configfile /boot/grub/loopback.cfg
}
If you want to add Ubuntu 23 or 24 ISO file, use like this menu entry:
menuentry "Try or Install ubuntu-23.04-desktop-amd64" {
loopback loop /ubuntu-23.04-desktop-amd64.iso
linux (loop)/casper/vmlinuz boot=casper layerfs-path=minimal.standard.live.squashfs iso-scan/filename=/ubuntu-23.04-desktop-amd64.iso quiet splash locale=en_US bootkbd=us console-setup/layoutcode=us noeject --
initrd (loop)/casper/initrd
}
You can see some menu entries related to ISO files in this answer: https://askubuntu.com/a/1474729/1698042