Skip to content

Instantly share code, notes, and snippets.

@FunTimeCoding
Created August 24, 2023 11:01
Show Gist options
  • Save FunTimeCoding/6a49aa9a219f1f7e041007598d853342 to your computer and use it in GitHub Desktop.
Save FunTimeCoding/6a49aa9a219f1f7e041007598d853342 to your computer and use it in GitHub Desktop.
Packer Debian 12 from macOS M1 (not working)
{
"variables": {
"iso_url": "/Users/areitzel/Downloads/debian-12.1.0-arm64-netinst.iso",
"iso_checksum": "b58e02fe14a52c1dfdacc0ccd6bc9b4edf385c7e8cea1871a3b0fccb6438700b",
"iso_checksum_type": "sha256",
"ssh_username": "debian",
"ssh_password": "debian",
"ssh_wait_timeout": "20m",
"debian_version": "12.1.0"
},
"builders": [
{
"vm_name": "packer-debian12",
"type": "qemu",
"accelerator": "hvf",
"qemu_binary": "qemu-system-aarch64",
"qemuargs": [
[
"-machine",
"type=virt"
],
[
"-boot",
"strict=off"
],
[
"-accel",
"hvf"
],
[
"-device",
"qemu-xhci"
],
[
"-device",
"usb-kbd"
],
[
"-device",
"virtio-gpu-pci"
],
[
"-bios",
"/opt/homebrew/Cellar/qemu/8.0.4/share/qemu/edk2-aarch64-code.fd"
],
[
"-cpu",
"cortex-a72"
]
],
"iso_url": "{{user `iso_url`}}",
"iso_checksum": "{{user `iso_checksum`}}",
"output_directory": "/Users/areitzel/Downloads/packer/output",
"shutdown_command": "echo '{{user `ssh_password`}}' | sudo -S shutdown -P now",
"disk_size": 81920,
"format": "qcow2",
"headless": false,
"display": "cocoa",
"net_device": "virtio-net",
"disk_interface": "virtio-scsi",
"cdrom_interface": "",
"boot_wait": "10s",
"ssh_username": "{{user `ssh_username`}}",
"ssh_password": "{{user `ssh_password`}}",
"ssh_wait_timeout": "{{user `ssh_wait_timeout`}}",
"http_directory": "/Users/areitzel/Downloads/packer/web",
"boot_command": [
"c",
"linux /install.a64/vmlinuz",
" auto",
" url={{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
"<enter>",
"initrd /install.a64/initrd.gz",
"<enter>",
"boot",
"<enter>"
]
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo apt-get update",
"sudo apt-get install -y openssh-server",
"sudo sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config",
"sudo service ssh restart",
"sudo usermod -aG sudo {{user `ssh_username`}}",
"echo '{{user `ssh_password`}}' | sudo -S sed -i 's/^%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD: ALL/' /etc/sudoers"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment