Hashicorp 패커를 사용하여 방랑 VM(Arch Linux + EFI)을 구축했지만 화면이 깜박입니다.

Hashicorp 패커를 사용하여 방랑 VM(Arch Linux + EFI)을 구축했지만 화면이 깜박입니다.

설정

주인

OS: Manjaro XFCE x86_64
Apps: packer (plugins: virtualbox-iso), 

손님

OS:                Arch Linux  
Hypervisor:        Virtualbox 
Architecture:      x64

내 질문은 다음과 같습니다. 여기에 이미지 설명을 입력하세요.

내 패키저 빌드 파일(단순화를 위해 qemu 빌드가 제거됨)

packer {
  required_plugins {
    virtualbox = {
      version = ">=1.0.4"
      source = "github.com/hashicorp/virtualbox"
    }
  }
}


variable "ssh_private_key_file" {
  type    = string
  default = "~/.ssh/id_bas"
}

variable "ssh_timeout" {
  type    = string
  default = "20m"

  validation {
      condition = can(regex("[0-9]+[smh]", var.ssh_timeout))
      error_message = "The ssh_timeout value must be a number followed by the letter s(econds), m(inutes), or h(ours)."
    }
}

variable "ssh_username" {
  description = "Unpriviledged user to create."
  type = string
  default = "bas"
}

locals {
  boot_command_virtualbox = [
    "<enter><wait90s>",
    "curl -O http://10.0.2.3:{{ .HTTPPort }}/${local.kickstart_script} && ",
    "chmod +x ${local.kickstart_script} && ",
    "LOCAL_IP=10.0.2.3 ",
    "LOCAL_PORT={{ .HTTPPort }} ",
    "PACKER_BUILDER_TYPE=iso-virtualbox ",
    "./${local.kickstart_script}<enter>",
  ]
  cpus              = 1
  disk_size         = "4G"
  disk_size_vb      = "4000"
  efi_firmware_code = "/usr/share/edk2/x64/OVMF_CODE.fd"
  efi_firmware_vars = "/usr/share/edk2/x64/OVMF_VARS.fd"
  headless          = "false"
  iso_checksum      = "sha256:329b00c3e8cf094a28688c50a066b5ac6352731ccdff467f9fd7155e52d36cec"
  iso_url           = "https://mirror.cj2.nl/archlinux/iso/2023.06.03/archlinux-x86_64.iso"
  kickstart_script  = "initLiveVM.sh"
  machine_type      = "q35"
  memory            = 4096
  http_directory    = "srv"
  vm_name           = "SE_bastille-installer-box"
  write_zeros       = "true"
}


source "virtualbox-iso" "archlinux" {  
    boot_command           = local.boot_command_virtualbox
    boot_wait              = "2s"  
    communicator           = "ssh"
    cpus                   = 1
    disk_size              = local.disk_size_vb
    firmware               = "efi"
    format                 = "ovf"  
    guest_additions_mode   = "disable"
    guest_os_type          = "Arch"
    hard_drive_interface   = "virtio"
    headless               = local.headless
    http_directory         = local.http_directory
    iso_checksum           = local.iso_checksum
    iso_interface          = "virtio"
    iso_url                = local.iso_url
    memory                 = local.memory
    nic_type               = "virtio"
    shutdown_command       = "sudo systemctl start poweroff.timer"
    ssh_port               = 22
    ssh_private_key_file   = var.ssh_private_key_file 
    ssh_timeout            = var.ssh_timeout
    ssh_username           = var.ssh_username  
    vm_name                = "${local.vm_name}.ovf"
}


build {
  name = "SE_bastille-installer-box"
  sources = ["source.virtualbox-iso.archlinux"]
  
  provisioner "file" {
    destination = "/tmp/"
    source      = "./files"
  }
   
  provisioner "shell" {
    only = ["virtualbox-iso.archlinux"]
    execute_command = "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
    expect_disconnect = true
    scripts           = [
    "scripts/liveVM.sh",
    "scripts/virtualbox.sh",
    "scripts/tables.sh",
    "scripts/partitions.sh",
    "scripts/base.sh",
    "scripts/bootloader.sh",
    "scripts/pacman.sh",
    "scripts/setup.sh"
    ]
  }

  provisioner "shell" {
    execute_command = "{{ .Vars }} WRITE_ZEROS=${local.write_zeros} sudo -E -S bash '{{ .Path }}'"
    script = "scripts/cleanup.sh"
  }
    
  post-processor "vagrant" {
    output = "output/${local.vm_name}_${source.type}_${source.name}-${formatdate("YYYY-MM", timestamp())}.box"
    vagrantfile_template = "templates/vagrantfile.tpl"
  }
}

내가 뭘 잘못했나요?

답변1

markgraf가 말했듯이 내 구성 및 간단한 시스템 재시작에는 문제가 없는 것 같았고 내 경우에는 패커 재구축으로 문제가 해결되었습니다.

관련 정보