Failed to initialize build 'amazon-ebs': error initializing builder 'amazon-ebs': Unrecognized remote plugin message: Error starting plugin server: listen unix /tmp/packer-plugin059395834: setsockopt: invalid argument
Maybe a problem in https://github.com/Microsoft/BashOnWindows itself?
From googling a bit it seems like wsl doesn't support sockets correct. I'll close this since Microsoft have to fix that. Any more info/opinions on this @boumenot?
The reason this doesn't work is because packer communicates with plugins over a Unix socket except on Windows which doesn't have sockets. Instead it uses TCP/IP.
When running on wsl packer thinks it running on a posix system and tries to use a Unix socket and fails.
The might be a possibility to detect that packer is running on wsl and then use TCP/IP to connect plugins. If anyone finds out how to implement such a workaround a PR is always appreciated.
Let me find the correct person for this issue, and I'll re-raise it internally. I think WSL needs to support/emulate this; it is an important scenario.
I collected an strace of Packer and there are two calls to setsocketopt.
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
The BashOnWindows team is aware of the issue (there are others), and is working on a fix.
@boumenot thx for your work ! It would be really nice to see packer work in WSL
Most helpful comment
I collected an strace of Packer and there are two calls to setsocketopt.
The BashOnWindows team is aware of the issue (there are others), and is working on a fix.