Could not create directory '/nonexistent/.ssh'. (may be red herring)

I’ve been using the application cookbook just fine for a while for
deployments of my rails app to AWS. I deploy from a github private repo,
using a deploy key at github (and have the private key for it in the app
data bag).

I’m trying to do the first deploy of a major overhaul of my project; it’s
in a new github repo. I’ve copied over all of my chef-repo files, created
a new deploy key at github (see note below), updated the data bag on the
chef server with the changes.

However, when I try to deploy I get the error below. Suggestions on what
I’m doing wrong, how to fix?

[Fri, 06 Jul 2012 21:29:00 +0000] ERROR: deploy_revision[zmx_app]
(application::rails line 155) has had an error
[Fri, 06 Jul 2012 21:29:00 +0000] ERROR: deploy_revision[zmx_app]
(/var/chef/cache/cookbooks/application/recipes/rails.rb:155:in `from_file’)
had an error:
deploy_revision[zmx_app] (application::rails line 155) had an error:
Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0],
but received ‘128’
---- Begin output of git ls-remote git@github.com:zmxmusic/zmx2.git master

STDOUT:
STDERR: Could not create directory ‘/nonexistent/.ssh’.
Failed to add the host to the list of known hosts
(/nonexistent/.ssh/known_hosts).
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
---- End output of git ls-remote git@github.com:zmxmusic/zmx2.git master

Ran git ls-remote git@github.com:zmxmusic/zmx2.git master returned 128
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:206:in
invalid!' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:192:inerror!’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/shell_out.rb:36:in
shell_out!' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/git.rb:189:inremote_resolve_reference’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/git.rb:178:in
target_revision' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/deploy/revision.rb:46:inrelease_slug’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/deploy.rb:45:in
load_current_resource' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource.rb:439:inrun_action’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:45:in
run_action' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:inblock
(2 levels) in converge’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in each' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:inblock
in converge’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:94:in
block in execute_each_resource' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:incall’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:85:instep’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:55:ineach_with_index’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:92:in
execute_each_resource' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:76:inconverge’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:312:in
converge' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:160:inrun’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/client.rb:239:in
block in run_application' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/client.rb:229:inloop’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/client.rb:229:in
run_application' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:inrun’
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/bin/chef-client:26:in <top (required)>' /usr/bin/chef-client:19:inload’
/usr/bin/chef-client:19:in `’

Here’s the relevant part of my data bag’s source JSON:

"repository": "git@github.com:zmxmusic/zmx2.git",
"deploy_key":"-----BEGIN RSA PRIVATE KEY----- ...elided ... -----END

RSA PRIVATE KEY-----\n",

I suspect maybe the new deploy key isn’t being used? Not sure why that
would be, though.

Note re: the deploy key: I had to switch to a new deploy key as I didn’t
seem to be able to add my existing deploy key to be a deploy key for a
different repository.

Thanks!

dwh

On Friday, July 6, 2012 at 2:38 PM, Denis Haskin wrote:

I've been using the application cookbook just fine for a while for deployments of my rails app to AWS. I deploy from a github private repo, using a deploy key at github (and have the private key for it in the app data bag).

I'm trying to do the first deploy of a major overhaul of my project; it's in a new github repo. I've copied over all of my chef-repo files, created a new deploy key at github (see note below), updated the data bag on the chef server with the changes.

However, when I try to deploy I get the error below. Suggestions on what I'm doing wrong, how to fix?

[Fri, 06 Jul 2012 21:29:00 +0000] ERROR: deploy_revision[zmx_app] (application::rails line 155) has had an error
[Fri, 06 Jul 2012 21:29:00 +0000] ERROR: deploy_revision[zmx_app] (/var/chef/cache/cookbooks/application/recipes/rails.rb:155:in `from_file') had an error:
deploy_revision[zmx_app] (application::rails line 155) had an error: Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but received '128'
---- Begin output of git ls-remote git@github.com (mailto:git@github.com):zmxmusic/zmx2.git master ----
STDOUT:

Did you rule this out?

STDERR: Could not create directory '/nonexistent/.ssh'.
Failed to add the host to the list of known hosts (/nonexistent/.ssh/known_hosts).

Looks like SSH is configured to keep a known_hosts file, and failed when trying to update it. If you create the requisite directory, does it work?

--
Dan DeLeo

looks like whichever user you are using for git/deploy, is set home
directory to /nonexistent, which doesn't exist, so ssh_known hosts can
be written. maybe adjust the home directory or instruct SSH where to
store the known hosts in the event the default cannot be written to.

--AJ

On 7 July 2012 09:38, Denis Haskin denis@haskinferguson.net wrote:

I've been using the application cookbook just fine for a while for
deployments of my rails app to AWS. I deploy from a github private repo,
using a deploy key at github (and have the private key for it in the app
data bag).

I'm trying to do the first deploy of a major overhaul of my project; it's in
a new github repo. I've copied over all of my chef-repo files, created a
new deploy key at github (see note below), updated the data bag on the chef
server with the changes.

However, when I try to deploy I get the error below. Suggestions on what
I'm doing wrong, how to fix?

[Fri, 06 Jul 2012 21:29:00 +0000] ERROR: deploy_revision[zmx_app]
(application::rails line 155) has had an error
[Fri, 06 Jul 2012 21:29:00 +0000] ERROR: deploy_revision[zmx_app]
(/var/chef/cache/cookbooks/application/recipes/rails.rb:155:in `from_file')
had an error:
deploy_revision[zmx_app] (application::rails line 155) had an error:
Chef::Exceptions::ShellCommandFailed: Expected process to exit with [0], but
received '128'
---- Begin output of git ls-remote git@github.com:zmxmusic/zmx2.git master

STDOUT:
STDERR: Could not create directory '/nonexistent/.ssh'.
Failed to add the host to the list of known hosts
(/nonexistent/.ssh/known_hosts).
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
---- End output of git ls-remote git@github.com:zmxmusic/zmx2.git master

Ran git ls-remote git@github.com:zmxmusic/zmx2.git master returned 128
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:206:in
invalid!' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/shell_out.rb:192:in error!'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/mixin/shell_out.rb:36:in
shell_out!' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/git.rb:189:in remote_resolve_reference'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/git.rb:178:in
target_revision' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/deploy/revision.rb:46:in release_slug'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/provider/deploy.rb:45:in
load_current_resource' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource.rb:439:in run_action'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:45:in
run_action' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in block (2
levels) in converge'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in each' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:81:in block in
converge'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:94:in
block in execute_each_resource' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in call'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:116:in
call_iterator_block' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:85:in step'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:104:in
iterate' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection/stepable_iterator.rb:55:in each_with_index'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/resource_collection.rb:92:in
execute_each_resource' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/runner.rb:76:in converge'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:312:in
converge' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/client.rb:160:in run'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/client.rb:239:in
block in run_application' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/client.rb:229:in loop'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application/client.rb:229:in
run_application' /usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/lib/chef/application.rb:67:in run'
/usr/lib/ruby/gems/1.9.1/gems/chef-0.10.8/bin/chef-client:26:in <top (required)>' /usr/bin/chef-client:19:in load'
/usr/bin/chef-client:19:in `'

Here's the relevant part of my data bag's source JSON:

"repository": "git@github.com:zmxmusic/zmx2.git",
"deploy_key":"-----BEGIN RSA PRIVATE KEY----- ...elided ... -----END RSA

PRIVATE KEY-----\n",

I suspect maybe the new deploy key isn't being used? Not sure why that
would be, though.

Note re: the deploy key: I had to switch to a new deploy key as I didn't
seem to be able to add my existing deploy key to be a deploy key for a
different repository.

Thanks!

dwh