I used the answer from this post to make a GRUB menu entry to boot from a USB stick that had Ubuntu 18.04 on it:
How to add a GRUB2 menu entry for booting installed Ubuntu on a USB drive?
It says to put this in /etc/grub.d/40_custom: (Use your own UUID)
menuentry "Boot from LIVE USB Drive" {
search --set=root --fs-uuid CA05-C6FF
linux ($root)/casper/vmlinuz boot=casper quiet splash --
initrd ($root)/casper/initrd
}
From a script, you can edit /etc/defaults/grub:
GRUB_DEFAULT="Boot from LIVE USB Drive"
And then execute:
sudo update-grub
In the script you can execute:
sudo reboot
and the computer will boot from the USB stick - IF you are running Ubuntu 18.04 on the USB stick. If you are running 20.04, GRUB stops and says, "error: no such device: CA05-C6FF"
blkid shows the UUID is correct: dfr@m9kmission:~$ blkid
/dev/sdb1: LABEL="UBUNTU 20_0" UUID="CA05-C6FF" TYPE="vfat" PARTUUID="1246c10c-01"
Any idea how to fix this???