Sample Header Ad - 728x90

VM boots into UEFI Interactive Shell with the filesystem missing

1 vote
1 answer
1266 views
# Setup ## Host ### OS Manjaro XFCE x86_64 ### Apps packer (plugins: qemu) virt-install virt-viewer virt-manager ## Guest
OS:                Arch Linux  
Hypervisor:        QEMU KVM  
Architecture:      x64
Machine Type:      qc35
EFI Firmware Code: /usr/share/edk2-ovmf/x64/OVMF_CODE.fd
EFI Firmware Vars: /usr/share/edk2-ovmf/x64/OVMF_VARS.fd
So I create a customized Arch Linux image using packer build and log my boot options. _output of echo ">>>> ${NAME_SH}: Show boot option.."_
BootCurrent: 0001
    Timeout: 0 seconds
    BootOrder: 0007,0000,0001,0002,0003,0004,0005,0006
    Boot0000* UiApp	FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
    Boot0001* UEFI QEMU DVD-ROM QM00001 	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(0,65535,0){auto_created_boot_option}
    Boot0002* UEFI QEMU DVD-ROM QM00005 	PciRoot(0x0)/Pci(0x1f,0x2)/Sata(2,65535,0){auto_created_boot_option}
    Boot0003* UEFI Misc Device	PciRoot(0x0)/Pci(0x3,0x0){auto_created_boot_option}
    Boot0004* UEFI PXEv4 (MAC:525400123456)	PciRoot(0x0)/Pci(0x2,0x0)/MAC(525400123456,1)/IPv4(0.0.0.00.0.0.0,0,0){auto_created_boot_option}
    Boot0005* UEFI PXEv6 (MAC:525400123456)	PciRoot(0x0)/Pci(0x2,0x0)/MAC(525400123456,1)/IPv6([::]:[::]:,0,0){auto_created_boot_option}
    Boot0006* EFI Internal Shell	FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
    Boot0007* GRUB	HD(1,GPT,2034b5d2-828a-4491-8d23-fe9439932a12,0x800,0x7d000)/File(\EFI\GRUB\grubx64.efi)
So I'm thinking that this should go fine, but instead when I run this: _virt-install command_
sudo virt-install \
--name bastille-installer \
--vcpu 2 \
--memory 1024 \
--osinfo archlinux \
--disk /var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-04.qcow2 \
--import \
--boot uefi
I get to see this: enter image description here The FS0: in the mapping table is completely missing. And after exiting to see the boot manager I find that several boot options are missing as well. enter image description here These are the scripts that my packer config loads: _bastille-installer.pkr.hcl_
...
  provisioner "shell" {
    only = ["qemu.archlinux"]
    execute_command = "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
    expect_disconnect = true
    scripts           = [
    "scripts/configure-qemu.sh",
    "scripts/configure-shared.sh",
    "scripts/partition-table-gpt.sh",
    "scripts/partition-ext4-efi.sh",
    "scripts/setup.sh"
    ]
  }
...
And this is the script that creates the bootloader. _partition-ext4-efi.sh_
#!/usr/bin/env bash

. /tmp/files/vars.sh

NAME_SH=partition-ext4-efi.sh

# stop on errors
set -eu

echo ">>>> ${NAME_SH}: Writing Filesystem types.."
mkfs.ext4 -L BOHKS_BAZ ${ROOT_PARTITION}
mkfs.fat -F32 ${BOOT_PARTITION}

echo ">>>> ${NAME_SH}: Mounting partitions.."
/usr/bin/mount ${ROOT_PARTITION} ${ROOT_DIR}
/usr/bin/mkdir -p ${BOOT_DIR}
/usr/bin/mount ${BOOT_PARTITION} ${BOOT_DIR}

echo ">>>> ${NAME_SH}: Bootstrapping the base installation.."
/usr/bin/pacstrap ${ROOT_DIR} base pacman -Qq linux

echo ">>>> ${NAME_SH}: Updating pacman mirrors base installation.."
/usr/bin/arch-chroot ${ROOT_DIR} pacman -S --noconfirm reflector 

/usr/bin/arch-chroot ${ROOT_DIR} reflector --latest 5 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
tee /etc/xdg/reflector/reflector.conf &>/dev/null >>> ${NAME_SH}: Installing databases.."
/usr/bin/arch-chroot ${ROOT_DIR} pacman -Sy

echo ">>>> ${NAME_SH}: Installing basic packages.."
/usr/bin/arch-chroot ${ROOT_DIR} pacman -S --noconfirm sudo gptfdisk openssh grub efibootmgr dhcpcd netctl

echo ">>>> ${NAME_SH}: Generating the filesystem table.."
/usr/bin/genfstab -U ${ROOT_DIR} | tee -a "${ROOT_DIR}/etc/fstab" >/dev/null

echo ">>>> ${NAME_SH}: Installing grub.."
/usr/bin/arch-chroot ${ROOT_DIR} grub-install --target=x86_64-efi --efi-directory=${ESP_DIR} --bootloader-id=GRUB >/dev/null
/usr/bin/arch-chroot ${ROOT_DIR} grub-mkconfig -o /boot/grub/grub.cfg

echo ">>>> ${NAME_SH}: Show boot option.."
/usr/bin/arch-chroot ${ROOT_DIR} efibootmgr

echo ">>>> ${NAME_SH}: Generating the system configuration script.."
/usr/bin/install --mode=0755 /dev/null "${ROOT_DIR}${CONFIG_SCRIPT}"
In case it's relevant, this is how I create the partition table. _partition-table-gpt.sh_
#!/usr/bin/env bash

. /tmp/files/vars.sh

# stop on errors
set -eu

NAME_SH=partition-table-gpt.sh

echo ">>>> ${NAME_SH}: Formatting disk.."
sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | gdisk ${DISK}
  o
  y
  n
  1

  +250M
  ef02
  n
  2
   
   
  8304
  p
  w
  y
  q
EOF
Relevant var files: _vars.sh_
...
HOME_DIR=/home/${USER}
SSH_DIR=/home/${USER}/.ssh
ROOT_DIR='/mnt'
BOOT_DIR='/mnt/boot/efi'
FILES_DIR='/tmp/files'
ESP_DIR='/boot/efi'
...
BOOT_PARTITION="${DISK}1"
ROOT_PARTITION="${DISK}2"
...
I'm at a loss as to why I'm not getting my UEFI boot options and why the filesystem is missing in the mapping table.
Asked by Folaht (1156 rep)
Apr 29, 2023, 04:15 PM
Last activity: May 2, 2023, 01:09 PM