Windows Bash (WSL) - sudo: no tty present and no askpass program specified

Chris Rogers picture Chris Rogers · Oct 14, 2016 · Viewed 11.2k times · Source

After following this tutroial I get the following error when trying to run the commands as user or even sudo:

sudo: no tty present and no askpass program specified

The comments from Lurdan in this article state that you need to run

sudo -S <YOUR_COMMAND>
chmod 0666 /dev/tty

chmod doesn't work but sudo -S does, but surely there's another fix?

Answer

Chris Rogers picture Chris Rogers · Oct 14, 2016

So silly, after looking further down I see a solution from Beorat:

To avoid the sudo tty issue and others, run these commands just before running do-release-upgrade:

sudo -S apt-mark hold sudo
sudo -S apt-mark hold procps
sudo -S apt-mark hold strace

If you've already upgraded, run the above commands, then manually downgrade to the Trusty packages:

sudo -S wget http://mirrors.kernel.org/ubuntu/pool/main/s/sudo/sudo_1.8.9p5-1ubuntu1.1_amd64.deb
sudo -S wget http://mirrors.kernel.org/ubuntu/pool/main/p/procps/procps_3.3.9-1ubuntu2_amd64.deb
sudo -S wget http://mirrors.kernel.org/ubuntu/pool/main/s/strace/strace_4.8-1ubuntu5_amd64.deb
sudo -S dpkg -i sudo_1.8.9p5-1ubuntu1.1_amd64.deb
sudo -S dpkg -i procps_3.3.9-1ubuntu2_amd64.deb
sudo -S dpkg -i strace_4.8-1ubuntu5_amd64.deb

More info here: https://github.com/Microsoft/BashOnWindows/issues/482