Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Packer on Windows with chef-solo provisioner on ubuntu #394

ghost opened this issue Sep 5, 2013 · 3 comments

Packer on Windows with chef-solo provisioner on ubuntu #394

ghost opened this issue Sep 5, 2013 · 3 comments


Copy link

@ghost ghost commented Sep 5, 2013

I am running packer from a windows machine but provisioning a ubuntu EC2 isntance to create my AMI...

And I have the following error:

amazon-ebs output will be in this color.

==> amazon-ebs: Creating temporary keypair for this instance...
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing SSH access on the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Waiting for instance (i-520fb91e) to become ready...
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Connected to SSH!
amazon-ebs: Installing Chef...
amazon-ebs: % Total % Received % Xferd Average Speed Time Time Time Current
amazon-ebs: Dload Upload Total Spent Left Speed
amazon-ebs: 100 6790 100 6790 0 0 7450 0 --:--:-- --:--:-- --:--:-- 9314
amazon-ebs: Downloading Chef for ubuntu...
amazon-ebs: Installing Chef
amazon-ebs: Selecting previously unselected package chef.
amazon-ebs: (Reading database ... 47418 files and directories currently installed.)
amazon-ebs: Unpacking chef (from .../tmp.TmJtzofl/chef__amd64.deb) ...
amazon-ebs: Setting up chef (11.6.0-1.ubuntu.12.04) ...
amazon-ebs: Thank you for installing Chef!
amazon-ebs: Processing triggers for initramfs-tools ...
amazon-ebs: update-initramfs: Generating /boot/initrd.img-3.2.0-40-virtual
amazon-ebs: Creating directory: /tmp/packer-chef-solo
amazon-ebs: Creating directory: /tmp/packer-chef-solo/cookbooks-0
amazon-ebs: Creating configuration file 'solo.rb'
amazon-ebs: Creating JSON attribute file
amazon-ebs: Executing Chef: sudo chef-solo --no-color -c \tmp\packer-chef-solo\solo.rb -j \tmp\packer-chef-solo\node
amazon-ebs: [2013-09-04T09:27:27+00:00] WARN: *****************************************
amazon-ebs: [2013-09-04T09:27:27+00:00] WARN: Did not find config file: tmppacker-chef-solosolo.rb, using command li
ne options.
amazon-ebs: [2013-09-04T09:27:27+00:00] WARN: *****************************************
amazon-ebs: [2013-09-04T09:27:27+00:00] FATAL: I cannot find tmppacker-chef-solonode.json
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Error executing Chef: Non-zero exit status: 2

==> Some builds didn't complete successfully and had errors:
--> amazon-ebs: Error executing Chef: Non-zero exit status: 2

==> Builds finished but no artifacts were created.

From this log, it seems to create the directories properly using the unix path separator, but when running the chef-solo command, it looks like it uses the windows path separator - can it be the issue?

Copy link

@bigwheel bigwheel commented Oct 1, 2013

I met this problem too.

I need temporary fix, then i overwrite line 307 and 336 of

remotePath := filepath.Join(p.config.StagingDir, "node.json")

remotePath := p.config.StagingDir + "/" + "node.json"

this is temporary fix, because this code doesnt work in windows guest os.

Im not good at go lang, but i guess is helpful for this problem.

If i can have a time, i will fix it in correct way and send pull request.

Copy link

@malheiros malheiros commented Oct 11, 2013

Rewriting my previous post... I've had the same issue as @lbertrand and looking at the code pointed by @bigwheel , looks like the problem is related to the passing of .ConfigPath and .JsonPath variables when forming the Chef Executecommand. filepath.FromSlash(path string) should be used on those variables.

Take a loook at line 81 of

A workaround that I've found for this is, on your packer's json file, just pass the chef execute command with the paths hardcoded like this:

"execute_command": "{{if .Sudo}}sudo {{end}}chef-solo --no-color -c /tmp/packer-chef-solo/solo.rb -j /tmp/packer-chef-solo/node.json"

This is the same default command used by chef-provisioner, but you just force it to use forward slashes and it will work. A fix needs to be implemented on those .ConfigPath and .JsonPath variables, using something like filepath.FromSlash(path string), to allow it to work irrespectively of the OS being used.


Copy link

@ShibaBandit ShibaBandit commented Jun 25, 2014

Also an issue using chef-client provisioner + ubuntu amazon-instance build, launched from Windows 7 workstation

@rasa rasa closed this in dab4d78 Jul 11, 2014
rasa added a commit that referenced this issue Jul 11, 2014
provisioner/chef-*: Fix remotePaths for Windows [GH-394]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants