I'm using -on-error=ask
so Packer should ask me what to do when there is an error. This works when I use a PowerShell 7 console, but does not work when using WSL on my Windows 10 computer.
The main error I see in the logs is Error asking for input: no available tty
. I also see this when running in a Jenkins pipeline, so I assume Packer doesn't realise it can prompt in WSL.
I've also just noticed that packer build -debug
doesn't prompt either, showing this in the logs:
packer-builder-azure-arm plugin: Error asking for input: no available tty
Run packer build -on-error=ask -color=false ubuntu-ask-on-error.json
within WSL. Config file: https://github.com/adamrushuk/Packer-Templates/blob/master/azure-test/ubuntu-ask-on-error.json
Packer v1.5.6
https://github.com/adamrushuk/Packer-Templates/blob/master/azure-test/ubuntu-ask-on-error.json
Running via WSL (Ubuntu 18.04.3 LTS) on Windows 10.
2020/05/05 17:10:30 packer-builder-azure-arm plugin: Error asking for input: no available tty
How is packer getting user input? WSL2 doesn't use a tty device, we use pseudoterminals (pts) since we are relaying data to and from the host console.
@benhillis are you saying this cannot be done as WSL can't prompt for user input?
No, I'm saying that we don't use tty devices, we use pseudo-terminals (for user input).
ah ok, thanks for clarifying. Hopefully there is a solution using pseudo-terminals.
I have been using v.1.4.3 on WSL1 and -debug flag has worked perfectly. Now when updating to 1.4.4, it stopped working and even the latest 1.6.4 doesn't work.
I can also confirm this unexpected behaviour with packer --version 1.6.5 and Ubuntu 20.04 on WSL...