1

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???

1 Answers1

2

Boot USB from Internal GRUB

I have three flash drive menuentries in my grub.cfg file:

menuentry "Ubuntu - flash drive" {
    set root=(hdX,Y)
    set gfxpayload=keep
    linux ($root)/casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash ---
    initrd ($root)/casper/initrd
}

and

menuentry "Ubuntu - flash drive" {
 search --set=root --fs-uuid xxxx-xx-xx-xx-xx-xx-xx
    set gfxpayload=keep
    linux ($root)/casper/vmlinuz  file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash ---
    initrd ($root)/casper/initrd
}

If the first does not work, (sometimes got to fiddle with (hdX,Y) if 0,1 is not right), I add the correct UUID to the second.

I did not need to edit edit /etc/defaults/grub

If your USB is an ISO booter a standard menuentry including set root for loop mounting ISO's should work

menuentry "Ubuntu-20.04 64-bit ISO" {
    rmmod tpm
    set root=(hd0,1)
    set isofile="/ubuntu-20.04-desktop-amd64.iso"
        loopback loop $isofile
        linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile quiet splash --
        initrd (loop)/casper/initrd
}

Again you may have to fiddle with set root location.

You can also add fsck.mode=skip after quiet splash if you want to get rid of the file check.

C.S.Cameron
  • 19,519