Starting openvpn error: "Please enter password with the systemd-tty-ask-password-agent"

This happens since Ubuntu 15.10 uses systemd to start openvpn. Following seems to work me for me. After you start openvpn and get the error message from the terminal do the following

sudo systemd-tty-ask-password-agent

You will be prompted to enter your username. Now type in the same command again

sudo systemd-tty-ask-password-agent

This time you will be prompted to enter your password. After entering the password start the vpn connection again. For me I do it with the following command

sudo service openvpn start

Now it should connect successfully.


Every time on startup, I was asked to "Enter Auth Username" and "Enter Auth Password" and I periodically got the same messages in the terminal as OP did. I can just hit Enter or type in whatever I want, it makes no difference. (Ubuntu 17.10 and 18.04)

So instead of "reinstalling the whole OS", I just commented out the line auth-user-pass in

/etc/openvpn/client.conf

Now, the messages both on startup and in the terminal don't bother me anymore.


I know is old but, it may help someone... The way that I did to fix it (unfortunately I don't remember where I got the information) You can do this:

  sudo systemctl disable systemd-ask-password-wall.service
  sudo systemctl disable systemd-ask-password-wall.path
  sudo systemctl stop systemd-ask-password-wall.service
  sudo systemctl stop systemd-ask-password-wall.path
  sudo systemctl enable systemd-ask-password-console.service
  sudo systemctl start systemd-ask-password-console.service

create a file: /etc/openvpn/pass(or wherever you want) put the passphrase and in the server.conf add, don't forget to secure pass file (sudo chmod 400 pass)

askpass pass