Failed to install due to not found /root/authorized_keys file

I’ve tried many many times and different env, and try to search to resolve the problem. But I failed.

With installation from official doc, I always fail into the error reported:

I, [2016-02-02T03:25:19.047866 #38]  INFO -- : > echo "Beginning of custom commands"
I, [2016-02-02T03:25:19.052456 #38]  INFO -- : Beginning of custom commands

I, [2016-02-02T03:25:19.053237 #38]  INFO -- : > echo "End of custom commands"
I, [2016-02-02T03:25:19.055437 #38]  INFO -- : End of custom commands

I, [2016-02-02T03:25:19.055904 #38]  INFO -- : > awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'
awk: fatal: cannot open file `/root/.ssh/authorized_keys' for reading (No such file or directory)
I, [2016-02-02T03:25:19.060638 #38]  INFO -- : Authorized SSH keys for this container:

I, [2016-02-02T03:25:19.061065 #38]  INFO -- : Terminating async processes

I tried env:

  • centos 7.2, root or non-root user;
  • ubuntu 14.04, root or non-root user;

Double check: are you using the official Docker install?

Yes, I am using the official guide: https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md

I’m running into the same issue.
I’ve set up an AWS EC2 running Ubuntu Trusty. Installed Docker following all the procedures described here (including all pre-requisites), everything checks fine and Docker started up cleanly.

Installed Discourse following the procedures outlined here. Configured the variables in /var/discourse/containers/app.yml file according to instructions and my current environment – btw, I know these settings are correct because I had previously installed Discourse in another Ubuntu Trusty server running Apache hosting a development website I use in a regular basis for debugging (the reason for moving Discourse to an EC2 instance is because I couldn’t get both the Apache Server and Docker running concurrently in the Ubuntu server).

So after doing all this, and upon running
./launcher bootstrap app

near the end of the bootstrap process I get that same error. Anyone with ideas on how to get past that and get Discourse running?

Use Ubuntu 14.04 x64 LTS instead. That is what we recommend.

What file in samples did you copy into containers/app.yml? What changes did you make? Can you post the complete app.yml file here in the topic, so we can try to reproduce the problem?

It’s the authorized_keys in the container which isn’t being found. Normally, the sshd.template.yml file is where authorized_keys gets written. If that template is removed, that could definitely cause the problem you’re seeing.

1 Like

I have copied app.yml from samples/standalone.yml.

The app.yml I used is attached.
app (1).yml (3.9 KB)

You can remove the last line. It is no longer being used.

https://github.com/discourse/discourse_docker/commit/a1bc8635c3c171e56d04271419a3943ccb04fe01

2 Likes

Thanks for your guide. It works ok!

1 Like

This command is still in the web_only container.

[2018-08-23T13:32:36.971204 #14]  INFO -- : > awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'
awk: fatal: cannot open file `/root/.ssh/authorized_keys' for reading (No such file or directory)

That’s because it should be. If you have keys, they’ll be added to the container. If you don’t, and you watch carefully, you’ll see a warning.

I have keys configured on the VM that I use for SSH.

This same line was removed from the standalone container a couple years ago, so I wasn’t sure if it should still be in the web_only container.

1 Like