1

OK, this has kept me busy for a day at least, since last night. I am trying to do something very simple: run a bash script which creates a few folders and runs a docker container - but using upstart. But I get permission errors:

  • either permission error to create folders depending on which user it defined as setuid
  • and in any case, I get the error cannot enable tty mode on non tty input

I have tried using setuid with user vuvu or just leaving it out to no avail. If I do not use setuid I get cannot enable tty mode on non tty input and if I use a user which I had set as admin, I get both that error as well as cannot create directory 'log/1438359854': Permission denied.

Here is my visudo output:

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin  ALL=(ALL) NOPASSWD:ALL
%adm    ALL=(ALL) NOPASSWD:ALL
vuvu    ALL=(ALL:ALL) NOPASSWD:ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

and I have made the user vuvu part of admin and when it did not work as part of adm.

My upstart is simple:

description "Job docker_some_api.conf created by create_init.py"
author "create_init.py"
start on runlevel [2345]
stop on runlevel [!2345]
setuid vuvu
chdir /home/myuser/Docker/docker_some_api/
script
        exec /home/myuser/Docker/docker_some_api/run.sh
end script

And the shell script is simple (I have dumbed down to run just ubuntu):

sudo docker run -t -i ubuntu

Nothing seems to work and I am really frustrated by now. Can you guys help?

  • cannot enable tty mode on non tty input is probably the effect of something probably asking for a password in an non-interactive shell, and failing. On the other end, you are using a lot of relative path in the shell script, which you shouldn't, unless you do an explicit cd in the script. --- sais so, I am not an expert in docker nor in upstart, so take this with a bit of caution. – Rmano Aug 1 '15 at 14:13
  • @Rmano thanks for your insight. I think it is putting me in the right direction. – Aliostad Aug 1 '15 at 15:09
  • 1
    @Rmano found it. I shouldn't have specified -t. – Aliostad Aug 1 '15 at 16:09
1

FOUND IT!!

Problem is specifying -t which can never work because it's allocating a pseudo-TTY. A similar problem with systemd was reported but this one was for upstart.

So changing to this was all I had to do:

sudo docker run -i ubuntu

Seems easy now, never just copy options without realizing what they do.

  • Hmmm.... the command line here seems identical to the old one. Shouldn't the -t be removed? – Rmano Aug 1 '15 at 18:43

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.