Hi All,
My host computer, my Live USB drives, and my full USB install
are all Fedora 43.
The several Fedora Live USB drives will UEFI boot up
perfectly on my host machine and inside qemu-kvm.
My full install of Fedora 43 on my USB drive initially
only booted on my host machine, but not on qemu-kvm.
But has since stopped booting anywhere.
My full USB drive is partitioned as follows:
sudo parted /dev/sdb print
Model: StarTech M2-USB-C-NVME-SA (scsi)
Disk /dev/sdb: 256GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 630MB 629MB fat32 EFI System Partition
boot, esp
2 630MB 7031MB 6401MB ext4 bls_boot
3 7031MB 256GB 249GB ext4
Note that there is only one partition for both “/” and “/home”
What I would like to accomplish, is to restore booting – both
native and with qemu-kvm with the same ability to boot
anywhere as my Live USB drives. And accomplish such without
using chroot if possible.
Please use /mnt2 as my mount directory.
ChatGPT gave me this script that does not work. qemu-kvm
gives grub gives
qemu-kvm BdsDxe: no bootable options or device found
What am I doing wrong?
Yours in Confusion,
-T
#!/usr/bin/env bash
set -e
echo "=== Starting full USB reset and rebuild ==="
# --- CONFIG ---
DISK="/dev/sdb"
ESP="${DISK}1"
BOOT="${DISK}2"
ROOT="${DISK}3"
MNT="/mnt2"
KERNEL_PACKAGE="kernel-core kernel-modules"
EFI_PACKAGES="shim grub2-efi-x64"
# --- 1) UNMOUNT EVERYTHING FIRST ---
echo "== Unmounting any previous mounts =="
sudo umount -l -R $MNT || true
sudo mkdir -p $MNT
# --- 2) MOUNT USB PARTITIONS CLEANLY ---
echo "== Mounting USB partitions =="
sudo mount $ROOT $MNT
sudo mkdir -p $MNT/boot
sudo mount $BOOT $MNT/boot
sudo mkdir -p $MNT/boot/efi
sudo mount $ESP $MNT/boot/efi
# --- 3) CLEAN EVERYTHING ON USB ---
echo "== Cleaning old EFI, GRUB, kernels, and modules =="
sudo rm -rf $MNT/boot/efi/EFI/fedora
sudo rm -rf $MNT/boot/efi/EFI/BOOT
sudo rm -f $MNT/boot/vmlinuz-*
sudo rm -f $MNT/boot/initramfs-*.img
sudo rm -rf $MNT/lib/modules/* || true
sudo rm -rf $MNT/var/log/* || true
# --- 4) INSTALL FRESH KERNEL + EFI PACKAGES ---
echo "== Installing kernel and EFI packages into USB =="
sudo dnf --installroot=$MNT --releasever=$(rpm -E %fedora) -y install
$KERNEL_PACKAGE $EFI_PACKAGES
# --- 5) MANUALLY COPY EFI BOOTLOADERS ---
echo "== Copying EFI bootloaders into ESP =="
sudo mkdir -p $MNT/boot/efi/EFI/fedora
sudo mkdir -p $MNT/boot/efi/EFI/BOOT
# Copy shimx64.efi and grubx64.efi into EFI/fedora
sudo cp $MNT/usr/share/efi/fedora/shimx64.efi
$MNT/boot/efi/EFI/fedora/shimx64.efi
sudo cp $MNT/usr/share/efi/fedora/grubx64.efi
$MNT/boot/efi/EFI/fedora/grubx64.efi
# Copy shimx64.efi to fallback loader
sudo cp $MNT/usr/share/efi/fedora/shimx64.efi
$MNT/boot/efi/EFI/BOOT/BOOTX64.EFI
# --- 6) MOUNT PSEUDO-FILESYSTEMS FOR CHROOT ---
echo "== Preparing chroot environment =="
sudo mount --bind /dev $MNT/dev
sudo mount --bind /dev/pts $MNT/dev/pts
sudo mount --bind /proc $MNT/proc
sudo mount --bind /sys $MNT/sys
sudo mount --bind /run $MNT/run
# --- 7) REBUILD PORTABLE INITRAMFS ---
echo "== Rebuilding portable initramfs =="
sudo chroot $MNT /bin/bash -c "dracut --force --no-hostonly" 2>
dracut-warnings.log || true
# --- 8) REINSTALL GRUB EFI ---
echo "== Reinstalling GRUB EFI =="
sudo grub2-install \
--force \
--target=x86_64-efi \
--efi-directory=$MNT/boot/efi \
--boot-directory=$MNT/boot \
--removable \
--recheck \
$DISK
# --- 9) VERIFY EFI FILES ---
if [ ! -f $MNT/boot/efi/EFI/fedora/shimx64.efi ]; then
echo "ERROR: shimx64.efi missing! USB will not boot in UEFI."
fi
if [ ! -f $MNT/boot/efi/EFI/fedora/grubx64.efi ]; then
echo "ERROR: grubx64.efi missing! GRUB may fail to load."
fi
if [ ! -f $MNT/boot/efi/EFI/BOOT/BOOTX64.EFI ]; then
echo "ERROR: BOOTX64.EFI missing! Fallback EFI boot will fail."
fi
# --- 10) CLEANUP ---
echo "== Cleaning up mounts =="
sudo umount -l $MNT/dev/pts || true
sudo umount -l $MNT/dev || true
sudo umount -l $MNT/proc || true
sudo umount -l $MNT/sys |
--
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it:
https://forge.fedoraproject.org/infra/tickets/issues/new