VM이 UEFI 대화형 셸로 부팅되지만 파일 시스템이 없습니다. (virt-install 시작 매개변수 사용자 정의)

VM이 UEFI 대화형 셸로 부팅되지만 파일 시스템이 없습니다. (virt-install 시작 매개변수 사용자 정의)

내 설정

주인

OS: Manjaro XFCE x86_64 
Apps: packer (plugins: qemu), 
      virt-manager, virt-install 
      virt-viewer 

손님

OS:                Arch Linux  
Hypervisor:        QEMU KVM  
Architecture:      x64
Machine Type:      q35
EFI Firmware Code: /usr/share/edk2/x64/OVMF_CODE.4m.fd
EFI Firmware Vars: /usr/share/edk2/x64/OVMF_VARS.4m.fd

packer build부팅 옵션을 사용하고 기록하여 호스트 컴퓨터에 사용자 지정 Arch Linux 이미지를 만들었습니다.

...
"==> bootloader.sh: Show boot options.."

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)
...

그래서 나는 이것이 괜찮을 것이라고 생각했지만 이것을 실행하면 다음과 같습니다.

sudo virt-install \
--name bastille-installer \
--vcpu 2 \
--machine q35 \
--memory 1024 \
--osinfo archlinux \
--debug \
--disk /var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-05.qcow2,format=qcow2 \
--import \
--boot loader=/usr/share/edk2/x64/OVMF_CODE.4m.fd,loader_ro=yes,loader_type=pflash,nvram_template=/usr/share/edk2/x64/OVMF_VARS.4m.fd,loader_secure=no

여기에 이미지 설명을 입력하세요.

매핑 테이블의 FS0: 완전히 누락되었습니다. 시작 관리자를 보기 위해 종료한 후 몇 가지 시작 옵션도 누락된 것을 발견했습니다.

여기에 이미지 설명을 입력하세요.

관련된 경우 virt-install의 자세한 출력은 다음과 같습니다.

https://gist.github.com/Folaht/d8d4366b79434069ff6e8a7b51abbd25

내가 뭘 잘못했나요?

[편집하다]

$ sudo qemu-img info ./bastille-installer_qemu_archlinux-2023-05.qcow2
image: ./bastille-installer_qemu_archlinux-2023-05.qcow2
file format: raw
virtual size: 1.42 GiB (1522309120 bytes)
disk size: 1.42 GiB
Child node '/file':
    filename: ./bastille-installer_qemu_archlinux-2023-05.qcow2
    protocol type: file
    file length: 1.42 GiB (1522309120 bytes)
    disk size: 1.42 GiB

Raw 파일에 문제가 있는 것 같습니다.
패커가 qcow2 파일로 구성되었음에도 불구하고 상자를 qcow2 파일로 빌드하는 것을 무시하는 데는 몇 가지 이유가 있을 것입니다.

바스티유 박스-설치 프로그램-box.pkr.hcl

...
source "qemu" "archlinux" {
  accelerator             = "kvm"
  boot_command            = local.boot_command_qemu
  boot_wait               = "1s"
  cpus                    = local.cpus
  disk_interface          = "virtio"
  disk_size               = local.disk_size
  efi_boot                = true
  efi_firmware_code       = local.efi_firmware_code
  efi_firmware_vars       = local.efi_firmware_vars
  format                  = "qcow2"
  headless                = local.headless
  http_directory          = local.http_directory
  iso_url                 = local.iso_url
  iso_checksum            = local.iso_checksum
  machine_type            = local.machine_type
  memory                  = local.memory
  net_device              = "virtio-net" 
  shutdown_command        = "sudo systemctl start poweroff.timer"
  ssh_handshake_attempts  = 500
  ssh_port                = 22
  ssh_private_key_file    = var.ssh_private_key_file
  ssh_timeout             = var.ssh_timeout
  ssh_username            = var.ssh_username
  ssh_wait_timeout        = var.ssh_timeout
  vm_name                 = "${local.vm_name}.qcow2"
}
...  

답변1

디스크 구성이 잘못되었습니다. qcow2 디스크 이미지를 사용하고 있지만 virt-install이를 알리지 않았으므로 VM 구성은 다음과 같습니다.

    <disk type="file" device="disk">
      <driver name="qemu" type="raw"/>
      <source file="/var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-05.qcow2"/>
      <target dev="vda" bus="virtio"/>
    </disk>

디스크 이미지를 raw이미지로 접근하려고 하여 예상한 데이터를 찾을 수 없습니다. 형식을 올바르게 지정했는지 확인하세요.

virt-install \
  --disk /var/lib/libvirt/images/bastille-installer_qemu_archlinux-2023-04.qcow2,format=qcow2 \
  ...

관련 정보