Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packer can't boot from Linux ISO #13208

Closed
hhemied opened this issue Nov 12, 2024 · 4 comments
Closed

Packer can't boot from Linux ISO #13208

hhemied opened this issue Nov 12, 2024 · 4 comments

Comments

@hhemied
Copy link

hhemied commented Nov 12, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Overview of the Issue

I'm trying to build a vagrant box based on Fedora server 41.
Unfortunately, every time, Packer can't boot from ISO with no given errors.

CleanShot 2024-11-12 at 21 08 51@2x

Reproduction Steps

Steps to reproduce this issue

Packer version

Packer v1.11.2

Simplified Packer Template

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

source "virtualbox-iso" "fed401" {
  guest_os_type          = "Fedora_arm64"
  headless               = false
  iso_url                = "file:///Users/hazemhemied/Downloads/Fedora-Server-dvd-aarch64-41-1.4.iso"
  iso_checksum           = "99e7801b943e81f78a7b104fe348196b0ac1bc748ce647378f22a2c875c923ec"
  ssh_username           = "vagrant"
  ssh_password           = "vagrant"
  ssh_handshake_attempts = 20
  ssh_timeout            = "30m"
  firmware               = "efi"
  http_directory         = "http"
  memory                 = 2048
  cpus                   = 2
  boot_wait              = "5s"
  #  gfx_controller = "vmsvga"
  boot_command = [
    "<up><enter><tab><bs><bs><bs><bs><bs>text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<enter><wait>"
  ]
  vboxmanage = [
    ["modifyvm", "{{.Name}}", "--vram", "16"], # Set video RAM to 16MB
    ["modifyvm", "{{.Name}}", "--boot1", "disk", "--boot2", "dvd"],
    # ["modifyvm", "{{.Name}}", "--accelerate3d", "off"], # Disable 3D acceleration
    ["modifyvm", "{{.Name}}", "--graphicscontroller", "vmsvga"] # Set compatible graphics controller
  ]
  shutdown_command = "echo 'packer' | sudo -S shutdown -P now"

}

build {
  sources = ["sources.virtualbox-iso.fed401"]
  post-processor "vagrant" {
    keep_input_artifact = false
    output              = "fedora_server_40.1.box"
  }
}

Operating system and Environment details

Apple M3.
Virtualbox: Version 7.1.4 r165100 (Qt6.5.3)

Log Fragments and crash.log files

gist

@hhemied hhemied added the bug label Nov 12, 2024
@lbajolet-hashicorp
Copy link
Contributor

Hey @hhemied,

I would need to investigate a bit before classifying this as a bug, what you're seeing here is the splash screen for the EDK project, which you boot on with efi = true, you may need to use the EFI shell to tell EDK what to do for booting up initially.
If you need inspiration, you can take a look at the debian EFI example for the qemu plugin: https://github.com/hashicorp/packer-plugin-qemu/blob/main/example/efi_build/efi-debian.pkr.hcl
Typically the first line of the boot_steps is likely what you're missing here, I don't know exactly why it cannot boot automagically from it, but by invoking the efi stub for booting from ISO should help you there.

I'll mark the issue as needs-investigation instead of bug for now, we can iterate on it as you progress.

Thanks!

@hhemied
Copy link
Author

hhemied commented Nov 19, 2024

Thanks @lbajolet-hashicorp for your reply.
I did investigate the issue and dig it down until I found the issue was in the disk and iso interface, it needed to be virtio, anything other than that was failing.

The source is as follow

source "virtualbox-iso" "fed4114" {
  boot_keygroup_interval = "500ms"
  guest_os_type          = "Fedora_arm64"
  headless               = false
  iso_url                = "file:///Users/hazemhemied/Downloads/Fedora-Server-dvd-aarch64-41-1.4.iso"
  iso_checksum           = "99e7801b943e81f78a7b104fe348196b0ac1bc748ce647378f22a2c875c923ec"
  ssh_username           = "vagrant"
  ssh_password           = "vagrant"
  ssh_handshake_attempts = 20
  ssh_timeout            = "30m"
  http_directory         = "http"
  hard_drive_interface   = "virtio"
  disk_size              = "15000"
  iso_interface          = "virtio"
  memory                 = 2048
  cpus                   = 2
  boot_wait              = "10s"
  boot_command           = ["<wait><up>e<wait10><down><down><end> inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg<F10><wait10>"]

  vboxmanage = [
    ["modifyvm", "{{.Name}}", "--vram", "128"], # Set video RAM to 16MB
    ["modifyvm", "{{.Name}}", "--firmware", "BIOS"],
    ["modifyvm", "{{.Name}}", "--usb-xhci", "on"],
    ["modifyvm", "{{.Name}}", "--mouse", "usbtablet", "--keyboard", "usb"],
    ["modifyvm", "{{.Name}}", "--ioapic", "off"],
    ["modifyvm", "{{.Name}}", "--boot1", "disk", "--boot2", "dvd", "--boot3", "floppy", "--boot4", "none"],
    ["modifyvm", "{{.Name}}", "--graphicscontroller", "vmsvga"] # Set compatible graphics controller
  ]
  shutdown_command = "sudo shutdown -h now"
}

Side note, I didn't manage to successfully fully build the VM Box due to bugs in virtualbox export which are not fixed yet.

@hhemied hhemied closed this as completed Dec 2, 2024
@hhemied
Copy link
Author

hhemied commented Dec 2, 2024

This was fixed by the last comment, but VirtualBox on Apple silicon is not mature yet for that.

Copy link

github-actions bot commented Jan 2, 2025

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants