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.

sudo: no tty present and no askpass program specified

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.

vi /etc/sudoers

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:

gitlab-runner ALL=(ALL) NOPASSWD: ALL

Retry your build and you should be back in business!

 


Related posts:


4 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”

Julio Marin

22-Jul-2019 at 9:33 pm

Thanks, works perfectly

Leave a Reply

Visit our advertisers

Search

Quick Poll

How many Proxmox servers do you work with?

Visit our advertisers