No such device: /boot/grub/uuid/

Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release:11
Codename: bullseye

I'm trying to install Debian onto a USB stick, and I'm getting this error on boot:

GRUB loading.
Welcome to GRUB!

error: no such device: /boot/grub/uuid/1eib15ge3kie0f55amm79t6u
error: unknown filesystem.
grub rescue>

Here is the what I used to install Debian to the USB:

WARNING: DO NOT RUN THIS AS A SCRIPT. Just copy line by line, watching for errors!!!

sudo apt-get --assume-yes install debootstrap pv

cd /home/user/Downloads

rm -f debian.img
sudo rm -rf /mnt
rm myloopdevice
sudo rm -rf /dev/loop0
sudo rm -rf /dev/loop1
sudo rm -rf /dev/loop2

sudo mkdir -p /mnt
sudo umount /mnt/{dev/pts,dev,sys,proc,}


fallocate -l 4G debian.img

sudo su
exit

echo -e "o\nn\np\n1\n\n\nw" | sudo fdisk debian.img
echo -e "a\nw\n" | sudo fdisk debian.img


loop=$(sudo losetup --partscan --show --find debian.img)
echo "Your loop device is: $loop"
echo $loop > myloopdevice

sudo mkfs.ext4 "$loop"p1


sudo mount -o loop   "$loop"p1 /mnt

sudo debootstrap --arch=amd64 --variant=minbase bullseye /mnt https://deb.debian.org/debian/

sudo mount -t proc   /proc     /mnt/proc
sudo mount -t sysfs  /sys      /mnt/sys
sudo mount -o bind   /dev      /mnt/dev
#sudo mount -t devpts /dev/pts  /mnt/dev/pts

sudo chroot /mnt

version=bullseye

cat > /etc/apt/sources.list << EOF
deb https://deb.debian.org/debian/ $version main contrib non-free
#deb-src https://deb.debian.org/debian/ $version main contrib non-free

deb https://security.debian.org/debian-security $version-security main contrib non-free
#deb-src https://security.debian.org/debian-security $version-security main contrib non-free

deb https://deb.debian.org/debian/ $version-updates main contrib non-free
#deb-src https://deb.debian.org/debian/ $version-updates main contrib non-free
EOF

apt update --allow-releaseinfo-change --assume-no


apt install --assume-yes --no-install-recommends grub2-common grub-pc systemd-sysv locales linux-image-amd64 firmware-linux

echo "LABEL=DEBUSB / ext4 defaults 0 1" > /etc/fstab

echo "root:root" | chpasswd


grub-install \
    --target=i386-pc \
    --boot-directory=/boot \
    --force-file-id \
    --skip-fs-probe \
    --recheck /dev/loop0

### Exit chroot
exit

sudo su

cat << EOF > /mnt/boot/grub/grub.cfg
# grub.cfg
set default="0"
set timeout=1

menuentry "Debian" {
    linux /vmlinuz root=/dev/disk/by-label/DEBUSB quiet
    initrd /initrd.img
}
EOF

exit

sudo e2label /dev/loop0p1 DEBUSB

echo "localhost" | sudo tee /mnt/etc/hostname

sudo umount /mnt/{dev,sys,proc}
sudo umount /mnt

sudo losetup -d /dev/loop0

# find with sudo fdisk -l
sdX=sdb

sudo umount /dev/sdX*

sudo e2fsck -p /dev/sdX1

sudo dd if=debian.img of=/dev/sdb && sync

I had this working several times before, and now it's not working. Not sure what I'm doing wrong.

Also, another script I tried that won't work:

#!/bin/bash

set -e # Exit on error

DEVICE=$1
[ -z "${DEVICE}" ] && echo "Usage $0 /dev/sdX" && exit 1

udevadm info -n ${DEVICE} -q property
echo "Selected device is ${DEVICE}"
read -p "[Press enter to continue or CTRL+C to stop]"

echo "Umount ${DEVICE}"
umount ${DEVICE}* || true

echo "Set partition table to GPT (UEFI)"
parted ${DEVICE} --script mktable gpt

echo "Create EFI partition"
parted ${DEVICE} --script mkpart EFI fat16 1MiB 10MiB
parted ${DEVICE} --script set 1 msftdata on

echo "Create OS partition"
parted ${DEVICE} --script mkpart LINUX btrfs 10MiB 100%

echo "Format partitions"
mkfs.vfat -n EFI ${DEVICE}1
mkfs.btrfs -f -L LINUX ${DEVICE}2

echo "Mount OS partition"
ROOTFS="/tmp/installing-rootfs"
mkdir -p ${ROOTFS}
mount ${DEVICE}2 ${ROOTFS}

echo "Debootstrap system"
debootstrap --variant=minbase --arch amd64 bullseye ${ROOTFS} https://deb.debian.org/debian/  

echo "Mount EFI partition"
mkdir -p ${ROOTFS}/boot/efi
mount ${DEVICE}1 ${ROOTFS}/boot/efi

echo "Get ready for chroot"
mount --bind /dev ${ROOTFS}/dev
mount -t devpts /dev/pts ${ROOTFS}/dev/pts
mount -t proc proc ${ROOTFS}/proc
mount -t sysfs sysfs ${ROOTFS}/sys
mount -t tmpfs tmpfs ${ROOTFS}/tmp

echo "Entering chroot, installing Linux kernel and Grub"
cat << EOF | chroot ${ROOTFS}
  set -e
  export HOME=/root
  export DEBIAN_FRONTEND=noninteractive
  debconf-set-selections <<< "grub-efi-amd64 grub2/update_nvram boolean false"
  apt-get remove -y grub-efi grub-efi-amd64
  apt-get update
  apt-get install -y linux-image-amd64 linux-headers-amd64 grub-efi
  grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=debian --recheck --no-nvram --removable
  update-grub
EOF


echo "Unmounting filesystems"
umount ${ROOTFS}/dev/pts
umount ${ROOTFS}/dev
umount ${ROOTFS}/proc
umount ${ROOTFS}/sys
umount ${ROOTFS}/tmp
umount ${ROOTFS}/boot/efi
umount ${ROOTFS}

echo "Done"

Any ideas?

Hi

Go to ‘VENTOY.net
Download that and then choose to install it onto a USB stick.
A stick or a larger USB SSD drive - I prefer the larger drive.

You can then follow the instructions provided.
Basically this 1 TOOL is like having many USB 16GB sticks or larger.

I have installed many different LINUX versions and other Windows Toolkits
You can install many different LIVE installs of LINUX and from there you can install to the disk drive as the ‘one and only‘ install or install to partitions on the disk.

Helpful

Really sorry for the delayed response. I totally borked my main Debian install, and other stuff happened that involved data destruction... :roll_eyes:

I've used Ventoy before, and I believe that it uses an overlay? I'm not sure, so I'm asking. I don't want an overlay though; I want to do a full install onto the USB.

Hi

VENTOY would need to boot up first - and you want to avoid that - is that what you want ?

I have used VENTOY ever since I discovered that it existed - I was looking for a tool that would allow many bootable things to exist (on separate partitions - but there was a LIMIT to the number of partitions you could have on the USB device no matter how big it was).

So ...

VENTOY may be a bit different to what you have desired but it does make up for this one “flaw”.

I have the ability on the 1 TB USB SSD stick to have all my documentation.
I have to “reboot” from a running “VENTOY” to do a single install “instance” boot and run.
Eg.

Boot from the USB stick - it boots VENTOY
Select the “IMAGE” - which is very easy.

If the “IMAGE” is a “RAW boot and install an OS onto another drive” then VENTOY handles
That with ease.

If the “IMAGE” is a “LIVE boot and run” then it will effectively do that - I have used this tool
And the advantage of this is that you can “try before you buy” - eg. Will this IMAGE run on
My hardware ? If it does not run the LIVE version (which is not installed onto the Systems internal HDD)
Then it certainly will not run if you install it directly to the SYSTEM.

This process of “test and then install if all goes well” has saved me hours and hours.

Now if you have some hardware that requires a “USB IMAGE” to cause the HARDWARE to load and
install specific drivers etc.
Then you should copy the “BIOS type IMAGE” to VENTOY for alter use.
Then out in the field, if you need to use it, you should carry around a spare USB 16 GB stick
And then use ‘Rufus’ or some such tool to create the INSTALL IAMGE on the 16 GB stick .

The larger USB SSD drive should be able to hold many such images: Different kit and different versions.
Just in case you have to revert to the previous “BIOS type IMAGE”.

When I worked at IBM this tool would have saved me a lot of time,

At other places where I have worked, they have had approximately 16 x 16 GB USB sticks with different things on
them. You can repeat that for the other 16 sticks for the MACOS.

I had to manually build the 1TB MACOS USB SSD partitions and now I will need to see
IF the new macOS with the NEW “M1 chipset” will work with my hand-made partitions.
“Monterey” : the latest macOS comes in 2 formats “INTEL” and “M1”.

When I boot the macOS 1 TB USB SSD I have already installed a set of bootable macOS versions.
High SIerra: is the last macOS to NOT know about APFS and Containers
After that, all later versions know about APFS and Containers.
To transition from the old HPFS+ file systems , Apple must have a tool that builds a Container and converts HPFS+ to APFS inside the Container.

In SUmmary:

Have a large USB SSD drive for VENTOY and also have a spare 16 GB USB stick
For installing what you need.

If you deal with macOS you need to build your own - I suggest you build the partitions
In the same order as the Apple Releases. Do what I did on your largest SSD drive.

But that is off topic so I can advise on that if requested.

Helpful