If you want to know why I have this setup see How to boot an ISO in your hard drive using Grub.

Here I show you how to use one example of squashfs first and later one Ubuntu ISO.

My setup is an Arch Linux laptop using UEFI and systemd-boot. For grub see the other post.

GRML Small

Download the ISO file: grml.org.

First, you have to copy some files from the ISO.

To make this command easier to understand mount the ISO in some place and cd it:

$ mkdir /boot/grml
$ cp boot/grml64small/vmlinuz boot/grml64small/initrd.img live/grml64-small/grml64-small.squashfs /boot/grml

And create the file /boot/loader/entries/grml.conf:

title Grml Live Linux
linux /grml/vmlinuz
initrd /grml/initrd.img
options apm=power-off boot=live live-media-path=/grml/ nomce net.ifnames=0

GRML Full

For the full version the command is similar you only replace reference of small with full:

$ cp boot/grml64full/vmlinuz boot/grml64full/initrd.img live/grml64-full/grml64-full.squashfs /boot/grml

The entry file is similar as well but not identical. Make sure you have it updated.

Ubuntu

With Ubuntu things are similar, you still need an initrd.img, vmlinuz but this time we will use the ISO itself.

You will have to mount the ISO at least once to copy casper/initrd and casper/vmlinuz.

After this initial setup, the updates are just copying the ISO to /boot. (Optionally you can copy the other files again).

First copy the ISO to /boot.

Mount the ISO and cd to its root (aka, mount point), then:

$ mkdir /boot/casper
$ cp casper/initrd casper/vmlinuz /boot/casper

Create the file /boot/loader/entries/ubuntu.conf:

title Ubuntu Linux
linux /casper/vmlinuz
initrd /casper/initrd
options boot=casper iso-scan/filename=/ubuntu-20.04-desktop-amd64.iso noeject noprompt

Remember to update the last line with the correct name of your ISO.

And also remember the ISO is in /boot but the other files are in /boot/casper.

If you want even more convenience you can rename the ISO to ubuntu.iso, this way whenever you update the ISO you don't have to update the content of the entry file as well.

For more options for casper see: https://manpages.ubuntu.com/manpages/xenial/man7/casper.7.html.