[Update]
I have the same problem with packer-arch itself.
Hey there!
I’m planning to virtualize manjaro-arm-installer, so it can be run on every platform.
Docker was my initial aim, because I’m virtualizing an application.
But that so far turned out to be very difficult to do, due to the app running all sorts of systemd functions and also it’s a flasher app, so I probably want virtual partitions as well.
That way, if people choose the incorrect device to flash, it’s only a virtual partition that gets destroyed.
I figure that since manjaro-arm-installer is a CLI app,
and Manjaro releases only GUI OSes these days,
I’m better off building from Arch Linux and work my way up to Manjaro from there.
I’m using Elasticdog packer-arch as my template.
I then converted it’s json packerfile to hcl, took out the virtualbox/vmware/parrarel,
because I figure I only want to use QEMU/libvrt as being the most lightweight virtual machine after docker.
So this is where I’m at right now:
[folaht@pjehrsohmehj mai-base]$ packer build manjaro-arm-installer.pkr.hcl
qemu.mai: output will be in this color.
==> qemu.mai: Retrieving ISO
==> qemu.mai: Trying https://mirrors.kernel.org/archlinux/iso/2021.08.01/archlinux-2021.08.01-x86_64.iso
==> qemu.mai: Trying https://mirrors.kernel.org/archlinux/iso/2021.08.01/archlinux-2021.08.01-x86_64.iso?checksum=sha1%3A4904c8a6df8bac8291b7b7582c26c4da9439f1cf
qemu.mai: archlinux-2021.08.01-x86_64.iso 831.32 MiB / 831.32 MiB [====================================================] 100.00% 3m33s
==> qemu.mai: https://mirrors.kernel.org/archlinux/iso/2021.08.01/archlinux-2021.08.01-x86_64.iso?checksum=sha1%3A4904c8a6df8bac8291b7b7582c26c4da9439f1cf => /home/folaht/Nwaȥ/Êspas dû travaj/neovîm/Âp/mai-packer/mai-base/packer_cache/a5e0e4d374e7eb55e1c5cec0171e1dfac7ff1eb4.iso
==> qemu.mai: Starting HTTP server on port 8414
==> qemu.mai: Found port for communicator (SSH, WinRM, etc): 4376.
==> qemu.mai: Looking for available port between 5900 and 6000 on 127.0.0.1
==> qemu.mai: Starting VM, booting from CD-ROM
==> qemu.mai: Waiting 5s for boot...
==> qemu.mai: Connecting to VM via VNC (127.0.0.1:5973)
==> qemu.mai: Typing the boot command over VNC...
qemu.mai: Not using a NetBridge -- skipping StepWaitGuestAddress
==> qemu.mai: Using SSH communicator to connect: 127.0.0.1
==> qemu.mai: Waiting for SSH to become available...
==> qemu.mai: Connected to SSH!
==> qemu.mai: Provisioning with shell script: scripts/install-base.sh
==> qemu.mai: Provisioning step had errors: Running the cleanup provisioner, if present...
==> qemu.mai: Deleting output directory...
Build 'qemu.mai' errored after 10 minutes 56 seconds: Error uploading script: Process exited with status 1
==> Wait completed after 10 minutes 56 seconds
==> Some builds didn't complete successfully and had errors:
--> qemu.mai: Error uploading script: Process exited with status 1
==> Builds finished but no artifacts were created.
As one can see it produces an error and I have no idea why.
manjaro-arm-installer.pkr.hcl
variable "country" {
type = string
default = "US"
}
variable "headless" {
type = string
default = "false"
}
variable "ssh_timeout" {
type = string
default = "20m"
}
variable "write_zeros" {
type = string
default = "true"
}
locals {
iso_checksum_url = "https://mirrors.kernel.org/archlinux/iso/${legacy_isotime("2006.01")}.01/sha1sums.txt"
iso_url = "https://mirrors.kernel.org/archlinux/iso/${legacy_isotime("2006.01")}.01/archlinux-${legacy_isotime("2006.01")}.01-x86_64.iso"
}
source "qemu" "mai" {
accelerator = "kvm"
boot_command = [
"<enter><wait10><wait10><wait10><wait10><wait10><wait10><wait10><wait10>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/enable-ssh.sh<enter><wait10>",
"/usr/bin/curl -O http://{{ .HTTPIP }}:{{ .HTTPPort }}/poweroff.timer<enter><wait10>",
"/usr/bin/bash ./enable-ssh.sh<enter>"
]
boot_wait = "5s"
cpus = 1
disk_interface = "virtio"
disk_size = 2048
format = "qcow2"
headless = "${var.headless}"
http_directory = "srv"
iso_checksum = "file:${local.iso_checksum_url}"
iso_url = "${local.iso_url}"
memory = 768
net_device = "virtio-net"
output_directory = "output_manjaro-arm-installer"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "${var.ssh_timeout}"
shutdown_command = "sudo systemctl start poweroff.timer"
vm_name = "manjaro-arm-installer"
}
build {
sources = ["source.qemu.mai"]
provisioner "shell" {
execute_command = "{{ .Vars }} COUNTRY=${var.country} sudo -E -S bash '{{ .Path }}'"
expect_disconnect = true
script = "scripts/install-base.sh"
}
provisioner "shell" {
execute_command = "{{ .Vars }} WRITE_ZEROS=${var.write_zeros} sudo -E -S bash '{{ .Path }}'"
script = "scripts/cleanup.sh"
}
post-processor "vagrant" {
output = "output/packer_arch_<no value>-${legacy_isotime("2006.01")}.01.box"
}
}