Provisioning with Chef Solo fails with strange error

52 views
Skip to first unread message

Kevin Milner

unread,
Jan 16, 2018, 12:35:20 PM1/16/18
to Packer
I'm trying to use chef cookbooks for the provisioner. This is my entry in my .json file:
    "provisioners": [
       
{
         
"type": "chef-solo",
         
"cookbook_paths": ["cookbooks"]
       
}
   
]

According to the Chef-Solo provisioner docs, it will install chef if necessary, and that is indeed what appears to be happening.
But the problem arrises during curl's download of the file. It looks like I only get half of the file or so, and then the install fails. This is repeatable in that every time I run packer build MYJSONFILE.json, It gives me the exact same error with the same data sizes.
A copy of the output follows:

$ packer build -debug MYJSONFILE.json
Debug mode enabled. Builds will not be parallelized.
vsphere output will be
in this color.


==> vsphere: Pausing after run of step 'StepConnect'. Press enter to continue.
==> vsphere: Cloning VM...
==> vsphere: Pausing after run of step 'StepCloneVM'. Press enter to continue.
==> vsphere: Pausing after run of step 'StepConfigureHardware'. Press enter to continue.
==> vsphere: Power on VM...
==> vsphere: Waiting for IP...
==> vsphere: IP address: <MY_IP_ADDRESS>
==> vsphere: Pausing after run of step 'StepRun'. Press enter to continue.
==> vsphere: Waiting for SSH to become available...
==> vsphere: Connected to SSH!
==> vsphere: Pausing after run of step 'StepConnect'. Press enter to continue.
==> vsphere: Provisioning with chef-solo
    vsphere
: Installing Chef...
    vsphere
: sudo: no tty present and no askpass program specified
    vsphere
:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    vsphere
:                                  Dload  Upload   Total   Spent    Left  Speed
    vsphere
:  21 23425   21  5100    0     0    450      0  0:00:52  0:00:11  0:00:41  1338
    vsphere
: curl: (23) Failed writing body (1755 != 2759)
==> vsphere: Pausing before cleanup of step 'StepConnect'. Press enter to continue.

It always fails with 1755 != 2759. The only thing I can think of is the install_command is no longer correct?
Anyway, does anyone have any guidance on how to move past this?
Thanks!

Kevin Milner

unread,
Jan 16, 2018, 12:37:23 PM1/16/18
to Packer
Oh, and I'm using this builder.

Megan Marsh

unread,
Jan 16, 2018, 12:44:52 PM1/16/18
to packe...@googlegroups.com
We're having some issues with the install command on windows 2008R2 (https://github.com/hashicorp/packer/issues/5220) but I've not seen this particular problem before.  Before we go down the long route of debugging, are you sure you have enough room for the file on your VM?  If you do definitely have room, can you open a new issue?

Kevin Milner

unread,
Jan 16, 2018, 1:13:11 PM1/16/18
to Packer
Hi Megan, thanks for your response.
I created a new vm from the template manually, and this is what I have for drive space:
ubuntu@ubuntu-1604:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            
2.0G     0  2.0G   0% /dev
tmpfs           396M  5.7M  390M   2% /
run
/dev/sda1        16G  1.4G   14G  10% /
tmpfs           2.0G     0  2.0G   0% /
dev/shm
tmpfs          
5.0M     0  5.0M   0% /run/lock
tmpfs          
2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs          
396M     0  396M   0% /run/user/1000

It looks like I have plenty of room on any of the partitions. I've opened a new issue here.

Kevin Milner

unread,
Jan 16, 2018, 1:23:07 PM1/16/18
to Packer
interesting. I tried taking the install command (curl -L https://omnitruck.chef.io/install.sh | sudo bash -s --) and manually running it. The sudo bash part stops and waits for me to enter a password (with no prompt, mind) and then chef installs. Is there something I need to do to ensure that the sudo password is not required?

Alvaro Miranda Aguilera

unread,
Jan 16, 2018, 2:26:11 PM1/16/18
to packe...@googlegroups.com
on the template you are using does this work?

sudo id



On Tue, Jan 16, 2018 at 7:23 PM, Kevin Milner <brother....@gmail.com> wrote:
interesting. I tried taking the install command (curl -L https://omnitruck.chef.io/install.sh | sudo bash -s --) and manually running it. The sudo bash part stops and waits for me to enter a password (with no prompt, mind) and then chef installs. Is there something I need to do to ensure that the sudo password is not required?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/b3fc123c-726f-4cd8-9ef8-800093741d87%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Kevin Milner

unread,
Jan 16, 2018, 3:15:09 PM1/16/18
to Packer
It does, although it prompts me for a sudo password, as one would expect.

Alvaro Miranda Aguilera

unread,
Jan 16, 2018, 5:18:00 PM1/16/18
to packe...@googlegroups.com
if you want to be able to run scripts as root silently you need to update the template

check your OS manuals for password less sudo

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Alvaro Miranda Aguilera

unread,
Jan 16, 2018, 5:18:00 PM1/16/18
to packe...@googlegroups.com
if you want to be able to run scripts as root silently you need to update the template

check your OS manuals for password less sudo

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Kevin Milner

unread,
Jan 16, 2018, 5:37:18 PM1/16/18
to Packer
Yeah, I know how to do that, thats not the point. I am provisioning a fresh machine, ideally I'd be doing this from an ISO and forgoing the template all together. In that case, since there's no template, I wouldn't be able to pre-allow sudoless password.
I think that there shouldn't NEED to be any special exceptions for sudo when running the chef installer. Certainly chef itself doesn't require this.
Reply all
Reply to author
Forward
0 new messages