Gitlab Runner Error: sudo: no tty present and no askpass program specified

Gitlab Runner Error: sudo: no tty present and no askpass program specified

Get Social!

After issuing the first build on a dynamically created Container I came across the following build error when running a command with sudo.

The error is caused by trying to run a command with sudo, however the calling user has not been authorised to use sudo. The error isn’t helpful, and doesn’t really spell out where to go, but adding the calling user to the sudoers file will save the day.

Solution

Open up the sudoers file for editing in your favorite editor.

And add your gitlab runner user to the bottom. If you installed your gitlab runner from the official apt repositories then your gitlab-runner process will run under the gitlab-runner user.

Add the following to the bottom of the file:

Retry your build and you should be back in business!

 


Related posts:


3 Comments

Manohara Babu Chennuru

28-Mar-2018 at 3:11 pm

It did not work for me.

    wangjin

    14-Jun-2018 at 11:05 am

    check your runner type change it from shell to ssh

wangjin

14-Jun-2018 at 11:04 am

Did not solve my problem…..
this can solve it ,someone like me
[[runners]]
name = “3.0.1_node2”
url = “http://XXXXXXX/”
token = “07c5286e147eda5ba60e333e135366”

executor = “ssh” ###if you not this type, eg “shell ” may cause this problem……
[runners.ssh]
user = “root”
password = “x.x.x.x”
host = “x.x.x.x”

Leave a Reply

Visit our advertisers

Search

Quick Poll

How often do you change the password for the computer(s) you use?

Visit our advertisers