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 (packer.io) failing with setsockopt error #832

Closed
jon-walton opened this issue Aug 9, 2016 · 8 comments

Comments

@jon-walton
Copy link

commented Aug 9, 2016

  • A brief description

Packer (https://www.packer.io) fails to run under WSL. returns the following error:

Failed to initialize build 'amazon-ebs': error initializing builder 'amazon-ebs': Unrecognized remote plugin message: Error starting plugin server: listen unix /tmp/packer-plugin047748426: setsockopt: invalid argument

  • Expected results
$ packer build template.json
amazon-ebs output will be in this color.

==> amazon-ebs: Prevalidating AMI Name...
==> amazon-ebs: Inspecting the source AMI...
==> amazon-ebs: Creating temporary keypair: packer 57a950ce-e1eb-499d-c2e5-d00c96e15544
==> amazon-ebs: Creating temporary security group for this instance...
==> amazon-ebs: Authorizing access to port 22 the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
    amazon-ebs: Instance ID: [redacted]
==> amazon-ebs: Waiting for instance ([redacted]) to become ready...
==> amazon-ebs: Waiting for SSH to become available...
==> amazon-ebs: Connected to SSH!

etc...

  • Actual results (with terminal output if applicable)
$ ./packer build template.json
Failed to initialize build 'amazon-ebs': error initializing builder 'amazon-ebs': Unrecognized remote plugin message: Error starting plugin server: listen unix /tmp/packer-plugin900968263: setsockopt: invalid argument
amazon-ebs output will be in this color.


==> Builds finished but no artifacts were created.
$
  • Your Windows build number

C:>ver
Microsoft Windows [Version 10.0.14393]

  • Steps / commands required to reproduce the error
    1. wget https://releases.hashicorp.com/packer/0.10.1/packer_0.10.1_linux_amd64.zip
    2. wget https://gist.githubusercontent.com/jon-walton/9c13e55309bc707fc797003403b3881e/raw/1e3d386aa2bf275af39ec00e0ffd7ad86cb8387e/template.json
    3. unzip packer_0.10.1_linux_amd64.zip
    4. ./packer build template.json
  • Strace of the failing command

strace ./packer build template.json output:
https://gist.github.com/jon-walton/507f2b4ef272da91d93692c62de38d6e

  • Required packages and commands to install
    • AWS account with correctly configured credentials: https://www.packer.io/docs/builders/amazon.html
    • apt-get install unzip
    • wget https://releases.hashicorp.com/packer/0.10.1/packer_0.10.1_linux_amd64.zip
    • unzip packer_0.10.1_linux_amd64.zip
@benhillis

This comment has been minimized.

Copy link
Member

commented Aug 9, 2016

Do you happen to know the socket option that is being used? An strace of the failing command would be very useful. Thanks!

@jon-walton

This comment has been minimized.

Copy link
Author

commented Aug 9, 2016

@benhillis I thought I did, but my original strace actually didn't capture it. I've updated the strace for you https://gist.github.com/jon-walton/507f2b4ef272da91d93692c62de38d6e

   6552 482   socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0 <unfinished ...>
   6554 482   <... socket resumed> )            = 5
   6556 482   setsockopt(5, SOL_SOCKET, SO_BROADCAST, [1], 4 <unfinished ...>
   6558 482   <... setsockopt resumed> )        = -1 EINVAL (Invalid argument)

This seems to be the only socket in the strace using PF_LOCAL if that makes a difference

Thanks

@Ehekatl

This comment has been minimized.

Copy link

commented Aug 11, 2016

this actually affect all go programs that using net package to open unix socket

setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0
bind(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP) = 4
setsockopt(4, SOL_IPV6, IPV6_V6ONLY, [0], 4) = 0

currently WSL is missing ipv6 support, the same issue have been raised many times
ref:
#674
#128

@sunilmut

This comment has been minimized.

Copy link
Member

commented Aug 16, 2016

@jon-walton - Thanks for the trace. The SO_BROADCAST option for PF_LOCAL(AF_UNIX)\SOCK_STRAEM sockets was added recently to WSL. The fix should make it to the release branch soon. I tried the repro steps with the fix and it seems to be able to make progress, but it then fails with the below error. I am getting the same error on native Ubuntu as well when I tried the repro steps. Looks like the repro is missing some steps?

`amazon-ebs output will be in this color.
1 error(s) occurred:

  • Bad script 'scripts/common.sh': stat scripts/common.sh: no such file or directory`
@jon-walton

This comment has been minimized.

Copy link
Author

commented Aug 16, 2016

@sunilmut apologies, I've updated the template and edited the repro steps in the original post.

@sunilmut

This comment has been minimized.

Copy link
Member

commented Sep 13, 2016

This should be fixed in build 14915+

@sunilmut

This comment has been minimized.

Copy link
Member

commented Sep 14, 2016

@jon-walton Could you try your scenario out with build 14915+ and see if it resolves your issue?

@jon-walton

This comment has been minimized.

Copy link
Author

commented Sep 15, 2016

@sunilmut confirmed fixed in 14915 thanks!

@jon-walton jon-walton closed this Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.