enable debug only if called from a tty
don't print to stdout directly
log stderr

stderr may give a clue why os-autoinst died