Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sudo apt-key add - fails if sudo is not installed #175

Closed
swifmaneum opened this issue Jul 20, 2017 · 1 comment
Closed

sudo apt-key add - fails if sudo is not installed #175

swifmaneum opened this issue Jul 20, 2017 · 1 comment
Labels

Comments

@swifmaneum
Copy link

Hi there!

Running the role on a fresh Debian 9 installation fails at the Alternative | Add Docker repository key task for me, as there is no sudo installed.

Rerunning the command manually without sudo did the trick for me. Is there an easy way to prevent this error or to check whether sudo is installed and go ahead accordingly?

The exact error looks like this:

fatal: [192.168.99.197]: FAILED! => {"changed": true, "cmd": "curl -sSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -", "delta": "0:00:00.084067", "end": "2017-07-20 10:58:56.051981", "failed": true, "rc": 127, "start": "2017-07-20 10:58:55.967914", "stderr": "/bin/sh: 1: sudo: not found\n(23) Failed writing body", "stderr_lines": ["/bin/sh: 1: sudo: not found", "(23) Failed writing body"], "stdout": "", "stdout_lines": []}

@swifmaneum swifmaneum changed the title sudo apt-key add - fails on Debian if sudo is not installed sudo apt-key add - fails if sudo is not installed Jul 20, 2017
@angstwad angstwad added the bug label Jul 20, 2017
@angstwad
Copy link
Owner

Yeah, this is a legit bug. https://github.com/angstwad/docker.ubuntu/blob/master/tasks/main.yml#L79

It because when apt-key doesn't exist, it moves on to try it at the shell. We need to properly exec the command with the proper privilege escalation method.

PR's are welcome. Not sure when I'll get to this.

Darkknight33 pushed a commit to Darkknight33/docker.ubuntu that referenced this issue Nov 7, 2017
Fixed: angstwad#175
Removed workaround for: moby/moby#23347 (no longer required)
Cleaned up conditional variables
Tested against Ubuntu Server 16.04.3 & Debian 9 minimal installs w/openssh & python2.7.
Darkknight33 pushed a commit to Darkknight33/docker.ubuntu that referenced this issue Nov 7, 2017
Fixed: angstwad#175
Removed: gnugp_curl installation (no longer required)
Added: dirmngr installation (required for functional key placement)
Changed: Key server
Added: Key installed to trusted.gpg.d
Cleaned up conditional variables
Tested against Ubuntu Server 16.04.3 & Debian 9 minimal installs w/openssh & python2.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants