hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
15.09k stars 3.33k forks source link

Error installing chef-solo #1975

Closed bridiver closed 9 years ago

bridiver commented 9 years ago

This also failed with the standard install command and on centos7

{
  "builders": [
    {
      "type": "docker",
      "image": "centos:centos6",
      "commit": true
    }
  ],

  "provisioners": [
    {
      "type": "chef-solo",
      "cookbook_paths": ["../../../chef/cookbooks"],
      "run_list": ["recipe[apache_hadoop::hbase_client]"],
      "install_command": "curl -L https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 11.16.0"
    }
  ]
}
PACKER_LOG=1 packer build test.json
2015/03/11 15:55:04 [INFO] Packer version: 0.7.5  9cd66feeacbd9cb318b72eb5ed59428c5b8c37ac+CHANGES
2015/03/11 15:55:04 Packer Target OS/Arch: darwin amd64
2015/03/11 15:55:04 Built with Go Version: go1.3.3
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: amazon-chroot = /usr/local/bin/packer-builder-amazon-chroot
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: amazon-ebs = /usr/local/bin/packer-builder-amazon-ebs
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: amazon-instance = /usr/local/bin/packer-builder-amazon-instance
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: digitalocean = /usr/local/bin/packer-builder-digitalocean
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: docker = /usr/local/bin/packer-builder-docker
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: googlecompute = /usr/local/bin/packer-builder-googlecompute
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: null = /usr/local/bin/packer-builder-null
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: openstack = /usr/local/bin/packer-builder-openstack
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: parallels-iso = /usr/local/bin/packer-builder-parallels-iso
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: parallels-pvm = /usr/local/bin/packer-builder-parallels-pvm
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: qemu = /usr/local/bin/packer-builder-qemu
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: virtualbox-iso = /usr/local/bin/packer-builder-virtualbox-iso
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: virtualbox-ovf = /usr/local/bin/packer-builder-virtualbox-ovf
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: vmware-iso = /usr/local/bin/packer-builder-vmware-iso
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: vmware-vmx = /usr/local/bin/packer-builder-vmware-vmx
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: atlas = /usr/local/bin/packer-post-processor-atlas
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: compress = /usr/local/bin/packer-post-processor-compress
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: docker-import = /usr/local/bin/packer-post-processor-docker-import
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: docker-push = /usr/local/bin/packer-post-processor-docker-push
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: docker-save = /usr/local/bin/packer-post-processor-docker-save
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: docker-tag = /usr/local/bin/packer-post-processor-docker-tag
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: vagrant = /usr/local/bin/packer-post-processor-vagrant
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: vagrant-cloud = /usr/local/bin/packer-post-processor-vagrant-cloud
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: vsphere = /usr/local/bin/packer-post-processor-vsphere
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: ansible-local = /usr/local/bin/packer-provisioner-ansible-local
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: chef-client = /usr/local/bin/packer-provisioner-chef-client
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: chef-solo = /usr/local/bin/packer-provisioner-chef-solo
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: file = /usr/local/bin/packer-provisioner-file
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: puppet-masterless = /usr/local/bin/packer-provisioner-puppet-masterless
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: puppet-server = /usr/local/bin/packer-provisioner-puppet-server
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: salt-masterless = /usr/local/bin/packer-provisioner-salt-masterless
2015/03/11 15:55:04 [DEBUG] Discoverd plugin: shell = /usr/local/bin/packer-provisioner-shell
2015/03/11 15:55:04 Detected home directory from env var: /Users/bjohnson
2015/03/11 15:55:04 Detected home directory from env var: /Users/bjohnson
2015/03/11 15:55:04 Attempting to open config file: /Users/bjohnson/.packerconfig
2015/03/11 15:55:04 File doesn't exist, but doesn't need to. Ignoring.
2015/03/11 15:55:04 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[digitalocean:/usr/local/bin/packer-builder-digitalocean googlecompute:/usr/local/bin/packer-builder-googlecompute openstack:/usr/local/bin/packer-builder-openstack virtualbox-iso:/usr/local/bin/packer-builder-virtualbox-iso vmware-vmx:/usr/local/bin/packer-builder-vmware-vmx amazon-chroot:/usr/local/bin/packer-builder-amazon-chroot amazon-ebs:/usr/local/bin/packer-builder-amazon-ebs amazon-instance:/usr/local/bin/packer-builder-amazon-instance vmware-iso:/usr/local/bin/packer-builder-vmware-iso virtualbox-ovf:/usr/local/bin/packer-builder-virtualbox-ovf null:/usr/local/bin/packer-builder-null parallels-iso:/usr/local/bin/packer-builder-parallels-iso qemu:/usr/local/bin/packer-builder-qemu docker:/usr/local/bin/packer-builder-docker parallels-pvm:/usr/local/bin/packer-builder-parallels-pvm] PostProcessors:map[docker-tag:/usr/local/bin/packer-post-processor-docker-tag vagrant:/usr/local/bin/packer-post-processor-vagrant vagrant-cloud:/usr/local/bin/packer-post-processor-vagrant-cloud atlas:/usr/local/bin/packer-post-processor-atlas compress:/usr/local/bin/packer-post-processor-compress docker-import:/usr/local/bin/packer-post-processor-docker-import docker-push:/usr/local/bin/packer-post-processor-docker-push docker-save:/usr/local/bin/packer-post-processor-docker-save vsphere:/usr/local/bin/packer-post-processor-vsphere] Provisioners:map[shell:/usr/local/bin/packer-provisioner-shell ansible-local:/usr/local/bin/packer-provisioner-ansible-local chef-client:/usr/local/bin/packer-provisioner-chef-client chef-solo:/usr/local/bin/packer-provisioner-chef-solo file:/usr/local/bin/packer-provisioner-file puppet-masterless:/usr/local/bin/packer-provisioner-puppet-masterless puppet-server:/usr/local/bin/packer-provisioner-puppet-server salt-masterless:/usr/local/bin/packer-provisioner-salt-masterless]}
2015/03/11 15:55:04 Setting cache directory: /Users/bjohnson/Documents/workspace/korrelate/O2O/vms/packer/packer_cache
2015/03/11 15:55:04 Detected home directory from env var: /Users/bjohnson
2015/03/11 15:55:04 Reading template: test.json
2015/03/11 15:55:04 Creating build: docker
2015/03/11 15:55:04 Loading builder: docker
2015/03/11 15:55:04 Creating plugin client for path: /usr/local/bin/packer-builder-docker
2015/03/11 15:55:04 Starting plugin: /usr/local/bin/packer-builder-docker []string{"/usr/local/bin/packer-builder-docker"}
2015/03/11 15:55:04 Waiting for RPC address for: /usr/local/bin/packer-builder-docker
2015/03/11 15:55:04 packer-builder-docker: 2015/03/11 15:55:04 Plugin minimum port: 10000
2015/03/11 15:55:04 packer-builder-docker: 2015/03/11 15:55:04 Plugin maximum port: 25000
2015/03/11 15:55:04 packer-builder-docker: 2015/03/11 15:55:04 Plugin address: unix /var/folders/2b/0vvvwt6x20q44snl4z84b_7h0000gn/T/packer-plugin971369645
2015/03/11 15:55:04 packer-builder-docker: 2015/03/11 15:55:04 Waiting for connection...
2015/03/11 15:55:04 packer-builder-docker: 2015/03/11 15:55:04 Serving a plugin connection...
2015/03/11 15:55:04 Loading provisioner: chef-solo
2015/03/11 15:55:04 Creating plugin client for path: /usr/local/bin/packer-provisioner-chef-solo
2015/03/11 15:55:04 Starting plugin: /usr/local/bin/packer-provisioner-chef-solo []string{"/usr/local/bin/packer-provisioner-chef-solo"}
2015/03/11 15:55:04 Waiting for RPC address for: /usr/local/bin/packer-provisioner-chef-solo
2015/03/11 15:55:04 packer-provisioner-chef-solo: 2015/03/11 15:55:04 Plugin minimum port: 10000
2015/03/11 15:55:04 packer-provisioner-chef-solo: 2015/03/11 15:55:04 Plugin maximum port: 25000
2015/03/11 15:55:04 packer-provisioner-chef-solo: 2015/03/11 15:55:04 Plugin address: unix /var/folders/2b/0vvvwt6x20q44snl4z84b_7h0000gn/T/packer-plugin794093522
2015/03/11 15:55:04 packer-provisioner-chef-solo: 2015/03/11 15:55:04 Waiting for connection...
2015/03/11 15:55:04 packer-provisioner-chef-solo: 2015/03/11 15:55:04 Serving a plugin connection...
2015/03/11 15:55:04 ui: docker output will be in this color.
2015/03/11 15:55:04 ui: 
2015/03/11 15:55:04 Build debug mode: false
2015/03/11 15:55:04 Force build: false
2015/03/11 15:55:04 Preparing build: docker
docker output will be in this color.

2015/03/11 15:55:04 Waiting on builds to complete...
2015/03/11 15:55:04 Starting build run: docker
2015/03/11 15:55:04 Running builder: docker
2015/03/11 15:55:04 ui: ==> docker: Creating a temporary directory for sharing data...
==> docker: Creating a temporary directory for sharing data...
2015/03/11 15:55:04 ui: ==> docker: Pulling Docker image: centos:centos6
==> docker: Pulling Docker image: centos:centos6
2015/03/11 15:55:04 packer-builder-docker: 2015/03/11 15:55:04 Executing: /usr/local/bin/docker [pull centos:centos6]
    docker: 511136ea3c5a: Pulling fs layer
2015/03/11 15:55:05 ui:     docker: 511136ea3c5a: Pulling fs layer
2015/03/11 15:55:05 ui:     docker: 5b12ef8fd570: Pulling fs layer
    docker: 5b12ef8fd570: Pulling fs layer
2015/03/11 15:55:05 ui:     docker: f6808a3e4d9e: Pulling fs layer
    docker: f6808a3e4d9e: Pulling fs layer
2015/03/11 15:55:06 ui:     docker: 5b12ef8fd570: Verifying Checksum
2015/03/11 15:55:06 ui:     docker: 5b12ef8fd570: Download complete
    docker: 5b12ef8fd570: Verifying Checksum
    docker: 5b12ef8fd570: Download complete
2015/03/11 15:55:06 ui:     docker: 511136ea3c5a: Verifying Checksum
    docker: 511136ea3c5a: Verifying Checksum
2015/03/11 15:55:06 ui:     docker: 511136ea3c5a: Download complete
    docker: 511136ea3c5a: Download complete
2015/03/11 15:55:06 ui:     docker: 511136ea3c5a: Pull complete
    docker: 511136ea3c5a: Pull complete
2015/03/11 15:55:06 ui:     docker: 5b12ef8fd570: Pull complete
    docker: 5b12ef8fd570: Pull complete
    docker: f6808a3e4d9e: Verifying Checksum
2015/03/11 15:56:24 ui:     docker: f6808a3e4d9e: Verifying Checksum
2015/03/11 15:56:24 ui:     docker: f6808a3e4d9e: Download complete
    docker: f6808a3e4d9e: Download complete
2015/03/11 15:56:25 ui:     docker: f6808a3e4d9e: Pull complete
    docker: f6808a3e4d9e: Pull complete
2015/03/11 15:56:25 ui:     docker: centos:centos6: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
    docker: centos:centos6: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.
2015/03/11 15:56:25 ui:     docker: Status: Downloaded newer image for centos:centos6
    docker: Status: Downloaded newer image for centos:centos6
2015/03/11 15:56:25 ui: ==> docker: Starting docker container...
==> docker: Starting docker container...
2015/03/11 15:56:25 ui:     docker: Run command: docker run -v /var/folders/2b/0vvvwt6x20q44snl4z84b_7h0000gn/T/packer-docker777432104:/packer-files -d -i -t centos:centos6 /bin/bash
2015/03/11 15:56:25 packer-builder-docker: 2015/03/11 15:56:25 Starting container with args: [run -v /var/folders/2b/0vvvwt6x20q44snl4z84b_7h0000gn/T/packer-docker777432104:/packer-files -d -i -t centos:centos6 /bin/bash]
    docker: Run command: docker run -v /var/folders/2b/0vvvwt6x20q44snl4z84b_7h0000gn/T/packer-docker777432104:/packer-files -d -i -t centos:centos6 /bin/bash
2015/03/11 15:56:25 packer-builder-docker: 2015/03/11 15:56:25 Waiting for container to finish starting
2015/03/11 15:56:26 ui:     docker: Container ID: f6e0fbebea7cb4843961a4a9300254502a57ab3299da16f831ec027f469addfe
2015/03/11 15:56:26 packer-builder-docker: 2015/03/11 15:56:26 Running the provision hook
    docker: Container ID: f6e0fbebea7cb4843961a4a9300254502a57ab3299da16f831ec027f469addfe
2015/03/11 15:56:26 ui: ==> docker: Provisioning with chef-solo
==> docker: Provisioning with chef-solo
2015/03/11 15:56:26 ui:     docker: Installing Chef...
    docker: Installing Chef...
2015/03/11 15:56:26 packer-builder-docker: 2015/03/11 15:56:26 Executing in container f6e0fbebea7cb4843961a4a9300254502a57ab3299da16f831ec027f469addfe: "(curl -L https://www.opscode.com/chef/install.sh | sudo bash -s -- -v 11.16.0) >/packer-files/cmd015366503 2>&1; echo $? >/packer-files/cmd015366503-exit"
2015/03/11 15:56:28 packer-builder-docker: 2015/03/11 15:56:28 [INFO] RPC endpoint: Communicator ended with: 1
2015/03/11 15:56:28 [INFO] 0 bytes written for 'stderr'
2015/03/11 15:56:28 [INFO] 0 bytes written for 'stdout'
2015/03/11 15:56:28 [INFO] RPC client: Communicator ended with: 1
2015/03/11 15:56:28 [INFO] RPC endpoint: Communicator ended with: 1
2015/03/11 15:56:28 packer-provisioner-chef-solo: 2015/03/11 15:56:28 [INFO] 0 bytes written for 'stderr'
2015/03/11 15:56:28 packer-provisioner-chef-solo: 2015/03/11 15:56:28 [INFO] 0 bytes written for 'stdout'
2015/03/11 15:56:28 packer-provisioner-chef-solo: 2015/03/11 15:56:28 [INFO] RPC client: Communicator ended with: 1
2015/03/11 15:56:28 ui: ==> docker: Killing the container: f6e0fbebea7cb4843961a4a9300254502a57ab3299da16f831ec027f469addfe
==> docker: Killing the container: f6e0fbebea7cb4843961a4a9300254502a57ab3299da16f831ec027f469addfe
2015/03/11 15:56:28 ui error: Build 'docker' errored: Error installing Chef: Install script exited with non-zero exit status 1
2015/03/11 15:56:28 Builds completed. Waiting on interrupt barrier...
2015/03/11 15:56:28 machine readable: error-count []string{"1"}
2015/03/11 15:56:28 ui error: 
==> Some builds didn't complete successfully and had errors:
2015/03/11 15:56:28 machine readable: docker,error []string{"Error installing Chef: Install script exited with non-zero exit status 1"}
2015/03/11 15:56:28 ui error: --> docker: Error installing Chef: Install script exited with non-zero exit status 1
2015/03/11 15:56:28 ui: 
==> Builds finished but no artifacts were created.
2015/03/11 15:56:28 waiting for all plugin processes to complete...
Build 'docker' errored: Error installing Chef: Install script exited with non-zero exit status 1

==> Some builds didn't complete successfully and had errors:
--> docker: Error installing Chef: Install script exited with non-zero exit status 1

==> Builds finished but no artifacts were created.
2015/03/11 15:56:28 /usr/local/bin/packer-provisioner-chef-solo: plugin process exited
2015/03/11 15:56:28 /usr/local/bin/packer-builder-docker: plugin process exited
bridiver commented 9 years ago

also on ubuntu

johnbyrneio commented 9 years ago

+1. I've tried this on centos:centos6, centos:centos7, and ubuntu:latest. Same result on all. Packer Version 0.7.5 docker-machine version 0.1.0 using Virtualbox driver Host is running OSX 10.9.5

$ docker version Client version: 1.5.0 Client API version: 1.17 Go version (client): go1.4.1 Git commit (client): a8a31ef OS/Arch (client): darwin/amd64 Server version: 1.5.0 Server API version: 1.17 Go version (server): go1.4.1 Git commit (server): a8a31ef

sethvargo commented 9 years ago

What happens if you run that script manually or in debug mode? It looks to be an issue with Chef's installer, although I don't see an error coming back from it.

johnbyrneio commented 9 years ago

Here's the latest output:

laptop99:Desktop user99$ packer build -debug ~/Desktop/packer_docker.json
2015/03/17 11:40:17 [INFO] Packer version: 0.7.5  9cd66feeacbd9cb318b72eb5ed59428c5b8c37ac+CHANGES
2015/03/17 11:40:17 Packer Target OS/Arch: darwin amd64
2015/03/17 11:40:17 Built with Go Version: go1.3.3
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: amazon-chroot = /usr/local/packer/packer-builder-amazon-chroot
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: amazon-ebs = /usr/local/packer/packer-builder-amazon-ebs
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: amazon-instance = /usr/local/packer/packer-builder-amazon-instance
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: digitalocean = /usr/local/packer/packer-builder-digitalocean
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker = /usr/local/packer/packer-builder-docker
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: googlecompute = /usr/local/packer/packer-builder-googlecompute
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: null = /usr/local/packer/packer-builder-null
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: openstack = /usr/local/packer/packer-builder-openstack
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: parallels-iso = /usr/local/packer/packer-builder-parallels-iso
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: parallels-pvm = /usr/local/packer/packer-builder-parallels-pvm
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: qemu = /usr/local/packer/packer-builder-qemu
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: virtualbox-iso = /usr/local/packer/packer-builder-virtualbox-iso
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: virtualbox-ovf = /usr/local/packer/packer-builder-virtualbox-ovf
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vmware-iso = /usr/local/packer/packer-builder-vmware-iso
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vmware-vmx = /usr/local/packer/packer-builder-vmware-vmx
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: atlas = /usr/local/packer/packer-post-processor-atlas
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: compress = /usr/local/packer/packer-post-processor-compress
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-import = /usr/local/packer/packer-post-processor-docker-import
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-push = /usr/local/packer/packer-post-processor-docker-push
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-save = /usr/local/packer/packer-post-processor-docker-save
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: docker-tag = /usr/local/packer/packer-post-processor-docker-tag
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vagrant = /usr/local/packer/packer-post-processor-vagrant
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vagrant-cloud = /usr/local/packer/packer-post-processor-vagrant-cloud
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: vsphere = /usr/local/packer/packer-post-processor-vsphere
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: ansible-local = /usr/local/packer/packer-provisioner-ansible-local
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: chef-client = /usr/local/packer/packer-provisioner-chef-client
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: chef-solo = /usr/local/packer/packer-provisioner-chef-solo
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: file = /usr/local/packer/packer-provisioner-file
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: puppet-masterless = /usr/local/packer/packer-provisioner-puppet-masterless
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: puppet-server = /usr/local/packer/packer-provisioner-puppet-server
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: salt-masterless = /usr/local/packer/packer-provisioner-salt-masterless
2015/03/17 11:40:17 [DEBUG] Discoverd plugin: shell = /usr/local/packer/packer-provisioner-shell
2015/03/17 11:40:17 Detected home directory from env var: /Users/user99
2015/03/17 11:40:17 Detected home directory from env var: /Users/user99
2015/03/17 11:40:17 Attempting to open config file: /Users/user99/.packerconfig
2015/03/17 11:40:17 File doesn't exist, but doesn't need to. Ignoring.
2015/03/17 11:40:17 Packer config: &{DisableCheckpoint:false DisableCheckpointSignature:false PluginMinPort:10000 PluginMaxPort:25000 Builders:map[amazon-instance:/usr/local/packer/packer-builder-amazon-instance digitalocean:/usr/local/packer/packer-builder-digitalocean null:/usr/local/packer/packer-builder-null virtualbox-iso:/usr/local/packer/packer-builder-virtualbox-iso vmware-iso:/usr/local/packer/packer-builder-vmware-iso parallels-iso:/usr/local/packer/packer-builder-parallels-iso qemu:/usr/local/packer/packer-builder-qemu vmware-vmx:/usr/local/packer/packer-builder-vmware-vmx amazon-ebs:/usr/local/packer/packer-builder-amazon-ebs docker:/usr/local/packer/packer-builder-docker googlecompute:/usr/local/packer/packer-builder-googlecompute amazon-chroot:/usr/local/packer/packer-builder-amazon-chroot openstack:/usr/local/packer/packer-builder-openstack parallels-pvm:/usr/local/packer/packer-builder-parallels-pvm virtualbox-ovf:/usr/local/packer/packer-builder-virtualbox-ovf] PostProcessors:map[docker-save:/usr/local/packer/packer-post-processor-docker-save vagrant:/usr/local/packer/packer-post-processor-vagrant vsphere:/usr/local/packer/packer-post-processor-vsphere atlas:/usr/local/packer/packer-post-processor-atlas docker-import:/usr/local/packer/packer-post-processor-docker-import docker-push:/usr/local/packer/packer-post-processor-docker-push docker-tag:/usr/local/packer/packer-post-processor-docker-tag vagrant-cloud:/usr/local/packer/packer-post-processor-vagrant-cloud compress:/usr/local/packer/packer-post-processor-compress] Provisioners:map[chef-solo:/usr/local/packer/packer-provisioner-chef-solo file:/usr/local/packer/packer-provisioner-file puppet-masterless:/usr/local/packer/packer-provisioner-puppet-masterless puppet-server:/usr/local/packer/packer-provisioner-puppet-server salt-masterless:/usr/local/packer/packer-provisioner-salt-masterless shell:/usr/local/packer/packer-provisioner-shell ansible-local:/usr/local/packer/packer-provisioner-ansible-local chef-client:/usr/local/packer/packer-provisioner-chef-client]}
2015/03/17 11:40:17 Setting cache directory: /Users/user99/Desktop/packer_cache
2015/03/17 11:40:17 Detected home directory from env var: /Users/user99
2015/03/17 11:40:17 Reading template: /Users/user99/Desktop/packer_docker.json
2015/03/17 11:40:17 Creating build: docker
2015/03/17 11:40:17 Loading builder: docker
2015/03/17 11:40:17 Creating plugin client for path: /usr/local/packer/packer-builder-docker
2015/03/17 11:40:17 Starting plugin: /usr/local/packer/packer-builder-docker []string{"/usr/local/packer/packer-builder-docker"}
2015/03/17 11:40:17 Waiting for RPC address for: /usr/local/packer/packer-builder-docker
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Plugin minimum port: 10000
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Plugin maximum port: 25000
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Plugin address: unix /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-plugin344113431
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Waiting for connection...
2015/03/17 11:40:17 packer-builder-docker: 2015/03/17 11:40:17 Serving a plugin connection...
2015/03/17 11:40:17 Loading provisioner: chef-solo
2015/03/17 11:40:17 Creating plugin client for path: /usr/local/packer/packer-provisioner-chef-solo
2015/03/17 11:40:17 Starting plugin: /usr/local/packer/packer-provisioner-chef-solo []string{"/usr/local/packer/packer-provisioner-chef-solo"}
2015/03/17 11:40:17 Waiting for RPC address for: /usr/local/packer/packer-provisioner-chef-solo
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Plugin minimum port: 10000
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Plugin maximum port: 25000
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Plugin address: unix /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-plugin062608027
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Waiting for connection...
2015/03/17 11:40:17 packer-provisioner-chef-solo: 2015/03/17 11:40:17 Serving a plugin connection...
2015/03/17 11:40:17 ui: Debug mode enabled. Builds will not be parallelized.
2015/03/17 11:40:17 ui: docker output will be in this color.
2015/03/17 11:40:17 ui: 
2015/03/17 11:40:17 Build debug mode: true
2015/03/17 11:40:17 Force build: false
2015/03/17 11:40:17 Preparing build: docker
Debug mode enabled. Builds will not be parallelized.
docker output will be in this color.

2015/03/17 11:40:17 Debug enabled, so waiting for build to finish: docker
2015/03/17 11:40:17 Starting build run: docker
2015/03/17 11:40:17 Running builder: docker
2015/03/17 11:40:17 ui: ==> docker: Creating a temporary directory for sharing data...
==> docker: Creating a temporary directory for sharing data...
2015/03/17 11:40:17 ui: ask: ==> docker: Pausing after run of step 'StepTempDir'. Press enter to continue.
==> docker: Pausing after run of step 'StepTempDir'. Press enter to continue. 
2015/03/17 11:40:20 ui: scan err: unexpected newline
2015/03/17 11:40:20 packer-builder-docker: 2015/03/17 11:40:20 Pull disabled, won't docker pull
2015/03/17 11:40:20 ui: ask: ==> docker: Pausing after run of step 'StepPull'. Press enter to continue.
==> docker: Pausing after run of step 'StepPull'. Press enter to continue. 
2015/03/17 11:40:21 ui: scan err: unexpected newline
2015/03/17 11:40:21 ui: ==> docker: Starting docker container...
==> docker: Starting docker container...
2015/03/17 11:40:21 ui:     docker: Run command: docker run -v /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-docker828610954:/packer-files -d -i -t centos:centos6 /bin/bash
2015/03/17 11:40:21 packer-builder-docker: 2015/03/17 11:40:21 Starting container with args: [run -v /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-docker828610954:/packer-files -d -i -t centos:centos6 /bin/bash]
    docker: Run command: docker run -v /var/folders/h0/nlb8hdp15mg89484v316h3sc0000gn/T/packer-docker828610954:/packer-files -d -i -t centos:centos6 /bin/bash
2015/03/17 11:40:21 packer-builder-docker: 2015/03/17 11:40:21 Waiting for container to finish starting
2015/03/17 11:40:22 ui:     docker: Container ID: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
2015/03/17 11:40:22 ui: ask: ==> docker: Pausing after run of step 'StepRun'. Press enter to continue.
    docker: Container ID: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
==> docker: Pausing after run of step 'StepRun'. Press enter to continue. 
2015/03/17 11:40:26 ui: scan err: unexpected newline
2015/03/17 11:40:26 packer-builder-docker: 2015/03/17 11:40:26 Running the provision hook
2015/03/17 11:40:26 ui: ==> docker: Provisioning with chef-solo
==> docker: Provisioning with chef-solo
2015/03/17 11:40:26 ui:     docker: Installing Chef...
    docker: Installing Chef...
2015/03/17 11:40:26 packer-builder-docker: 2015/03/17 11:40:26 Executing in container 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4: "(curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd188380513 2>&1; echo $? >/packer-files/cmd188380513-exit"
2015/03/17 11:40:28 packer-builder-docker: 2015/03/17 11:40:28 [INFO] RPC endpoint: Communicator ended with: 1
2015/03/17 11:40:28 [INFO] 0 bytes written for 'stderr'
2015/03/17 11:40:28 [INFO] 0 bytes written for 'stdout'
2015/03/17 11:40:28 [INFO] RPC client: Communicator ended with: 1
2015/03/17 11:40:28 [INFO] RPC endpoint: Communicator ended with: 1
2015/03/17 11:40:28 packer-provisioner-chef-solo: 2015/03/17 11:40:28 [INFO] 0 bytes written for 'stdout'
2015/03/17 11:40:28 packer-provisioner-chef-solo: 2015/03/17 11:40:28 [INFO] 0 bytes written for 'stderr'
2015/03/17 11:40:28 packer-provisioner-chef-solo: 2015/03/17 11:40:28 [INFO] RPC client: Communicator ended with: 1
2015/03/17 11:40:28 ui: ask: ==> docker: Pausing before cleanup of step 'StepRun'. Press enter to continue.
==> docker: Pausing before cleanup of step 'StepRun'. Press enter to continue. 
==> docker: Killing the container: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
2015/03/17 11:50:22 ui: scan err: unexpected newline
2015/03/17 11:50:22 ui: ==> docker: Killing the container: 08520d2e418b0d3285f1a6b0b7b4eb5ebca5cc40aff54acce31506183560a2c4
2015/03/17 11:50:23 ui: ask: ==> docker: Pausing before cleanup of step 'StepPull'. Press enter to continue.
==> docker: Pausing before cleanup of step 'StepPull'. Press enter to continue. 
2015/03/17 11:50:23 ui: scan err: unexpected newline
2015/03/17 11:50:23 ui: ask: ==> docker: Pausing before cleanup of step 'StepTempDir'. Press enter to continue.
==> docker: Pausing before cleanup of step 'StepTempDir'. Press enter to continue. 
2015/03/17 11:50:24 ui: scan err: unexpected newline
2015/03/17 11:50:24 ui error: Build 'docker' errored: Error installing Chef: Install script exited with non-zero exit status 1
2015/03/17 11:50:24 Waiting on builds to complete...
2015/03/17 11:50:24 Builds completed. Waiting on interrupt barrier...
2015/03/17 11:50:24 machine readable: error-count []string{"1"}
2015/03/17 11:50:24 ui error: 
==> Some builds didn't complete successfully and had errors:
2015/03/17 11:50:24 machine readable: docker,error []string{"Error installing Chef: Install script exited with non-zero exit status 1"}
2015/03/17 11:50:24 ui error: --> docker: Error installing Chef: Install script exited with non-zero exit status 1
2015/03/17 11:50:24 ui: 
==> Builds finished but no artifacts were created.
2015/03/17 11:50:24 waiting for all plugin processes to complete...
Build 'docker' errored: Error installing Chef: Install script exited with non-zero exit status 1

==> Some builds didn't complete successfully and had errors:
--> docker: Error installing Chef: Install script exited with non-zero exit status 1

==> Builds finished but no artifacts were created.
2015/03/17 11:50:24 /usr/local/packer/packer-provisioner-chef-solo: plugin process exited
2015/03/17 11:50:24 /usr/local/packer/packer-builder-docker: plugin process exited
laptop99:Desktop user99$ 

If if attach into the container when it pauses after the chef error and run the following command manually, it completes successfully.

(curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd188380513 2>&1; echo $? >/packer-files/cmd188380513-exit

sethvargo commented 9 years ago

Okay, so it looks like the Chef omnibus installer is failing to installer (or returning a failing status).

bridiver commented 9 years ago

It is working with this patch https://github.com/mitchellh/packer/issues/1752

johnbyrneio commented 9 years ago

Yeah, the problem is it doesn't generate any logs inside the container when run automatically. The /packer-files directory is empty.

When running manually it generates the logs and shows a clean chef-client install.

[root@08520d2e418b /]# (curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd188380513 2>&1; echo $? >/packer-files/cmd188380513-exit [root@08520d2e418b /]# cd packer-files/ [root@08520d2e418b packer-files]# ls cmd188380513 cmd188380513-exit [root@08520d2e418b packer-files]# cat cmd188380513 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18378 100 18378 0 0 70607 0 --:--:-- --:--:-- --:--:-- 208k Downloading Chef for el... downloading https://www.opscode.com/chef/metadata?v=&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64 to file /tmp/install.sh.16/metadata.txt trying curl... url https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm md5 01e4e0e2688c297590134f4070956148 sha256 1ed7d17df3f11069f19f31c6bbe4101b55334bf4ba6e96f8d022cb6750b48a63 downloaded metadata file looks valid... downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm to file /tmp/install.sh.16/chef-12.1.1-1.el6.x86_64.rpm trying curl... Comparing checksum with sha256sum... Installing Chef installing with rpm... warning: /tmp/install.sh.16/chef-12.1.1-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY Preparing... ################################################## chef ################################################## Thank you for installing Chef! [root@08520d2e418b packer-files]#

johnbyrneio commented 9 years ago

I'll try that patch out in a bit and report back. Thanks.

johnbyrneio commented 9 years ago

I tried the patch and got just past that point. It hangs here:

2015/03/17 13:09:30 packer-builder-docker: 2015/03/17 13:09:30 Executing in container 5a8e63c1fe544301200447fdb98e2425de37f036e020d3f71b1135ec96885143: "(curl -L https://www.opscode.com/chef/install.sh | bash) >/packer-files/cmd724628349 2>&1; echo $? >/packer-files/cmd724628349-exit" 2015/03/17 13:09:45 packer-builder-docker: 2015/03/17 13:09:45 Waiting for exit code to appear for remote command...

I attached to the container and verified that chef client installed successfully, and wrote the exit code to the exit file.

[root@5a8e63c1fe54 packer-files]# pwd /packer-files [root@5a8e63c1fe54 packer-files]# cat cmd724628349 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 18378 100 18378 0 0 53317 0 --:--:-- --:--:-- --:--:-- 121k Downloading Chef for el... downloading https://www.opscode.com/chef/metadata?v=&prerelease=false&nightlies=false&p=el&pv=6&m=x86_64 to file /tmp/install.sh.19/metadata.txt trying curl... url https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm md5 01e4e0e2688c297590134f4070956148 sha256 1ed7d17df3f11069f19f31c6bbe4101b55334bf4ba6e96f8d022cb6750b48a63 downloaded metadata file looks valid... downloading https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-12.1.1-1.el6.x86_64.rpm to file /tmp/install.sh.19/chef-12.1.1-1.el6.x86_64.rpm trying curl... Comparing checksum with sha256sum... Installing Chef installing with rpm... warning: /tmp/install.sh.19/chef-12.1.1-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY Preparing... ################################################## chef ################################################## Thank you for installing Chef! [root@5a8e63c1fe54 packer-files]# cat cmd724628349-exit 0 [root@5a8e63c1fe54 packer-files]#

Not sure now if this goes back to an issue with the Chef provisioner or an issue with the Docker builder.

johnbyrneio commented 9 years ago

Actually it looks like it's the Docker builder. I'm hitting the same issue with the shell provisioner.

donaldguy commented 9 years ago

@johnpbyrne is this in OSX under boot2docker (/ docker-machine)? Try your (or my) patched version with mkdir ~/tmp && TMPDIR=$HOME/tmp packer build

johnbyrneio commented 9 years ago

@donaldguy that fixed it. Thanks.

mitchellh commented 9 years ago

Fixed