Incus create hangs in Azure Pipelines runner

When trying to run “incus create” in a subprocess of the Azure Pipelines Agent (GitHub - microsoft/azure-pipelines-agent: Azure Pipelines Agent 🚀), the incus client hangs waiting for some input from stdin. I spent way too long trying to figure out what was going on, eventually realizing that a way around this is to run incus create ... < /dev/null.

But there’s something that Azure Pipelines is doing that causes termios to believe that stdin is not a terminal (incus/cmd/incus/create.go at fa40153a629245d2c73bda9a9c7f2c5645dee52f · lxc/incus · GitHub). And I hope that there’s a way to fix it so no one else experiences the pain that I’ve felt over the past 24 hours.

Welcome!

Commands like incus profile edit do read from stdin and they have the same code to check for stdin. You can cat myprofile.txt | incus profile edit myprofile.

Can you try to preface the incus create with nohup? It effectively disables stdin but I do not know if it has any side-effects to your case.
Use as

nohup incus create images:alpine/edge/cloud mycontainer

That command actually hangs as well :frowning:

$ sudo strace -p 2736
strace: Process 2736 attached
futex(0x15621a0, FUTEX_WAIT_PRIVATE, 0, NULL

See https://tldp.org/LDP/abs/html/io-redirection.html on how to close file descriptors.
Close stdin: exec 0<&-

Failing that, file a bug report on Incus.