I have ubuntu 12.04 installed on aws cloud and I am trying to install chef server on it, but it does not configures correctly and returns an error. I am following this simple guide for installation here

And I get the following error after running sudo sudo chef-server-ctl reconfigure

how to pass this error and configure chef server ?

execute[/opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef] action run Error executing action run on resource 'execute[/opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef]'


Expected process to exit with [0], but received '1' ---- Begin output of /opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef ---- STDOUT: STDERR: createdb: could not connect to database template1: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"? ---- End output of /opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef ---- Ran /opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef returned 1

Resource Declaration:

In /opt/chef-server/embedded/cookbooks/chef-server/recipes/postgresql.rb

141: execute "/opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef" do 142: user node['chef_server']['postgresql']['username'] 143: not_if database_exists 144: retries 30 145: notifies :run, "execute[migrate_database]", :immediately 146: end 147:

Compiled Resource:

Declared in /opt/chef-server/embedded/cookbooks/chef-server/recipes/postgresql.rb:141:in `from_file'

execute("/opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef") do action "run" retries 0 retry_delay 2 command "/opt/chef-server/embedded/bin/createdb -T template0 -E UTF-8 opscode_chef" backup 5 returns 0 user "opscode-pgsql" cookbook_name :"chef-server" recipe_name "postgresql" not_if "/opt/chef-server/embedded/bin/chpst -u opscode-pgsql /opt/chef-server/embedded/bin/psql -d 'template1' -c 'select datname from pg_database' -x|grep opscode_chef" end

[2014-12-02T06:57:49+00:00] ERROR: Running exception handlers [2014-12-02T06:57:49+00:00] ERROR: Exception handlers complete [2014-12-02T06:57:49+00:00] FATAL: Stacktrace dumped to /opt/chef-server/embedded/cookbooks/cache/chef-stacktrace.out Chef Client failed. 49 resources updated [2014-12-02T06:57:49+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

I took the hint from here https://stackoverflow.com/questions/21735878/chef-server-ctl-reconfigure-fails-after-customizing-the-postgresql-port. There is already an installed PostgreSQL. The fix is as follows.

Modify existing PostgreSQL installation's port number to be 5433 and let Chef's instance use 5432. Now the "chef-server-ctl reconfigure" command completes successfully.

It is also possible to change the port that Chef Server is using to access PostgreSQL.

  • Hey Thanks :) it worked I changed the postgres port to 5433 and it worked – slashRahul Dec 2 '14 at 9:07
  • Feel free to choose my answer or I can incorporate if you have improvements. :) – f01 Dec 2 '14 at 9:08

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.