Packer: -on-error=ask and -debug doesn't prompt when using WSL

Created on 5 May 2020  路  6Comments  路  Source: hashicorp/packer

Overview of the Issue

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

Reproduction Steps

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 version

Packer v1.5.6

Simplified Packer Buildfile

https://github.com/adamrushuk/Packer-Templates/blob/master/azure-test/ubuntu-ask-on-error.json

Operating system and Environment details

Running via WSL (Ubuntu 18.04.3 LTS) on Windows 10.

Log Fragments and crash.log files

2020/05/05 17:10:30 packer-builder-azure-arm plugin: Error asking for input: no available tty

bug core

All 6 comments

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...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wduncanfraser picture wduncanfraser  路  3Comments

DanielBo picture DanielBo  路  3Comments

s4mur4i picture s4mur4i  路  3Comments

mvermaes picture mvermaes  路  3Comments

shantanugadgil picture shantanugadgil  路  3Comments