Code Monkey home page Code Monkey logo

packer-plugin-arm-image's Introduction

Packer plugin for ARM images

This plugin lets you take an existing ARM image and modify it on your x86 machine. It is optimized for raspberry pi use case - MBR partition table, with the file system partition being the last partition.

With this plugin, you can:

  • Provision new ARM images from existing ones
  • Use ARM binaries for provisioning (apt-get install for example)
  • Resize the last partition (the filesystem partition in the raspberry pi) in case you need more space than the default.

Tested for Raspbian images built on Ubuntu 19.10. It is based partly on the chroot AWS provisioner, though the code was copied to prevent AWS dependencies.

How it works

The plugin runs the provisioners in a chroot environment. Binary execution is done using qemu-arm-static, via binfmt_misc.

Dependencies

This builder uses the following shell commands:

  • qemu-user-static - Executing arm binaries. This is optional as the released binary can use embedded versions of qemu-aarch64-static and qemu-arm-static. If you have one installed, it will be used instead of the embedded ones.
  • losetup - To mount the image. This command is pre-installed in most distributions.

To install the needed binaries on derivatives of the Debian Linux variant:

sudo apt install qemu-user-static

Fedora:

sudo dnf install qemu-user-static

Archlinux:

pacman -S qemu-arm-static

Other commands that are used are (that should already be installed) : mount, umount, cp, ls, chroot.

To resize the filesystem, the following commands are used:

  • e2fsck
  • resize2fs

To provide custom arguments to qemu-arm-static using the qemu_args config, gcc is required (to compile a C wrapper).

Note: resizing is only supported for the last active partition in an MBR partition table (as there is no need to move things).

This plugin uses the following kernel feature:

  • support for /proc/sys/fs/binfmt_misc so that ARM binaries are automatically executed with qemu

Operation

This provisioner allows you to run packer provisioners on your ARM image locally. It does so by mounting the image on to the local file system, and then using chroot combined with binfmt_misc to the provisioners in a simulated ARM environment.

Configuration

To use, you need to provide an existing image that we will then modify. We re-use packer's support for downloading ISOs (though the image should not be an ISO file). Supporting also zipped images (enabling you downloading official raspbian images directly).

See raspbian_golang.json and config.go for details. For configuration reference, see the builder doc.

Note if your image is arm64, set qemu_binary to qemu-aarch64-static in your configuration json file.

Compiling and Testing

Building

As this tool performs low-level OS manipulations - consider using a VM to run this code for isolation. While this is recommended, it is not mandatory.

This project uses go modules for dependencies introduced in Go 1.11. To build:

git clone https://github.com/solo-io/packer-plugin-arm-image
cd packer-plugin-arm-image
go mod download
go build

Running with Vagrant

This project includes a Vagrant file and helper script that build a VM run time environment. The run time environment has custom provisions to build an image in an iterative fashion (thanks to @tommie-lie for adding this feature).

To use the Vagrant environment, run the following commands:

git clone https://github.com/solo-io/packer-plugin-arm-image
cd packer-plugin-arm-image
vagrant up

To build an image edit samples/raspbian_golang.json (or set PACKERFILE to point to your json config), and use vagrant provision like so:

vagrant provision --provision-with build-image

The example config produces an image with go installed and extends the filesystem by 1GB.

That's it! Flash it and run!

Running locally

This builder requires root permissions as it performs low level machine operations. To run it locally, you can set PACKER_CONFIG_DIR back to your local home before sudo-ing to packer. For example:

PACKER_CONFIG_DIR=$HOME sudo -E $(which packer) build .

Running with Docker

Prerequisites

Docker needs capability of creating new devices on host machine, so it can create /dev/loop* and mount image into it. While it may be possible to accomplish with multiple --device-cgroup-rule and --add-cap, it's much easier to use --privileged flag to accomplish that. Even so, it is considered bad practice to do so, do it with extra precautions. Also because of those requirements rootless will not work for this container.

Option 1: Clone this repo and build the Docker image locally

Build the Docker image locally

docker build -t packer-builder-arm .

Build the samples/raspbian_golang.json Packer image

docker run \
  --rm \
  --privileged \
  -v /dev:/dev \
  -v ${PWD}:/build:ro \
  -v ${PWD}/packer_cache:/build/packer_cache \
  -v ${PWD}/output-arm-image:/build/output-arm-image \
  -e PACKER_CACHE_DIR=/build/packer_cache \
  packer-builder-arm build samples/raspbian_golang.json

Option 2: Run the published Docker image

Alternatively, you can use the ghcr.io/solo-io/packer-plugin-arm-image that's built off latest master without needing to clone this repository.

docker run \
  --rm \
  --privileged \
  -v /dev:/dev \
  -v ${PWD}:/build:ro \
  -v ${PWD}/packer_cache:/build/packer_cache \
  -v ${PWD}/output-arm-image:/build/output-arm-image \
  ghcr.io/solo-io/packer-plugin-arm-image build samples/raspbian_golang.json

That's it, flash it and run!

Running Standalone

packer build samples/raspbian_golang.json

Flashing

We have a post-processor stage for flashing.

Golang flasher

go build cmd/flasher/main.go

It will auto-detect most things and guides you with questions.

dd

(Tested on MacOS)

# find the identifier of the device you want to flash
diskutil list

# un-mount the disk
diskutil unmountDisk /dev/disk2

# flash the image, go for a coffee
sudo dd bs=4m if=output-arm-image/image of=/dev/disk2

# eject the disk
diskutil eject /dev/disk2

Cookbook

Raspberry Pi Provisioners

Enable ssh

{
  "type": "shell",
  "inline": ["touch /boot/ssh"]
}

Set WiFi password

set the user variables name wifi_name and wifi_password, then:

{
  "type": "shell",
  "inline": [
    "echo 'network={' >> /etc/wpa_supplicant/wpa_supplicant.conf",
    "echo '    ssid=\"{{user `wifi_name`}}\"' >> /etc/wpa_supplicant/wpa_supplicant.conf",
    "echo '    psk=\"{{user `wifi_password`}}\"' >> /etc/wpa_supplicant/wpa_supplicant.conf",
    "echo '}' >> /etc/wpa_supplicant/wpa_supplicant.conf"
    ]
}

Add ssh key to authorized keys, enable ssh, disable password login

This example locks down the image to only use your current ssh key. Disabling password login makes it extra secure for networked environments.

Note: this example requires you to run the plugin without a VM, as it copies your local ssh key.

{
  "variables": {
    "ssh_key_src": "{{env `HOME`}}/.ssh/id_rsa.pub",
    "image_home_dir": "/home/pi"
  },
  "builders": [
    {
      "type": "arm-image",
      "iso_url": "https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip",
      "iso_checksum": "sha256:e942b70072f2e83c446b9de6f202eb8f9692c06e7d92c343361340cc016e0c9f"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "mkdir {{user `image_home_dir`}}/.ssh"
      ]
    },
    {
      "type": "file",
      "source": "{{user `ssh_key_src`}}",
      "destination": "{{user `image_home_dir`}}/.ssh/authorized_keys"
    },
    {
      "type": "shell",
      "inline": [
        "touch /boot/ssh"
      ]
    },
    {
      "type": "shell",
      "inline": [
        "sed '/PasswordAuthentication/d' -i /etc/ssh/sshd_config",
        "echo >> /etc/ssh/sshd_config",
        "echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config"
      ]
    }
  ]
}

A complete example

See everything included in here: samples/pi-secure-wifi-ssh.json. Build like so:

sudo packer build  -var wifi_name=SSID -var wifi_password=PASSWORD samples/pi-secure-wifi-ssh.json
# or  if running from vagrant ssh:
sudo packer build  -var wifi_name=SSID -var wifi_password=PASSWORD /vagrant/samples/pi-secure-wifi-ssh.json

packer-plugin-arm-image's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packer-plugin-arm-image's Issues

packer build command needs sudo.

Command:

packer build example.json

Expected:

Completed packer build

Result:

==> arm-image: Error executing command 'kpartx -s -a output-arm-image/image': exit status 1
==> arm-image: Stderr: /dev/mapper/control: open failed: Permission denied
==> arm-image: Failure to communicate with kernel device-mapper driver.
==> arm-image: Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
==> arm-image: device mapper prerequisites not met
==> arm-image:
==> arm-image: Error executing command 'kpartx -d output-arm-image/image': exit status 1
==> arm-image: Stderr: /dev/mapper/control: open failed: Permission denied
==> arm-image: Failure to communicate with kernel device-mapper driver.
==> arm-image: Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
==> arm-image: device mapper prerequisites not met
==> arm-image:
Build 'arm-image' errored: Error executing command 'kpartx -d output-arm-image/image': exit status 1
Stderr: /dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
device mapper prerequisites not met


==> Some builds didn't complete successfully and had errors:
--> arm-image: Error executing command 'kpartx -d output-arm-image/image': exit status 1
Stderr: /dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper (unknown version) and kernel driver (unknown version).
device mapper prerequisites not met


==> Builds finished but no artifacts were created.

Work around:

sudo packer build example.json

Incompatibility with Packer 1.7

Hi,
just installed a fresh ubuntu server 20.10
plus, packer following official tutorial at https://learn.hashicorp.com/tutorials/packer/getting-started-install
when I run a build it fails with following error:

Error: Failed to initialize build "arm-image"

error initializing builder 'arm-image': The protocol of this plugin (protocol
version 4 and lower) was deprecated, please use a newer version of this
plugin.Or use an older version of Packer (pre 1.7) with this plugin.

It looks like there is an incompatibility with the latest official release of packer.

arm-image: chroot: failed to run command โ€˜/bin/shโ€™: No such file or directory

Looks like some changes introduced on Nov 30 or Dec 1, 2019 have broken the build of raspberry pi 3, 64-bit. We get:

==> arm-image: Installing qemu-user-static in the chroot
==> arm-image: Provisioning with shell script: /tmp/packer-shell206115617
    arm-image: chroot: failed to run command โ€˜/bin/shโ€™: No such file or directory

When using commit b1c268e , the build goes fine.

Relevant part of our packer configuration:

"builders": [{
    "type": "arm-image",
    "iso_url" : "http://cdimage.ubuntu.com/ubuntu-server/bionic/daily-preinstalled/current/bionic-preinstalled-server-arm64+raspi3.img.xz",
    "iso_checksum_type":"sha256",
    "iso_checksum_url": "http://cdimage.ubuntu.com/ubuntu-server/bionic/daily-preinstalled/current/SHA256SUMS",
    "image_mounts": ["/boot/firmware","/"],
    "qemu_binary": "qemu-aarch64-static",
    "chroot_mounts": [
        ["proc", "proc", "/proc"],
        ["sysfs", "sysfs", "/sys"],
        ["bind", "/dev", "/dev"],
        ["devpts", "devpts", "/dev/pts"],
        ["binfmt_misc", "binfmt_misc", "/proc/sys/fs/binfmt_misc"],
        ["bind", "/run/resolvconf", "/run/resolvconf"]
    ]
  }],

Tested on Packer 1.3.5 and 1.4.5.

Fails at go build

Seems to fail at go build. I think incompatible libraries? Perhaps upgrade or something? Below is a log.

    default: + go build
    default: # github.com/solo-io/packer-builder-arm-image/vendor/github.com/hashicorp/packer/packer
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:46:34: spb.BasicProgressBar.ProgressBar.SetUnits undefined (type *pb.ProgressBar has no field or method SetUnits)
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:46:44: undefined: pb.U_BYTES
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:61:5: spb.SetTotal64 undefined (type *StackableProgressBar has no field or method SetTotal64)
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:67:34: spb.BasicProgressBar.ProgressBar.Prefix undefined (type *pb.ProgressBar has no field or method Prefix)
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:93:5: cannot use new(BasicProgressBar) (type *BasicProgressBar) as type ProgressBar in assignment:
    default: 	*BasicProgressBar does not implement ProgressBar (wrong type for Finish method)
    default: 		have Finish() *pb.ProgressBar
    default: 		want Finish()
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:96:5: bpb.SetTotal64 undefined (type *BasicProgressBar has no field or method SetTotal64)
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:106:14: cannot use bpb (type *BasicProgressBar) as type ProgressBar in field value:
    default: 	*BasicProgressBar does not implement ProgressBar (wrong type for Finish method)
    default: 		have Finish() *pb.ProgressBar
    default: 		want Finish()
    default: vendor/github.com/hashicorp/packer/packer/progressbar.go:112:14: cannot use bpb (type *BasicProgressBar) as type ProgressBar in field value:
    default: 	*BasicProgressBar does not implement ProgressBar (wrong type for Finish method)
    default: 		have Finish() *pb.ProgressBar
    default: 		want Finish()
    default: # github.com/solo-io/packer-builder-arm-image/vendor/github.com/masterzen/winrm
    default: vendor/github.com/masterzen/winrm/auth.go:38:18: cannot use "github.com/solo-io/packer-builder-arm-image/vendor/github.com/masterzen/azure-sdk-for-go/core/tls".Config literal (type *"github.com/solo-io/packer-builder-arm-image/vendor/github.com/masterzen/azure-sdk-for-go/core/tls".Config) as type *"github.com/solo-io/packer-builder-arm-image/vendor/github.com/MSOpenTech/azure-sdk-for-go/core/tls".Config in field value
    default: + [[ ! -f packer-builder-arm-image ]]
    default: + echo 'Error Plugin failed to build.'
    default: + exit
    default: Error Plugin failed to build.
==> default: Running provisioner: build-image (shell)...
    default: Running: /var/folders/xy/w5lbbbz97r5c8cfxjx2n9vcxqvhpdd/T/vagrant-shell20180924-88593-w9q6gl.sh
    default: + set -e
    default: + export PACKERFILE=example.json
    default: + PACKERFILE=example.json
    default: + mkdir -p /home/vagrant/.packer.d/plugins
    default: + cp /vagrant/packer-builder-arm-image /home/vagrant/.packer.d/plugins/
    default: cp: cannot stat '/vagrant/packer-builder-arm-image'
    default: : No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Tried running manually, still nothing

 $ cd work/src/github.com/solo-io/packer-builder-arm-image/
 $ ls -la
total 92
drwxr-xr-x 8 vagrant vagrant  4096 Sep 24 22:43 .
drwxrwxr-x 3 vagrant vagrant  4096 Sep 24 22:42 ..
drwxr-xr-x 7 vagrant vagrant  4096 Sep 24 22:34 .git
-rw-r--r-- 1 vagrant vagrant    48 Sep 24 22:28 .gitignore
drwxr-xr-x 3 vagrant vagrant  4096 Sep 24 22:39 .vagrant
-rw-rw-r-- 1 vagrant vagrant 15532 Sep 24 22:43 Gopkg.lock
-rw-r--r-- 1 vagrant vagrant   943 Sep 24 22:28 Gopkg.toml
-rw-r--r-- 1 vagrant vagrant  5663 Sep 24 22:28 README.md
-rw-r--r-- 1 vagrant vagrant  1121 Sep 24 22:28 Vagrantfile
drwxr-xr-x 3 vagrant vagrant  4096 Sep 24 22:28 cmd
drwxr-xr-x 2 vagrant vagrant  4096 Sep 24 22:28 contrib
-rw-r--r-- 1 vagrant vagrant   492 Sep 24 22:28 example.json
-rw-r--r-- 1 vagrant vagrant   396 Sep 24 22:28 main.go
-rw-r--r-- 1 vagrant vagrant   376 Sep 24 22:29 micro-raspbian.iml
drwxr-xr-x 7 vagrant vagrant  4096 Sep 24 22:28 pkg
-rw-r--r-- 1 vagrant vagrant  1463 Sep 24 22:28 provision-build-env.sh
-rw-r--r-- 1 vagrant vagrant  1748 Sep 24 22:28 provision-build-image.sh
-rw-r--r-- 1 vagrant vagrant   923 Sep 24 22:28 provision-packer-builder-arm-image.sh
drwxrwxr-x 5 vagrant vagrant  4096 Sep 24 22:43 vendor
 $ dep ensure
 $ go build
# github.com/solo-io/packer-builder-arm-image/vendor/github.com/hashicorp/packer/packer
vendor/github.com/hashicorp/packer/packer/progressbar.go:46:34: spb.BasicProgressBar.ProgressBar.SetUnits undefined (type *pb.ProgressBar has no field or method SetUnits)
vendor/github.com/hashicorp/packer/packer/progressbar.go:46:44: undefined: pb.U_BYTES
vendor/github.com/hashicorp/packer/packer/progressbar.go:61:5: spb.SetTotal64 undefined (type *StackableProgressBar has no field or method SetTotal64)
vendor/github.com/hashicorp/packer/packer/progressbar.go:67:34: spb.BasicProgressBar.ProgressBar.Prefix undefined (type *pb.ProgressBar has no field or method Prefix)
vendor/github.com/hashicorp/packer/packer/progressbar.go:93:5: cannot use new(BasicProgressBar) (type *BasicProgressBar) as type ProgressBar in assignment:
	*BasicProgressBar does not implement ProgressBar (wrong type for Finish method)
		have Finish() *pb.ProgressBar
		want Finish()
vendor/github.com/hashicorp/packer/packer/progressbar.go:96:5: bpb.SetTotal64 undefined (type *BasicProgressBar has no field or method SetTotal64)
vendor/github.com/hashicorp/packer/packer/progressbar.go:106:14: cannot use bpb (type *BasicProgressBar) as type ProgressBar in field value:
	*BasicProgressBar does not implement ProgressBar (wrong type for Finish method)
		have Finish() *pb.ProgressBar
		want Finish()
vendor/github.com/hashicorp/packer/packer/progressbar.go:112:14: cannot use bpb (type *BasicProgressBar) as type ProgressBar in field value:
	*BasicProgressBar does not implement ProgressBar (wrong type for Finish method)
		have Finish() *pb.ProgressBar
		want Finish()
# github.com/solo-io/packer-builder-arm-image/vendor/github.com/masterzen/winrm
vendor/github.com/masterzen/winrm/auth.go:38:18: cannot use "github.com/solo-io/packer-builder-arm-image/vendor/github.com/masterzen/azure-sdk-for-go/core/tls".Config literal (type *"github.com/solo-io/packer-builder-arm-image/vendor/github.com/masterzen/azure-sdk-for-go/core/tls".Config) as type *"github.com/solo-io/packer-builder-arm-image/vendor/github.com/MSOpenTech/azure-sdk-for-go/core/tls".Config in field value

Publish docker image to docker registry

Hey, this plugin is really useful. Would you mind publishing this to the docker registry, so it's possible to use the docker support without needing to do a docker build? Would make it way easier to use in CI.

Fail to build image with latest version

Using a fresh clone of this repository and doing a vagrant up results in the following output:

    default: Attempting to build image
    default: + popd
    default: + popd
    default: + [[ ! -f /home/vagrant/.packer.d/plugins/packer-builder-arm-image ]]
    default: + echo 'Attempting to build image'
    default: + [[ -f /vagrant/example.json ]]
    default: + sudo packer build /vagrant/example.json
    default: arm-image output will be in this color.
    default: 0 error(s) occurred:
    default: Error: Unable to find build artifact.
    default: + [[ -f /home/vagrant/output-arm-image/image ]]
    default: + echo 'Error: Unable to find build artifact.'
    default: + exit

In other words, the image os not being built but packer-builder-arm-image does not report any errors.

I pinpointed the problem to 452015d, and the line 452015d#diff-7d55094d2095596359f9af68227cd7cfR174 which should really be return warnings, nil if errs has length 0.
A pull request which fixes this problem for me will come shortly.

HOWTO: Building in Docker

Not an issue, but i thought i'd leave it here in case somebody has the same requirement...

I've created a Dockerfile that allows me to build (at least) Raspbian images in a container. I haven't published the image anywhere public, as i don't think there's much use for it on typical cloud CI environments, as the container needs to run privileged.

You can find it here: https://git.faked.org/jan/docker-packer-arm

Changing URL in iso_url fails (v0.1.6)

This is the same issue as this.

I get this error with v0.1.6 whenever I change the default iso_url value.

Whether the URL is completely bogus, or points to a valid zipped .img file, the same error occurs.

Error: Failed to prepare build: "arm-image"

1 error(s) occurred:

* no image mounts provided. Please set the image mounts or image type.

I have made sure the iso_checksum value is correct.

  "builders": [
    {
      "type": "arm-image",
      "iso_url": "....",
      "iso_checksum": "sha256:55f9b5382c4756102be859858dd493d006345899df82e836864d2c55f72ff159",
      "target_image_size": 5368709120
    }
  ],

Im running on Docker e.g.

docker run --rm \
--privileged \
-v ${PWD}:/build:ro \
-v ${PWD}/packer_cache:/build/packer_cache \
-v ${PWD}/output-arm-image:/build/output-arm-image \
docker.pkg.github.com/solo-io/packer-builder-arm-image/packer-builder-arm:${VERSION} build image.json

Image build failed when I try to install Docker in provisionner part

Hi

I followed this tutorial : http://bingel.it/raspberry-pi-image-with-hashicorp-packer/

But it fails .... see below ... any idea?

Info : I use Packer 1.6.5 in the Dockerfile

Here is my json file:

{
  "variables": {},
  "builders": [{
    "type": "arm-image",
    "iso_url" : "/applications/raspios/2020-08-20-raspios-buster-armhf-lite.zip",
    "iso_checksum": "4522df4a29f9aac4b0166fbfee9f599dab55a997c855702bfe35329c13334668",
    "iso_checksum_type": "sha256"
  }],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "touch /boot/ssh",
        "apt-get update",
        "curl -sSL https://get.docker.com | sh &> /dev/null",
        "sudo usermod -aG docker pi"
      ]
    }
  ]
}
root@debian-tools:/applications/packer-builder-arm-image# docker run --rm --privileged -v /applications/packer-builder-arm-image/build:/build -v /applications/packer-builder-arm-image/packer_cache:/build/packer_cache -v /applications/packer-builder-arm-image/build/output-arm-image:/build/output-arm-image -e PACKER_CACHE_DIR=/build/packer_cache -v /applications/raspios:/applications/raspios solo-io-packer-builder-arm build /applications/raspios/raspios2.json
running /bin/packer
arm-image: output will be in this color.

==> arm-image: Retrieving Image
==> arm-image: Trying /applications/raspios/2020-08-20-raspios-buster-armhf-lite.zip
==> arm-image: Trying /applications/raspios/2020-08-20-raspios-buster-armhf-lite.zip?checksum=sha256%3A4522df4a29f9aac4b0166fbfee9f599dab55a997c855702bfe35329c13334668
==> arm-image: /applications/raspios/2020-08-20-raspios-buster-armhf-lite.zip?checksum=sha256%3A4522df4a29f9aac4b0166fbfee9f599dab55a997c855702bfe35329c13334668 => /build/packer_cache/b97f5390e800f79bb942ce5911840e053b371159.iso
==> arm-image: Copying source image.
==> arm-image: Image is a zip file.
==> arm-image: Unzipping 2020-08-20-raspios-buster-armhf-lite.img
    arm-image: Speed:  177.71 MB/s
    arm-image: Progress: 48.15%
    arm-image: Speed:  141.19 MB/s
    arm-image: Progress: 86.40%
    arm-image: mapping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image
==> arm-image: partitions: [/dev/mapper/loop0p1 /dev/mapper/loop0p2]
    arm-image: Mounting: /dev/mapper/loop0p2
    arm-image: Mounting: /dev/mapper/loop0p1
==> arm-image: Mounting additional paths within the chroot...
    arm-image: Mounting: /proc
    arm-image: Mounting: /sys
    arm-image: Mounting: /dev
    arm-image: Mounting: /dev/pts
    arm-image: Mounting: /proc/sys/fs/binfmt_misc
==> arm-image: Installing qemu-user-static in the chroot
==> arm-image: Provisioning with shell script: /tmp/packer-shell880311305
    arm-image: Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]
    arm-image: Get:2 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB]
    arm-image: Get:3 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
    arm-image: Get:4 http://archive.raspberrypi.org/debian buster/main armhf Packages [336 kB]
    arm-image: Get:5 http://raspbian.raspberrypi.org/raspbian buster/contrib armhf Packages [58.7 kB]
    arm-image: Fetched 13.4 MB in 22s (616 kB/s)
    arm-image: Reading package lists...
==> arm-image: sudo: unable to resolve host 02df390c1497: Name or service not known
==> arm-image: usermod: group 'docker' does not exist
    arm-image: # Executing docker install script, commit: 26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c
==> arm-image: + sh -c apt-get update -qq >/dev/null
==> arm-image: + sh -c DEBIAN_FRONTEND=noninteractive apt-get install -y -qq apt-transport-https ca-certificates curl >/dev/null
==> arm-image: + sh -c curl -fsSL "https://download.docker.com/linux/raspbian/gpg" | apt-key add -qq - >/dev/null
==> arm-image: Warning: apt-key output should not be parsed (stdout is not a terminal)
==> arm-image: + sh -c echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list
==> arm-image: + sh -c apt-get update -qq >/dev/null
==> arm-image: + [ -n  ]
==> arm-image: + sh -c apt-get install -y -qq --no-install-recommends docker-ce >/dev/null
==> arm-image: debconf: unable to initialize frontend: Dialog
==> arm-image: debconf: (TERM is not set, so the dialog frontend is not usable.)
==> arm-image: debconf: falling back to frontend: Readline
==> arm-image: debconf: unable to initialize frontend: Readline
==> arm-image: debconf: (This frontend requires a controlling tty.)
==> arm-image: debconf: falling back to frontend: Teletype
==> arm-image: dpkg-preconfigure: unable to re-open stdin:
==> arm-image: E: Sub-process /usr/bin/dpkg returned an error code (1)
==> arm-image: fuser -k /tmp/272101727
Build 'arm-image' errored after 2 minutes 51 seconds: Script exited with non-zero exit status: 6.Allowed exit codes are: [0]

==> Wait completed after 2 minutes 51 seconds

==> Some builds didn't complete successfully and had errors:
--> arm-image: Script exited with non-zero exit status: 6.Allowed exit codes are: [0]

==> Builds finished but no artifacts were created.

Error: Plugin not found. Retry build.

#82 Introduced a breaking bug by changing the path of the plugin installation location. On the very next line, it checks for the location of the packer-builder-arm-image in the old location, causing the script to fail.

    default: + PACKERFILE=/vagrant/rpi_ubuntu_arm64_with_salt.json
    default: + sudo mkdir -p /root/.packer.d/plugins
    default: + sudo cp /vagrant/packer-builder-arm-image /root/.packer.d/plugins/
    default: + [[ ! -f /home/vagrant/.packer.d/plugins/packer-builder-arm-image ]]
    default: + echo 'Error: Plugin not found. Retry build.'
    default: Error: Plugin not found. Retry build.

Failed to initialize build 'arm-image': error initializing builder 'arm-image': fork/exec /usr/bin/packer-builder-arm-image: no such file or directory

Failed to initialize build 'arm-image': error initializing builder 'arm-image': fork/exec /usr/bin/packer-builder-arm-image: no such file or directory

Any ideas why I would run into the following error?

Checking the obvious shows that the file does in fact exist with sensible flags:

$ ls -lah /usr/bin/packer-builder-arm-image 
-rwxr-xr-x 1 root root 14M Jul 29 10:01 /usr/bin/packer-builder-arm-image

$ file /usr/bin/packer-builder-arm-image 
/usr/bin/packer-builder-arm-image: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-, not stripped

Note: I downloaded the executable directly from the v0.1.0 release

Complete build log is here:

2019/07/29 10:12:19 [INFO] Packer version: 1.4.2
2019/07/29 10:12:19 Packer Target OS/Arch: linux amd64
2019/07/29 10:12:19 Built with Go Version: go1.12.6
2019/07/29 10:12:19 [DEBUG] Discovered plugin: arm-image = /usr/bin/packer-builder-arm-image
2019/07/29 10:12:19 Detected home directory from env var: /home/dummy
2019/07/29 10:12:19 Using internal plugin for amazon-chroot
2019/07/29 10:12:19 Using internal plugin for amazon-ebssurrogate
2019/07/29 10:12:19 Using internal plugin for hyperv-iso
2019/07/29 10:12:19 Using internal plugin for ncloud
2019/07/29 10:12:19 Using internal plugin for profitbricks
2019/07/29 10:12:19 Using internal plugin for scaleway
2019/07/29 10:12:19 Using internal plugin for tencentcloud-cvm
2019/07/29 10:12:19 Using internal plugin for vmware-vmx
2019/07/29 10:12:19 Using internal plugin for amazon-ebsvolume
2019/07/29 10:12:19 Using internal plugin for amazon-instance
2019/07/29 10:12:19 Using internal plugin for digitalocean
2019/07/29 10:12:19 Using internal plugin for lxd
2019/07/29 10:12:19 Using internal plugin for oneandone
2019/07/29 10:12:19 Using internal plugin for virtualbox-iso
2019/07/29 10:12:19 Using internal plugin for hcloud
2019/07/29 10:12:19 Using internal plugin for hyperv-vmcx
2019/07/29 10:12:19 Using internal plugin for lxc
2019/07/29 10:12:19 Using internal plugin for qemu
2019/07/29 10:12:19 Using internal plugin for alicloud-ecs
2019/07/29 10:12:19 Using internal plugin for amazon-ebs
2019/07/29 10:12:19 Using internal plugin for proxmox
2019/07/29 10:12:19 Using internal plugin for virtualbox-ovf
2019/07/29 10:12:19 Using internal plugin for googlecompute
2019/07/29 10:12:19 Using internal plugin for hyperone
2019/07/29 10:12:19 Using internal plugin for null
2019/07/29 10:12:19 Using internal plugin for oracle-oci
2019/07/29 10:12:19 Using internal plugin for parallels-iso
2019/07/29 10:12:19 Using internal plugin for parallels-pvm
2019/07/29 10:12:19 Using internal plugin for azure-arm
2019/07/29 10:12:19 Using internal plugin for file
2019/07/29 10:12:19 Using internal plugin for linode
2019/07/29 10:12:19 Using internal plugin for yandex
2019/07/29 10:12:19 Using internal plugin for cloudstack
2019/07/29 10:12:19 Using internal plugin for docker
2019/07/29 10:12:19 Using internal plugin for vmware-iso
2019/07/29 10:12:19 Using internal plugin for vagrant
2019/07/29 10:12:19 Using internal plugin for openstack
2019/07/29 10:12:19 Using internal plugin for oracle-classic
2019/07/29 10:12:19 Using internal plugin for triton
2019/07/29 10:12:19 Using internal plugin for ansible
2019/07/29 10:12:19 Using internal plugin for chef-solo
2019/07/29 10:12:19 Using internal plugin for file
2019/07/29 10:12:19 Using internal plugin for inspec
2019/07/29 10:12:19 Using internal plugin for shell
2019/07/29 10:12:19 Using internal plugin for shell-local
2019/07/29 10:12:19 Using internal plugin for breakpoint
2019/07/29 10:12:19 Using internal plugin for chef-client
2019/07/29 10:12:19 Using internal plugin for puppet-masterless
2019/07/29 10:12:19 Using internal plugin for converge
2019/07/29 10:12:19 Using internal plugin for salt-masterless
2019/07/29 10:12:19 Using internal plugin for windows-shell
2019/07/29 10:12:19 Using internal plugin for ansible-local
2019/07/29 10:12:19 Using internal plugin for powershell
2019/07/29 10:12:19 Using internal plugin for puppet-server
2019/07/29 10:12:19 Using internal plugin for sleep
2019/07/29 10:12:19 Using internal plugin for windows-restart
2019/07/29 10:12:19 Using internal plugin for vsphere-template
2019/07/29 10:12:19 Using internal plugin for alicloud-import
2019/07/29 10:12:19 Using internal plugin for compress
2019/07/29 10:12:19 Using internal plugin for docker-import
2019/07/29 10:12:19 Using internal plugin for docker-save
2019/07/29 10:12:19 Using internal plugin for manifest
2019/07/29 10:12:19 Using internal plugin for vagrant
2019/07/29 10:12:19 Using internal plugin for amazon-import
2019/07/29 10:12:19 Using internal plugin for docker-tag
2019/07/29 10:12:19 Using internal plugin for shell-local
2019/07/29 10:12:19 Using internal plugin for artifice
2019/07/29 10:12:19 Using internal plugin for checksum
2019/07/29 10:12:19 Using internal plugin for docker-push
2019/07/29 10:12:19 Using internal plugin for googlecompute-export
2019/07/29 10:12:19 Using internal plugin for digitalocean-import
2019/07/29 10:12:19 Using internal plugin for googlecompute-import
2019/07/29 10:12:19 Using internal plugin for vagrant-cloud
2019/07/29 10:12:19 Using internal plugin for vsphere
2019/07/29 10:12:19 Detected home directory from env var: /home/dummy
2019/07/29 10:12:19 Attempting to open config file: /home/dummy/.packerconfig
2019/07/29 10:12:19 [WARN] Config file doesn't exist: /home/dummy/.packerconfig
2019/07/29 10:12:19 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[alicloud-ecs:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-alicloud-ecs amazon-chroot:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-chroot amazon-ebs:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebs amazon-ebssurrogate:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebssurrogate amazon-ebsvolume:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-ebsvolume amazon-instance:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-amazon-instance arm-image:/usr/bin/packer-builder-arm-image azure-arm:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-azure-arm cloudstack:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-cloudstack digitalocean:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-digitalocean docker:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-docker file:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-file googlecompute:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-googlecompute hcloud:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hcloud hyperone:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperone hyperv-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-iso hyperv-vmcx:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-hyperv-vmcx linode:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-linode lxc:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxc lxd:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-lxd ncloud:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-ncloud null:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-null oneandone:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oneandone openstack:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-openstack oracle-classic:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oracle-classic oracle-oci:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-oracle-oci parallels-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-iso parallels-pvm:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-parallels-pvm profitbricks:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-profitbricks proxmox:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-proxmox qemu:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-qemu scaleway:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-scaleway tencentcloud-cvm:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-tencentcloud-cvm triton:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-triton vagrant:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vagrant virtualbox-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-iso virtualbox-ovf:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-virtualbox-ovf vmware-iso:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-iso vmware-vmx:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-vmware-vmx yandex:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-builder-yandex] PostProcessors:map[alicloud-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-alicloud-import amazon-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-amazon-import artifice:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-artifice checksum:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-checksum compress:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-compress digitalocean-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-digitalocean-import docker-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-import docker-push:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-push docker-save:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-save docker-tag:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-docker-tag googlecompute-export:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-export googlecompute-import:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-googlecompute-import manifest:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-manifest shell-local:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-shell-local vagrant:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant vagrant-cloud:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vagrant-cloud vsphere:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere vsphere-template:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-post-processor-vsphere-template] Provisioners:map[ansible:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible ansible-local:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-ansible-local breakpoint:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-breakpoint chef-client:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-client chef-solo:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-chef-solo converge:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-converge file:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-file inspec:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-inspec powershell:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-powershell puppet-masterless:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-masterless puppet-server:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-puppet-server salt-masterless:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-salt-masterless shell:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell shell-local:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-shell-local sleep:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-sleep windows-restart:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-restart windows-shell:/usr/bin/packer-PACKERSPACE-plugin-PACKERSPACE-packer-provisioner-windows-shell]}
2019/07/29 10:12:19 Detected home directory from env var: /home/dummy
2019/07/29 10:12:19 Setting cache directory: /home/dummy/workspace/packer/rpi-hypriotos/packer_cache
2019/07/29 10:12:19 Detected home directory from env var: /home/dummy
2019/07/29 10:12:19 Loading builder: arm-image
2019/07/29 10:12:19 Creating plugin client for path: /usr/bin/packer-builder-arm-image
2019/07/29 10:12:19 Starting plugin: /usr/bin/packer-builder-arm-image []string{"/usr/bin/packer-builder-arm-image"}
2019/07/29 10:12:19 ui error: Failed to initialize build 'arm-image': error initializing builder 'arm-image': fork/exec /usr/bin/packer-builder-arm-image: no such file or directory
2019/07/29 10:12:19 Build debug mode: false
2019/07/29 10:12:19 Force build: true
2019/07/29 10:12:19 On error: 
2019/07/29 10:12:19 Waiting on builds to complete...
==> Builds finished but no artifacts were created.
2019/07/29 10:12:19 [INFO] (telemetry) Finalizing.
Failed to initialize build 'arm-image': error initializing builder 'arm-image': fork/exec /usr/bin/packer-builder-arm-image: no such file or directory
arm-image output will be in this color.


==> Builds finished but no artifacts were created.
2019/07/29 10:12:19 waiting for all plugin processes to complete...

Failed to fetch dependencies

Wondering if anyone can shed some light on this problem? Is it just a matter of needing to change the dependency mirrors?

This was my result from running vagrant up

default: ==> arm-image: Copying source image.
    default: ==> arm-image: Image is a zip file.
    default: ==> arm-image: Unzipping 2018-11-13-raspbian-stretch-lite.img
    default:     arm-image: Speed:   45.87 MB/s
    default:     arm-image: Progress: 36.87%
    default: ==> arm-image: Resizing the last partition 1073741824.
    default:     arm-image: mappping output-arm-image/image
    default: ==> arm-image: kpartx -s -a -v output-arm-image/image
    default: ==> arm-image: partitions: [/dev/mapper/loop0p1 /dev/mapper/loop0p2]
    default: ==> arm-image: partitions: [/dev/mapper/loop0p1 /dev/mapper/loop0p2]
    default:     arm-image: Mounting: /dev/mapper/loop0p2
    default:     arm-image: Mounting: /dev/mapper/loop0p1
    default: ==> arm-image: Mounting additional paths within the chroot...
    default:     arm-image: Mounting: /proc
    default:     arm-image: Mounting: /sys
    default:     arm-image: Mounting: /dev
    default:     arm-image: Mounting: /dev/pts
    default:     arm-image: Mounting: /proc/sys/fs/binfmt_misc
    default: ==> arm-image: Installing qemu-user-static in the chroot
    default: ==> arm-image: Provisioning with shell script: /tmp/packer-shell187478908
    default:     arm-image: Err:1 http://raspbian.raspberrypi.org/raspbian stretch InRelease
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:2 http://archive.raspberrypi.org/debian stretch InRelease
    default:     arm-image:   Temporary failure resolving 'archive.raspberrypi.org'
    default:     arm-image: Reading package lists...
    default:     arm-image: W: Failed to fetch http://raspbian.raspberrypi.org/raspbian/dists/stretch/InRelease  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: W: Failed to fetch http://archive.raspberrypi.org/debian/dists/stretch/InRelease  Temporary failure resolving 'archive.raspberrypi.org'
    default:     arm-image: W: Some index files failed to download. They have been ignored, or old ones used instead.
    default:     arm-image: Reading package lists...
    default:     arm-image: Building dependency tree...
    default:     arm-image: Reading state information...
    default:     arm-image: The following additional packages will be installed:
    default:     arm-image:   golang-1.7 golang-1.7-doc golang-1.7-go golang-1.7-src golang-doc golang-go
    default:     arm-image:   golang-src
    default:     arm-image: Suggested packages:
    default:     arm-image:   bzr git mercurial subversion
    default:     arm-image: The following NEW packages will be installed:
    default:     arm-image:   golang golang-1.7 golang-1.7-doc golang-1.7-go golang-1.7-src golang-doc
    default:     arm-image:   golang-go golang-src
    default:     arm-image: 0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
    default:     arm-image: Need to get 27.5 MB of archives.
    default:     arm-image: After this operation, 144 MB of additional disk space will be used.
    default:     arm-image: Err:1 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-1.7-src armhf 1.7.4-2+rpi1
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:2 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-1.7-go armhf 1.7.4-2+rpi1
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-1.7-doc all 1.7.4-2+rpi1
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:4 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-1.7 all 1.7.4-2+rpi1
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:5 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-src armhf 2:1.7~5
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:6 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-go armhf 2:1.7~5
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:7 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang-doc all 2:1.7~5
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: Err:8 http://raspbian.raspberrypi.org/raspbian stretch/main armhf golang armhf 2:1.7~5
    default:     arm-image:   Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-1.7/golang-1.7-src_1.7.4-2+rpi1_armhf.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-1.7/golang-1.7-go_1.7.4-2+rpi1_armhf.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-1.7/golang-1.7-doc_1.7.4-2+rpi1_all.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-1.7/golang-1.7_1.7.4-2+rpi1_all.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-defaults/golang-src_1.7~5_armhf.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-defaults/golang-go_1.7~5_armhf.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-defaults/golang-doc_1.7~5_all.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Failed to fetch http://raspbian.raspberrypi.org/raspbian/pool/main/g/golang-defaults/golang_1.7~5_armhf.deb  Temporary failure resolving 'raspbian.raspberrypi.org'
    default:     arm-image: E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
    default: Build 'arm-image' errored: Script exited with non-zero exit status: 100
    default:
    default: ==> Some builds didn't complete successfully and had errors:
    default: --> arm-image: Script exited with non-zero exit status: 100
    default:
    default: ==> Builds finished but no artifacts were created.
    default: ++ grep -Po '(?<=Build '\'').*(?='\'' finished.)' /tmp/tmp.HrcLutGpo2
    default: + BUILD_NAME=
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

Use local image `file:///` with `docker run`

I would like to build an image in multiple steps to not redo all the downloads each time.
I thought I can use file:// as an iso_url and map in the output-arm-image directory.

Question: How can I reuse an image that I build in a previous run?

Awesome tool btw; love it!

"builders": [
    {
      "type": "arm-image",
      "iso_url": "file:///prom_base.img",
      "last_partition_extra_size": 1048576000,
      "iso_checksum_type": "md5",
      "iso_checksum": "6415daf45a89e98339180bd59de0ec12",
      "image_type": "raspberrypi",
      "image_mounts": ["/output-arm-image", "/"]

    }
  ]

When kicking this off it looks like this.

docker run \                                                                                                                                    git:(master|โœš1โ€ฆ
  --rm --privileged -v ${HOME}/.ssh/:/root/.ssh/ \
  -v ${PWD}:/build:ro \
  -v ${PWD}/packer_cache:/build/packer_cache \
  -v ${PWD}/output-arm-image:/build/output-arm-image  packer-builder-arm build samples/raspbian_prom_setup.json
running /bin/packer
arm-image: output will be in this color.

Warnings for build 'arm-image':

* last_partition_extra_size is deprecated, use target_image_size to grow your image

==> arm-image: Retrieving Image
==> arm-image: Trying file:///prom_base.img
==> arm-image: Trying file:///prom_base.img?checksum=md5%3A6415daf45a89e98339180bd59de0ec12
==> arm-image: Download failed source path error: stat /prom_base.img: no such file or directory
==> arm-image: error downloading Image: [source path error: stat /prom_base.img: no such file or directory]
Build 'arm-image' errored: error downloading Image: [source path error: stat /prom_base.img: no such file or directory]

==> Some builds didn't complete successfully and had errors:
--> arm-image: error downloading Image: [source path error: stat /prom_base.img: no such file or directory]

==> Builds finished but no artifacts were created.

Vagrantfile won't mount /vagrant synced folder (and enabling it will fail in Virtualbox)

Unfortunately, merging my PR #4 introduced a grave regression: The generic images have the default synced folder disabled. It is easy to enable it again by adding

  config.vm.synced_folder "./", "/vagrant", disabled: false

to the Vagrantfile, but this causes issues if the VirtualBox provider is used:

  • The box does not have virtualbox-guest-utils installed which, means mount.vboxsf is missing and the necessary kernel modules to mount VirtualBox shared folders are not automatically loaded.
  • Manually installing virtualbox-guest-utils before Vagrant tries to mount the synced folder is not possible. This is a common problem and there are many issues filed for this. All workarounds that have been proposed don't work anymore because Vagrant has evolved so erratically that features that once existed are still visible in some sourcecode (https://github.com/hashicorp/vagrant/blob/master/plugins/providers/virtualbox/synced_folder.rb#L38) but are rendered unusable somewhere else.

There are two options to solve that:

  • vagrant plugin install vagrant-vbguest which automatically installs the matching version of the VirtualBox guest additions before Vagrant mounts the folders and probably solves a lot of other problems with VirtualBox.
  • Use a different base box, e.g. https://app.vagrantup.com/ubuntu/boxes/xenial64 only when using VirtualBox:
  config.vm.provider :virtualbox do |vb, override|
    override.vm.box = "ubuntu/xenial64"
    # disable the generation of ubuntu-xenial-16.04-cloudimg-console.log file
    # https://betacloud.io/get-rid-of-ubuntu-xenial-16-04-cloudimg-console-log/
    vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
  end

libvirt (the reason I changed base box in the first place) is not affected by all of this. Could someone with a VMware or Parallels license please test whether they have a similar issue?

Also, I'd like to know if the above makes sense and if using ubuntu/xenial64 works for more than my version of VirtualBox (5.2.8) to avoid making the same mistake again as last time.

"no image mounts provided." with latest rpi download

With the example in the README (but with a newer pi release), I get this error:

1 error(s) occurred:

* no image mounts provided. Please set the image mounts or image type.

Looking through the code, I was able to figure out that this was because the image type wasn't being figured out earlier. I was able to get past this by adding image_type to my builder like so:

  {
    "type": "arm-image",
    "image_type": "raspberrypi",
    "iso_url": "http://downloads.raspberrypi.org/raspios_lite_armhf/images/raspios_lite_armhf-2020-05-28/2020-05-27-raspios-buster-lite-armhf.zip",
    "iso_checksum_type": "sha256",
    "iso_checksum": "f5786604be4b41e292c5b3c711e2efa64b25a5b51869ea8313d58da0b46afc64"
  }

I'm not sure if some auto-detection code needs to be updated (they changed the URL format, probably so they can prepare for 64-bit versions of the pi), or if the readme should be updated.

packer unable to find local file

Hi,

I'm getting this error when trying to build an image with docker. The file it cannot find ("/Users/tennis.smith/.ssh/id_rsa.pub") absolutely exists. It appears the utility is looking for the file inside the container instead of externally.

Error:

running /bin/packer
Error: Failed to prepare build: "arm-image"

1 error(s) occurred:

* Bad source '/Users/tennis.smith/.ssh/id_rsa.pub': stat
/Users/tennis.smith/.ssh/id_rsa.pub: no such file or directory

Here is the command:

docker run \
  --rm \
  --privileged \
  -v ${PWD}:/build:ro \
  -v ${PWD}/packer_cache:/build/packer_cache \
  -v ${PWD}/output-arm-image:/build/output-arm-image \
  docker.pkg.github.com/solo-io/packer-builder-arm-image/packer-builder-arm build \
  -var wifi_name=foo -var wifi_password=bar -var home=/Users/tennis.smith \
  ./pi-set-wifi-and-ssh.json

Here is the input JSON file:

{
  "variables": {
    "wifi_name": "",
    "wifi_password": "",
    "home": ""
  },
  "builders": [{
    "type": "arm-image",
    "iso_url": "https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2020-08-24/2020-08-20-raspios-buster-arm64-lite.zip",
    "iso_checksum": "sha256:0639c516aa032df314b176bda97169bdc8564e7bc5afd4356caafbc3f6d090ed",
    "last_partition_extra_size": 1073741824
  }],
  "provisioners": [
    {
      "type": "shell",
      "inline": ["touch /boot/ssh"]
    },
    {
      "type": "shell",
      "inline": [
        "wpa_passphrase \"{{user `wifi_name`}}\" \"{{user `wifi_password`}}\" | sed -e 's/#.*$//' -e '/^$/d' >> /etc/wpa_supplicant/wpa_supplicant.conf"
      ]
    },
    {
      "type": "file",
      "source": "{{user `home`}}/.ssh/id_rsa.pub",
      "destination": "/home/pi/.ssh/authorized_keys"
    },
    {
      "type": "shell",
      "inline": [
        "sed '/PasswordAuthentication/d' -i /etc/ssh/sshd_config",
        "echo  >> /etc/ssh/sshd_config",
        "echo 'PasswordAuthentication no' >> /etc/ssh/sshd_config"
      ]
    }
  ]
}

Here is my docker version:

$ docker --version
Docker version 19.03.13, build 4484c46d9d

Last partition is not consistently grown even when target_image_size is set

When running the packer-builder-arm out of a Docker container (Jan 25 release on MacOS, which shouldn't matter), the second image partition is inconsistently resized. My json file specifies the target_image_size properly and it seems like every 3rd or 4th build the image resizes. Otherwise, the Growing partition to 4096 M step is completely skipped (which results in running out of space in the image when I perform an apt-get dist-upgrade). I've included the output of two different attempted builds - both run with the exact same command.

Here's the builder snippet from my packer json file:

    "builders": [
      {
        "type": "arm-image",
        "iso_url": "/mnt/image/2020-02-13-raspbian-buster-lite.zip",
        "target_image_size": 4294967296,
        "iso_checksum_type": "sha256",
        "iso_checksum": "12ae6e17bf95b6ba83beca61e7394e7411b45eba7e6a520f434b0748ea7370e8"
      }
    ],

Here's the output when the partition doesn't get expanded:

==> arm-image: Copying source image.
==> arm-image: Image is a zip file.
==> arm-image: Unzipping 2020-02-13-raspbian-buster-lite.img
    arm-image: Speed:   47.23 MB/s
    arm-image: Progress: 38.30%
    arm-image: Speed:   36.32 MB/s
    arm-image: Progress: 67.76%
    arm-image: mapping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image

vs when the partition growing actually gets invoked:

==> arm-image: Copying source image.
==> arm-image: Image is a zip file.
==> arm-image: Unzipping 2020-02-13-raspbian-buster-lite.img
    arm-image: Speed:   48.89 MB/s
    arm-image: Progress: 39.66%
    arm-image: Speed:   39.17 MB/s
    arm-image: Progress: 71.41%
==> arm-image: Growing partition to 4096 M (4294967296 bytes)
    arm-image: mapping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image

New Release

It has been a while since the last official release. I wonder if you can push a new release soon? In addition, the v0.1.3 version was built against packer1.4.5, it would be nice if the new release is built against packer1.5.5 which is the latest packer release.

Systemd not running --> Builds but fails at Ansible Provisioner

I am trying to build and provision kalipi on a new Pi4 (64-bit). My kalipi.json file associated .yml, hosts, and sources.list file are inserted below.

I am getting the following error (at the ansible provisioner step) after running the sudo packer build kalipi.json command:

kalipi: PLAYBOOK: kalipi.yml ***********************************************************
    kalipi: Positional arguments: /tmp/packer-provisioner-ansible-local/5f80990d-fd11-c94d-f631-db6d07a74beb/kalipi.yml
    kalipi: verbosity: 4
    kalipi: connection: local
    kalipi: timeout: 10
    kalipi: become_method: sudo
    kalipi: tags: ('all',)
    kalipi: inventory: ('/tmp/packer-provisioner-ansible-local/5f80990d-fd11-c94d-f631-db6d07a74beb/Hosts',)
    kalipi: extra_vars: ('packer_build_name=kalipi packer_builder_type=arm-image packer_http_addr=%!s(<nil>) -o IdentitiesOnly=yes', 'ansible_python_interpreter=/usr/bin/python3')
    kalipi: forks: 5
    kalipi: 3 plays in /tmp/packer-provisioner-ansible-local/5f80990d-fd11-c94d-f631-db6d07a74beb/kalipi.yml
    kalipi:
    kalipi: PLAY [Play-#1 for building KaliPi4] ********************************************
    kalipi:
    kalipi: TASK [Gathering Facts] *********************************************************
    kalipi: task path: /tmp/packer-provisioner-ansible-local/5f80990d-fd11-c94d-f631-db6d07a74beb/kalipi.yml:2
    kalipi: <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
    kalipi: <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
    kalipi: <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200 `" && echo ansible-tmp-1602263718.512681-23635-149944798217200="` echo /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200 `" ) && sleep 0'
    kalipi: Using module file /usr/lib/python3/dist-packages/ansible/modules/system/setup.py
    kalipi: <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-23622jewsqgll/tmpnmdnc66q TO /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200/AnsiballZ_setup.py
    kalipi: <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200/ /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200/AnsiballZ_setup.py && sleep 0'
    kalipi: <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200/AnsiballZ_setup.py && sleep 0'
    kalipi: <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1602263718.512681-23635-149944798217200/ > /dev/null 2>&1 && sleep 0'
    kalipi: ok: [pwned1]
    kalipi: META: ran handlers
    kalipi:
    kalipi: TASK [Update Hostname] *********************************************************
    kalipi: task path: /tmp/packer-provisioner-ansible-local/5f80990d-fd11-c94d-f631-db6d07a74beb/kalipi.yml:7
    kalipi: <127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
    kalipi: <127.0.0.1> EXEC /bin/sh -c 'echo ~root && sleep 0'
    kalipi: <127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp `"&& mkdir "` echo /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439 `" && echo ansible-tmp-1602263737.0431828-23783-178020833826439="` echo /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439 `" ) && sleep 0'
    kalipi: Using module file /usr/lib/python3/dist-packages/ansible/modules/system/hostname.py
    kalipi: <127.0.0.1> PUT /root/.ansible/tmp/ansible-local-23622jewsqgll/tmp7rxnydzq TO /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439/AnsiballZ_hostname.py
    kalipi: <127.0.0.1> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439/ /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439/AnsiballZ_hostname.py && sleep 0'
    kalipi: <127.0.0.1> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439/AnsiballZ_hostname.py && sleep 0'
    kalipi: <127.0.0.1> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-tmp-1602263737.0431828-23783-178020833826439/ > /dev/null 2>&1 && sleep 0'
    kalipi: fatal: [pwned1]: FAILED! => {
    kalipi:     "changed": false,
    kalipi:     "invocation": {
    kalipi:         "module_args": {
    kalipi:             "name": "pwned",
    kalipi:             "use": null
    kalipi:         }
    kalipi:     },
    kalipi:     "msg": "Command failed rc=1, out=, err=\u001b[0;1;31mSystem has not been booted with systemd as init system (PID 1). Can't operate.\u001b[0m\n\u001b[0;1;31mFailed to create bus connection: Host is down\u001b[0m\n"
    kalipi: }
    kalipi:
    kalipi: PLAY RECAP *********************************************************************
    kalipi: pwned1                     : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
    kalipi:
==> kalipi: fuser -k /tmp/742371882
Build 'kalipi' errored after 7 minutes 15 seconds: Error executing Ansible: Non-zero exit status: 2

any thoughts on what my issue maybe is of great assistance. Of note, it builds and provisions fine with shell commands, but inclusion of the ansible provisioner causes issue.

kalipi.json----------------

{
    "variables": {},
    "builders": [
        {
            "name": "kalipi",
            "type": "arm-image",
            "iso_url": "https://images.kali.org/arm-images/kali-linux-2020.3a-rpi3-nexmon-64.img.xz",
            "iso_checksum": "56486ff1da0ec5d76b1136863bda079e7d590b9016b5f889b23c443ff4d518de",
            "iso_checksum_type": "sha256",
            "qemu_binary": "qemu-aarch64-static"
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "inline": [
                "echo nameserver 8.8.8.8 > /etc/resolv.conf"
            ]
        },
        {
            "type": "file",
            "source": "sources.list",
            "destination": "/etc/apt/sources.list"
        },
        {
            "type": "shell",
            "inline": [
                "apt-get -y update",
                "apt-get install -y ansible"
            ]
        },
        {
            "type": "ansible-local",
            "playbook_file": "./Ansible/kalipi.yml",
            "inventory_file": "./Ansible/Hosts",
            "extra_arguments": [
                "--extra-vars \"ansible_python_interpreter=/usr/bin/python3\" -vvvv"
            ]
        }
    ]
}

kalipi.yml----

---
-   name: "Play-#1 for building KaliPi4"
    hosts: pwned1
    become: yes

    tasks:
        -   name: "Update Hostname"
            hostname:
                name: "{{ new_hostname }}"

        -   name: "Add hostname to /etc/hosts"
            lineinfile:
                dest: /etc/hosts
                regexp: '^127\.0\.0\.1[ \t]+localhost'
                line: "127.0.0.1 localhost {{ new_hostname }}"
                state: present

        -   name: "Add the group 'pwned' with a specific gid"
            group:
                name: pwned
                state: present
                gid: 2002

        -   name: "Add the user 'pwned' with a specific uid and primary group of 'pwned'"
            user:
                name: pwned
                uid: 2002
                group: pwned
                password: $6$PQHzHnLXqt/S6nR$RvtYap2ZgQKn1bIyppPBVy7Hurpdb44QBFHCw59gPACyLsCVg61A6T665/nWP1OhrHC9yWfMbwgJaXfcG2Y9c0
                generate_ssh_key: yes
                ssh_key_bits: 2048
                ssh_key_file: .ssh/id_rsa
                state: present
                shell: /bin/bash

        -   name: "Add user 'pwned' to sudo"
            lineinfile:
                path: /etc/sudoers.d/pwned
                line: "valant ALL=(ALL) NOPASSWD: ALL"
                mode: 0440
                create: yes
                validate: "visudo -cf %s"

-   name: "Play-#2 for removing default kali profiles"
    hosts: pwned2
    become: yes

    tasks:
        -   name: "Remove default user 'kali'"
            user:
                name: kali
                state: absent
                remove: yes
                force: yes

        -   name: "Remove default group 'kali'"
            group:
                name: kali
                state: absent

-   name: "Play-#3 to update apt and install packages"
    hosts: pwned2
    become: yes
    vars:
        packages:
            apt:
                hold:
                remove:
                    - xfce4
                    - xfce4-places-plugin
                    - xfce-goodies
                    - lightdm

                install:
                    - bettercap
                    - mdk4

    tasks:

        -   name: "Remove preconfigured repository from source list"
            apt_repository:
                repo: deb http://kali.download/kali http://http.kali.org/kali main contrib non-free
                state: absent
                install_python_apt: true

        -   name: "Add kali rolling repository to source list"
            apt_repository:
                repo: deb http://http.kali.org/kali kali-rolling main non-free contrib
                state: present

        -   name: "Update and Upgrade apt package"
            apt:
                update_cache: yes
                upgrade: yes
                force_apt_get: yes
            async: 3600
            poll: 30
            register: apt_sleeper

        -   name: "Install packages"
            apt:
                name: "{{ packages.apt.install }}"
                state: latest
            async: 3600
            poll: 30
            register: apt_sleeper

        -   name: "Remove Kali Desktop package"
            apt:
                name: "{{ packages.apt.remove }}"
                state: absent
                autoclean: yes
                autoremove: yes
                update_cache: yes
                purge: yes
                force_apt_get: yes
            async: 3600
            poll: 30
            register: apt_sleeper

        -   name: "Reboot pi post-configuration"
            reboot:

host (inventory file)-----

[kalipi]
pwned1 ansible_host=127.0.0.1 ansible_user=kali ansible_ssh_pass=kali ansible_become_pass=kali ansible_python_interpreter=/usr/bin/python3 new_hostname=pwned
pwned2 ansible_host=127.0.0.1 ansible_user=pwned ansible_ssh_pass=pwned ansible_become_pass=pwned ansible_python_interpreter=/usr/bin/python3

sources.list file

deb http://http.kali.org/kali kali-rolling main contrib non-free
# For source package access, uncomment the following line
# deb-src http://http.kali.org/kali kali-rolling main contrib non-free

Build 'arm-image' errored: Image download failed.

  "builders": [
    {
      "type": "arm-image",
      "iso_url": "https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-07-12/2019-07-10-raspbian-buster-lite.zip",
      "iso_checksum_type": "sha256",
      "iso_checksum": "9e5cf24ce483bb96e7736ea75ca422e3560e7b455eee63dd28f66fa1825db70e",
      "last_partition_extra_size": 1073741824
    }
  ],

this is my configuration but when I run packer build the download doesn't even start. I don't know what I am missing:

$ sudo -u root HOME=/home/myuser WIFI_NAME= WIFI_PASS= ./build.sh
Debug mode enabled. Builds will not be parallelized.
arm-image output will be in this color.

==> arm-image: Downloading or copying Image
    arm-image: Downloading or copying: https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-07-12/2019-07-10-raspbian-buster-lite.zip
    arm-image: Error downloading: open : no such file or directory
==> arm-image: Image download failed.
Build 'arm-image' errored: Image download failed.

==> Some builds didn't complete successfully and had errors:
--> arm-image: Image download failed.

==> Builds finished but no artifacts were created.
$ packer -v
1.4.2

This is the build.sh

#/bin/sh

if [ -z "$WIFI_NAME" ]
then
      echo "\$WIFI_NAME needs to be set. It is the name of the wifi connection that will be used."
      exit 1
fi

if [ -z "$WIFI_PASS" ]
then
      echo "\$WIFI_PASS needs to be set. It is the password to connect to a wifi network."
      exit 1
fi

packer build \
    -var 'wifi_name=$WIFI_NAME' \
    -var 'wifi_password=$WIFI_PASS' \
    --debug \
    serverino.json

I compiled packer-builder-arm-image cloning the master and I am on ArchLinux. What else I can do? Thanks a lot

fuse non-zero exit code

When I try to build my image using this builder with the command sudo packer build image.json, the build fails with the error message

==> arm-image: fuser -k /tmp/748879671
Build 'arm-image' errored: exit status 1

==> Some builds didn't complete successfully and had errors:
--> arm-image: exit status 1

==> Builds finished but no artifacts were created.

I looked into the exit status of fuser and if no one is accessing the file, the exit code is 1 so I think there might be a logic flaw in here somewhere.

iso_url always downloads file

The iso_url always downloads the file. I was expecting it to be cached the second time I run packer build, like the other builders.

This is my template snippet:

    "builders": [
      {
        "type": "arm-image",
        "iso_url": "http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-09-30/2019-09-26-raspbian-buster-lite.zip",
        "iso_checksum_type": "sha256",
        "iso_checksum": "a50237c2f718bd8d806b96df5b9d2174ce8b789eda1f03434ed2213bbca6c6ff"
      }
    ],

[Question]: is armv6 hardfp supported?

Hi,

I'm trying to build some raspberry pi images that are dependent on hardfp which fails if using this builder with it's default parameters.

Is there any configuration option that allows to more closely emulate a raspberry pi0 CPU?

Thanks in advance

arm-image: read |0: file already closed

Occasionally arm image builds fail nondeterministically with this error message:

==> default: Running provisioner: build (shell)...
    default: Running: /var/folders/kd/0qsg7379351cw6j40x_pg_740000gn/T/vagrant-shell20200403-83669-1292gar.sh
    default: '/vagrant/packer-builder-arm-image' -> '/home/vagrant/.packer.d/plugins/packer-builder-arm-image'
    default: Attempting to build image
    default: Debug mode enabled. Builds will not be parallelized.
    default: arm-image: output will be in this color.
    default: ==> arm-image: Retrieving Image
    default: ==> arm-image: Trying http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz
    default: ==> arm-image: Trying http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz?checksum=sha256%3Af270d4a11fcef7f85ea77bc0642d1c6db2666ae734e9dcc4cb875a31c9f0dc57
    default: ==> arm-image: http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz?checksum=sha256%3Af270d4a11fcef7f85ea77bc0642d1c6db2666ae734e9dcc4cb875a31c9f0dc57 => /vagrant/packer_cache/4cc54ff9b15315c3bf2ae2264e8b6d072d8b8e5b.iso
    default: ==> arm-image: Copying source image.
    default: ==> arm-image: Image is a xz file.
    default:     arm-image: Speed:   52.96 MB/s
    default:     arm-image: Speed:   43.34 MB/s
    default:     arm-image: Speed:   43.42 MB/s
    default: ==> arm-image: read |0: file already closed
    default: Build 'arm-image' errored: step canceled or halted
    default: ==> Some builds didn't complete successfully and had errors:
    default: --> arm-image: step canceled or halted
    default: ==> Builds finished but no artifacts were created.
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

I just need to re-run the build one or more times until it works. I'm not sure where to begin troubleshooting. Any ideas?

chmod: not found with example.json

Environment:
I am running master branch, though I am experiencing this with older versions. I am running arch linux.

Observed
When I do sudo packer build ./example.json with the example packer file, I get the following output.

arm-image output will be in this color.

==> arm-image: Downloading or copying Image
    arm-image: Found already downloaded, initial checksum matched, no download needed: https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-12-01/2017-11-29-raspbian-stretch-lite.zip
==> arm-image: Copying source image.
==> arm-image: Image is a zip file.
==> arm-image: Unzipping 2017-11-29-raspbian-stretch-lite.img
==> arm-image: Resizing the last partition 1073741824.
    arm-image: mappping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image
==> arm-image: partitions: [/dev/mapper/loop0p1 /dev/mapper/loop0p2]
==> arm-image: partitions: [/dev/mapper/loop0p1 /dev/mapper/loop0p2]
    arm-image: Mounting: /dev/mapper/loop0p2
    arm-image: Mounting: /dev/mapper/loop0p1
==> arm-image: Mounting additional paths within the chroot...
    arm-image: Mounting: /proc
    arm-image: Mounting: /sys
    arm-image: Mounting: /dev
    arm-image: Mounting: /dev/pts
    arm-image: Mounting: /proc/sys/fs/binfmt_misc
==> arm-image: Installing qemu-user-static in the chroot
==> arm-image: Provisioning with shell script: /tmp/packer-shell528078340
    arm-image: /bin/sh: 1: chmod: not found
    arm-image: /bin/sh: 1: /tmp/script_4790.sh: Permission denied
Build 'arm-image' errored: Script exited with non-zero exit status: 126

Hunch:
I assume that this has something to do with me running arch linux, and the chroot not getting set up correctly. Not sure, though I am digging through the source seeing if I can find why this is happening.

YML file for the provisioners

I think JSON format is a little bit ugly to my eyes (maybe for you too). Can we have a YML support? If you can onboard me with the code stacks, I'll be happy to help.

Is it possible to use this plugin without sudo

I was looking into whether it would be possible to use this plugin without sudo packer build. My biggest problem with the current approach is that the output files and packer_cache directories end up being owned by root.

I was looking into whether it would be possible to prefix commands within the plugin with sudo so that sudo was used only when necessary but this doesn't work for os.OpenFile in pkg/builder/step_register_bin_fmt.go. Maybe there is a better way though?

Docker for Mac Edge release 2.3.2.0 re-adds device-mapper, update README when released

In this comment on docker/for-mac#4549 mac issue related to device-mapper not being available, I noticed that the Edge build 2.3.2.0 of Docker for Mac contains the dependencies necessary to run the docker workflow on Mac again! ๐Ÿ™Œ

I have installed the Docker for Mac beta and confirmed that I am able to build successfully again and produce images. There are intermittent failures on the kpartx command related to device-mapper, but I have only needed to restart the build at most two times for it to work, and the majority of the time I am able to build images without error.

When these changes make it into the stable release channel, I plan to open a PR to correct the README changes I made a few months back regarding the device-mapper dependency.

For reference, here is my Makefile that I'm using in my project workspace, which doesn't require cloning this repo at all either:

clean:
	rm -f output-arm-image/image

docker:
	docker pull docker.pkg.github.com/solo-io/packer-builder-arm-image/packer-builder-arm

img-base: docker clean
	docker run \
		--rm \
		--privileged \
		-v ${PWD}:/build:ro \
		-v ${PWD}/packer_cache:/build/packer_cache \
		-v ${PWD}/output-arm-image:/build/output-arm-image \
		-e PACKER_CACHE_DIR=/build/packer_cache \
	docker.pkg.github.com/solo-io/packer-builder-arm-image/packer-builder-arm build packer/base.json
	mv output-arm-image/image output-arm-image/base.img

img-sdr: docker clean
	docker run \
		--rm \
		--privileged \
		-v ${PWD}:/build:ro \
		-v ${PWD}/packer_cache:/build/packer_cache \
		-v ${PWD}/output-arm-image:/build/output-arm-image \
		-e PACKER_CACHE_DIR=/build/packer_cache \
	docker.pkg.github.com/solo-io/packer-builder-arm-image/packer-builder-arm build packer/rtl-sdr.json
	mv output-arm-image/image output-arm-image/sdr.img

I have a few other images that I build on top of the base, but implementing it this way has allowed me to save a lot of time not having to configure the locale or updating all of the apt dependencies before each unique build image. Similar to docker's layers during build, this saves me a lot of time when the application-specific images fail due to the kpartx or loop errors.

Cannot pull docker image

When attempting to pull the latest docker image I get an authentication error.

~$ docker pull docker.pkg.github.com/solo-io/packer-builder-arm-image/packer-builder-arm:latest
Error response from daemon: unauthorized: Your request could not be authenticated by the GitHub Packages service. Please ensure your access token is valid and has the appropriate scopes configured.

Contribute upstream?

I think this is a very useful builder for packer, and I think that contributing it upstream would allow more people to find and use it.

Trying to build alpine

Hi

I'm trying to build an image based on alpine but it complains about partition issues:

vagrant@ubuntu-xenial:/vagrant$ ./provision-build-image.sh
+ set -e
+ export PACKERFILE=example.json
+ PACKERFILE=example.json
+ mkdir -p /home/vagrant/.packer.d/plugins
+ cp /vagrant/packer-builder-arm-image /home/vagrant/.packer.d/plugins/
+ [[ ! -f /home/vagrant/.packer.d/plugins/packer-builder-arm-image ]]
+ echo 'Attempting to build image'
Attempting to build image
++ mktemp
+ PACKER_LOG=/tmp/tmp.PVVUzssbLo
+ [[ -f /vagrant/example.json ]]
+ sudo packer build /vagrant/example.json
+ tee /tmp/tmp.PVVUzssbLo
arm-image output will be in this color.

==> arm-image: Downloading or copying Image
    arm-image: Downloading or copying: file://alpine-rpi-3.9.4-aarch64.tar.gz
==> arm-image: Copying source image.
    arm-image: mappping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image
==> arm-image: partitions: []
==> arm-image: error different of partitions than expected 0
Build 'arm-image' errored: step canceled or halted

==> Some builds didn't complete successfully and had errors:
--> arm-image: step canceled or halted

==> Builds finished but no artifacts were created.
++ grep -Po '(?<=Build '\'').*(?='\'' finished.)' /tmp/tmp.PVVUzssbLo
+ BUILD_NAME=

My packer json looks like this (the tar.gz is available here):

{
  "builders": [
    {
      "type": "arm-image",
      "iso_url": "file://alpine-rpi-3.9.4-aarch64.tar.gz",
      "iso_checksum_type": "sha256",
      "iso_checksum": "76af2ee59f5865dedd2c940402d3590937236f29ef1aaf52d9f4d11df8afc79a",
      "image_type": "raspberrypi",
      "image_mounts": ["/boot", "/"]
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "cat /etc/os-release"
      ]
    }
  ]
}

Incompatible API version with plugin

I tried running packer build samples/raspian_golang.json after installing the packer-builder-arm-image. I am getting the following error Failed to initialize build 'arm-image': error initializing builder 'arm-image': Incompatible API version with plugin. Plugin version: 5, Ours: 4. Any assistance on troubleshooting this problem is appreciated. Thanks.

error when using .zip download url

packer version: v1.4.5
arm-image version: v0.1.3
go version go1.13.4 linux/amd64

json config:
{ "builders": [ { "type": "arm-image", "iso_url": "http://releases.libreelec.tv/LibreELEC-RPi2.arm-9.2.0.img.gz", "iso_checksum_type": "sha256", "iso_checksum": "f9600ac23b8e0f99b8c9069c5136930c3802e3ad351a1f415da3dcf9ae542c0f", "mount_path": "/mnt/libreelec", "qemu_binary": "qemu-arm-static" } ], "provisioners": [] }

`packer build packer-libreelec-usbmedia.json
arm-image output will be in this color.

1 error(s) occurred:

  • no image mounts provided. Please set the image mounts or image type.`

Default /etc/resolv.conf mount incompatible with systemd

Related to #22, when using a systemd-based image like Ubuntu 18.04.4 LTS, the default mount of /etc/resolv.conf fails:

==> arm-image: Retrieving Image
==> arm-image: Trying http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz
==> arm-image: Trying http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz?checksum=sha256%3Af270d4a11fcef7f85ea77bc0642d1c6db2666ae734e9dcc4cb875a31c9f0dc57
==> arm-image: http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz?checksum=sha256%3Af270d4a11fcef7f85ea77bc0642d1c6db2666ae734e9dcc4cb875a31c9f0dc57 => /vagrant/packer_cache/4cc54ff9b15315c3bf2ae2264e8b6d072d8b8e5b.iso
==> arm-image: Copying source image.
==> arm-image: Image is a xz file.
    arm-image: Speed:   57.65 MB/s
    arm-image: Speed:   48.52 MB/s
    arm-image: mapping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image
==> arm-image: partitions: [/dev/mapper/loop0p1 /dev/mapper/loop0p2]
    arm-image: Mounting: /dev/mapper/loop0p2
    arm-image: Mounting: /dev/mapper/loop0p1
==> arm-image: Mounting additional paths within the chroot...
    arm-image: Mounting: /proc
    arm-image: Mounting: /sys
    arm-image: Mounting: /dev
    arm-image: Mounting: /dev/pts
    arm-image: Mounting: /proc/sys/fs/binfmt_misc
==> arm-image: Error creating mount directory: mkdir /tmp/517734997/etc/resolv.conf: file exists
==> arm-image: fuser -k /tmp/517734997
Build 'arm-image' errored: Error creating mount directory: mkdir /tmp/517734997/etc/resolv.conf: file exists

==> Some builds didn't complete successfully and had errors:
--> arm-image: Error creating mount directory: mkdir /tmp/517734997/etc/resolv.conf: file exists

==> Builds finished but no artifacts were created.

/etc does exist and so does /etc/resolv.conf; however it's a symbolic link to ../run/systemd/resolve/stub-resolv.conf which does not exist without starting up systemd.

To work around this issue I had to specify chroot_mounts in the packer config file to un-include the /etc/resolv.conf bind, then add additional_chroot_mounts to bind /run/systemd from the host.

{
  "variables": {
  },
  "builders": [{
    "type": "arm-image",
    "qemu_binary": "qemu-aarch64-static",
    "image_type": "raspberrypi",
    "chroot_mounts": [
      ["proc", "proc", "/proc"],
      ["sysfs", "sysfs", "/sys"],
      ["bind", "/dev", "/dev"],
      ["devpts", "devpts", "/dev/pts"],
      ["binfmt_misc", "binfmt_misc", "/proc/sys/fs/binfmt_misc"]
    ],
    "additional_chroot_mounts": [
      ["bind", "/run/systemd", "/run/systemd"]
    ],
    "iso_url": "http://cdimage.ubuntu.com/releases/18.04.4/release/ubuntu-18.04.4-preinstalled-server-arm64+raspi3.img.xz",
    "iso_checksum_type": "sha256",
    "iso_checksum": "f270d4a11fcef7f85ea77bc0642d1c6db2666ae734e9dcc4cb875a31c9f0dc57"
  }],
  "provisioners": [{
    "type": "shell",
    "inline": [
      "apt-get update",
    ]
  }]
}

I think it would be helpful to check for systemd in order to default to the /run/systemd chroot mount. If that directory doesn't exist, then I think it's safe to say we're using a sysvinit system and can use the existing /etc/resolv.conf bind. Of course, this will only work so long as the host VM in vagrant or docker is a systemd host.

License?

I'd like to package packer-builder-arm-image for the Arch User Repository, but it's missing a license, which prevents me from distributing it. Github has a help page here with some good advice about choosing a license. Thanks!

arm-image out of space

I have been able to successfully build images around raspbian-buster-lite and write them to sdcards. That said, I have reached a limit just shy of what I want to add to my arm-image. I have tried adding a gig to the target_image_size param in the example.json builders block, but it does not appear to have the effect I was expecting. is there something else I should be doing to give myself a little extra space to provision a few extra resources? I shouldn't need more an 200MB more (vim and git, plus plugins and miscellany) than I'm already able to build into my current images.

loopback issue - within priviliged docker container

I'm running packer within priviliged (with --priviliged flag) docker container, which works well for all builders, except for this one:
Getting:

`==> arm-image: https://downloads.raspberrypi.org/raspbian_lite_latest?checksum=sha256%3Aa50237c2f718bd8d806b96df5b9d2174ce8b789eda1f03434ed2213bbca6c6ff => /iso_cache/c16bcbd2827ae3db61afd0321a459237ebebbd75.iso
==> arm-image: Copying source image.
==> arm-image: Image is a zip file.
==> arm-image: Unzipping 2019-09-26-raspbian-buster-lite.img
arm-image: mappping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image
==> arm-image: error kaprts -l exit status 1: mount: could not find any device /dev/loop#Bad address
==> arm-image: can't set up loop
==> arm-image:

Build 'arm-image' errored: step canceled or halted

==> Some builds didn't complete successfully and had errors:
--> arm-image: step canceled or halted
`

Trouble building ubuntu core images. Error creating mount directory: mkdir /tmp/.../etc/resolv.conf file exists

Trying to build 64 bit ubuntu core image and getting the following error.

==> arm-image: Growing partition with 1024 M (1073741824 bytes)
    arm-image: mapping output-arm-image/image
==> arm-image: kpartx -s -a -v output-arm-image/image
==> arm-image: partitions: [/dev/mapper/loop1p1 /dev/mapper/loop1p2]
==> arm-image: partitions: [/dev/mapper/loop1p1 /dev/mapper/loop1p2]
    arm-image: Mounting: /dev/mapper/loop1p2
    arm-image: Mounting: /dev/mapper/loop1p1
==> arm-image: Mounting additional paths within the chroot...
    arm-image: Mounting: /proc
    arm-image: Mounting: /sys
    arm-image: Mounting: /dev
    arm-image: Mounting: /dev/pts
    arm-image: Mounting: /proc/sys/fs/binfmt_misc
==> arm-image: Error creating mount directory: mkdir /tmp/108605975/etc/resolv.conf: file exists
==> arm-image: fuser -k /tmp/108605975
Build 'arm-image' errored: Error creating mount directory: mkdir /tmp/108605975/etc/resolv.conf: file exists

==> Some builds didn't complete successfully and had errors:
--> arm-image: Error creating mount directory: mkdir /tmp/108605975/etc/resolv.conf: file exists

==> Builds finished but no artifacts were created.

the json file:

{
  "variables": {
    "home": "{{env `HOME`}}"
  },
  "builders": [{
    "type": "arm-image",
    "image_type": "raspberrypi",
    "qemu_binary": "qemu-aarch64-static",
    "iso_url" : "http://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz",
    "iso_checksum_type":"sha256",
    "iso_checksum":"48167067d65c5192ffe041c9cc4958cb7fcdfd74fa15e1937a47430ed7b9de99",
    "last_partition_extra_size" : 1073741824
  }],
  "provisioners": [
    {
      "type": "shell",
      "inline": ["touch /boot/ssh"]
    },
    {
      "type": "file",
      "source": "/.ssh/id_rsa.pub",
      "destination": "/home/pi/.ssh/authorized_keys"
    },
    {
      "type": "shell",
      "inline": [
        "sed '/PasswordAuthentication/d' -i /etc/ssh/ssh_config",
        "echo  >> /etc/ssh/ssh_config",
        "echo 'PasswordAuthentication no' >> /etc/ssh/ssh_config"
      ]
    },
    {
      "type": "shell",
      "inline": [
	      "apt-get update",
	      "apt-get install -y zfs-dkms, atop",
	      "curl -SL https://github.com/prometheus/node_exporter/releases/download/v0.18.1/node_exporter-0.18.1.linux-armv7.tar.gz > node_exporter.tar.gz",
	      "sudo tar -xvf node_exporter.tar.gz -C /usr/local/bin/ --strip-components=1",
	      "cd /etc/systemd/system/",
              "curl -sSLo - https://raw.githubusercontent.com/prometheus/node_exporter/master/examples/systemd/node_exporter.service |sed -e 's|/etc/sysconfig/node_exporter|/etc/default/node_exporter|' |sed -e 's/^User.*//'  > node_exporter.service",
               "curl -sSLo - https://raw.githubusercontent.com/prometheus/node_exporter/master/examples/systemd/sysconfig.node_exporter  |sed -e 's/^OPTIONS/#OPTIONS/;aOPTIONS=\"\"' >/etc/default/node_exporter",
               "systemctl daemon-reload",
               "systemctl enable node_exporter.service",
               "systemctl start node_exporter.service"
      ]
    }
  ]
}```

Is it possible to pass the name for the output image?

Thank you for this amazing project! It works out-of-the-box on OS X. I'm using the docker image. Just awesome ๐Ÿ‘ ๐ŸŽ‰

So as already mentioned in the title I'm searching for a way to define the resulting image name as I would have it differently depending on the variables I'm using. I have checked the builder.go but it only references the output-directory of the image and I could'nt find anything related in the packer documentation.

Does somebody has some hints for me?
(My current alternative is renaming it automatically after the build.)

ubuntu/eoan64 no longer available

The Vagrantfile uses ubuntu/eoan64, which for some reason has been removed from https://app.vagrantup.com/ubuntu. This causes the documentation recommended vagrant up to fail.

Additionally, there appears to be a problem with the official ubuntu images for eoan64 and focal64 that prevents vagrant from successfully creating these boxes within the configured time limit. You can read more about it at https://bugs.launchpad.net/cloud-images/+bug/1874453. I

While neither of these are problems with this project, the documentation as is is incorrect. If nothing else, hopefully this issue will get picked up by the search index bots and it will be easier for the next person to find the solution. ๐Ÿ˜„

As such, the Vagrantfile can be update to the following:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # for missing eoan64 box
  config.vm.box = "ubuntu/focal64"
  # https://bugs.launchpad.net/cloud-images/+bug/1874453
  config.vm.provider "virtualbox" do |vb|
    vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
    vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-focal-20.04-cloudimg-console.log") ]
  end
  config.vm.synced_folder "./", "/vagrant", disabled: false
  config.vm.provision "build-env", type: "shell", :path => "provision-build-env.sh", privileged: false
  config.vm.provision "packer-builder-arm-image", type: "shell", :path => "provision-packer-builder-arm-image.sh", privileged: false, env: {"GIT_CLONE_URL" => ENV["GIT_CLONE_URL"]}
  config.vm.provision "build-image", type: "shell", :path => "provision-build-image.sh", privileged: false, env: {"PACKERFILE" => ENV["PACKERFILE"]}
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.