This may seem like a question asked, but I have yet to find anything that works and I start suspecting it may be a bug in apt-get…
So, I have a python installer wrapping around apt-get, whose relevant functional basically amounts to:
echo -e "answer1\nanswer2\nanswer3\n" | DEBIAN_FRONTEND=teletype apt-get install -y foo.deb This works fine! In a container… Yesterday first actual end-user run this script in a graphical Ubuntu under tmux, and this broke: installation hangs waiting for user to answer questions. It does accept user input, but the user isn't supposed to answer these, installer is. But graphical Ubuntu apt-get outright ignores stdin.
What I tried so far (from what I remember):
DEBIAN_FRONTENDwith backendsreadline,teletype,text. None of them makeapt-getreceive answers from stdin. They do kinda work, because the previous problem was graphical Ubuntu triggering TUI — setting the variable to either at least bypasses that.DEBIAN_FRONTEND=noninteractive: this just randomly answers questions, which isn't desired either.- Looking in both
DEBIAN_FRONTENDdocs andapt-getdocs for keywordstdin. No avail. As a matter of fact, it even lacks someDEBIAN_FRONTENDvalues (it at least doesn't mentionteletype, even thoughapt-getcomplains you need to use it instead ofreadlinewhen in a script) - Asking AI, obviously. It gave some involved PTY changing code for python with incorrectly scoped vars, and I dropped the ball. It has to be something simple; well, unless I really just stumbled upon
apt-getbug here and theteletypeought to be enough.
How to reproduce
postfix is one small package with a question, so assuming it either isn't installed or purgeed away, the:
echo -e 'No configuration\n' | DEBIAN_FRONTEND=teletype apt-get install -y postfix …inside graphical Ubuntu hangs waiting for user to type-in the "No configuration".