2
votes

I am trying get PostgreSQL (server) installed on an Ubuntu node using Chef:

Role definition (roles/base_server.rb):

run_list(
  "recipe[apt]",
  "recipe[postgres::server]"
)

default_attributes(
  postgresql: {
    version:  "9.3.4",
     config: {
      shared_buffers_mb: "12000"
  }
}

Setup

System: Ubuntu 14.04 LTS (GNU/Linux 3.13.0-24-generic x86_64)

Chef-Version: 11.14.6

Postgres Cookbook: [3.4.1] (https://github.com/hw-cookbooks/postgresql)

Running the bootstrap command

knife bootstrap IPADDRESS -x USER -r 'role[base_server]' --sudo

Results in the following error:

* package[readline] action install
  * No version specified, and no candidate version available for readline
  ================================================================================
  Error executing action `install` on resource 'package[readline]'
  ================================================================================

  Chef::Exceptions::Package
  -------------------------
  No version specified, and no candidate version available for readline

  Resource Declaration:
  ---------------------
  # In /var/chef/cache/cookbooks/postgres/recipes/build.rb

   29:   package package_name do
   30:     action :install
   31:   end
   32: end

  Compiled Resource:
  ------------------
  # Declared in /var/chef/cache/cookbooks/postgres/recipes/build.rb:29:in `block in from_file'

  package("readline") do
    action [:install]
    retries 0
    retry_delay 2
    guard_interpreter :default
    package_name "readline"
    timeout 900
    cookbook_name "postgres"
    recipe_name "build"
  end

I already tried to fix this by installing the readline libraries manually, but no success. Has anyone an idea how to solve this?

1
You need to include the apt cookbook first in your run_list to update the apt cache. - sethvargo
Isn't 'recipe[apt]' in the run list above doing this already? - Harry Haller
I agree. Have you tried running a manual apt-get update && apt-get install readline? - StephenKing
apt-get install readline gives me an E: Unable to locate package readline. On the other hand doing apt-get install libreadline6 libreadline6-dev tells me that everything is up-to-date. - Harry Haller
So it's not a chef problem, but more caused by your Ubuntu installation. According packages.ubuntu.com there is no readline package, only a readline-common. So this is an issue in the cookbook. But I'm wondering what cookbook you are using. There's no build recipe here. - StephenKing

1 Answers

0
votes

As mentioned by StephenKing, the issue isn't with Chef, it is that the package really doesn't exist. You'll need to fix your recipe code to use the correct package name.