chef-cookbooks/chef-server

Missing folder under debian 8 jessie

albundy83 opened this issue · 5 comments

Hello,

first I know that debian is not part of the supported OS, but it works and it works great.
Just a small issue with a fresh install under Debian 8.
The folder /usr/lib/systemd/system does not necessary exist on a fresh install of Debian and there is an error in the receipe : /opt/opscode/embedded/cookbooks/cache/cookbooks/enterprise/recipes/runit_systemd.rb

Just creating the folder manually fix the problem :
mkdir /usr/lib/systemd/system

Here the full error output :

Recipe: enterprise::runit_systemd
  * template[/usr/lib/systemd/system/private_chef-runsvdir-start.service] action create
    * Parent directory /usr/lib/systemd/system does not exist.
    ================================================================================
    Error executing action `create` on resource 'template[/usr/lib/systemd/system/private_chef-runsvdir-start.service]'
    ================================================================================

    Chef::Exceptions::EnclosingDirectoryDoesNotExist
    ------------------------------------------------
    Parent directory /usr/lib/systemd/system does not exist.

    Resource Declaration:
    ---------------------
    # In /opt/opscode/embedded/cookbooks/cache/cookbooks/enterprise/recipes/runit_systemd.rb

     10: template "/usr/lib/systemd/system/#{unit_name}" do
     11:   owner "root"
     12:   group "root"
     13:   mode "0644"
     14:   variables({
     15:               :install_path => node[project_name]['install_path'],
     16:               :project_name => project_name
     17:   })
     18:   source "runsvdir-start.service.erb"
     19: end
     20: 

    Compiled Resource:
    ------------------
    # Declared in /opt/opscode/embedded/cookbooks/cache/cookbooks/enterprise/recipes/runit_systemd.rb:10:in `from_file'

    template("/usr/lib/systemd/system/private_chef-runsvdir-start.service") do
      action "create"
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      path "/usr/lib/systemd/system/private_chef-runsvdir-start.service"
      backup 5
      atomic_update true
      source "runsvdir-start.service.erb"
      variables {:install_path=>"/opt/opscode", :project_name=>"private_chef"}
      declared_type :template
      cookbook_name "enterprise"
      recipe_name "runit_systemd"
      owner "root"
      group "root"
      mode "0644"
    end


Running handlers:
[2015-05-27T09:13:53+02:00] ERROR: Running exception handlers
Running handlers complete
[2015-05-27T09:13:53+02:00] ERROR: Exception handlers complete
[2015-05-27T09:13:53+02:00] FATAL: Stacktrace dumped to /opt/opscode/embedded/cookbooks/cache/chef-stacktrace.out
Chef Client failed. 12 resources updated in 10.986042348 seconds
[2015-05-27T09:13:54+02:00] FATAL: Chef::Exceptions::EnclosingDirectoryDoesNotExist: template[/usr/lib/systemd/system/private_chef-runsvdir-start.service] (enterprise::runit_systemd line 10) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /usr/lib/systemd/system does not exist.
``` 
Thanks :)

First, this is actually a bug in the enterprise cookbook:

    # Declared in /opt/opscode/embedded/cookbooks/cache/cookbooks/enterprise/recipes/runit_systemd.rb:10:in `from_file'

It probably needs to be updated to account for the differences between the systemd path locations on various distributions.

Second, we don't want to start adding platform specific workarounds and conditionals to this cookbook to account for discrepancies like this. I recommend that you use a custom cookbook and recipe that contains a resource like this:

directory '/usr/lib/systemd/system' do
  recursive true
end

This is probably similar to what the enterprise cookbook would need to have, though with a platform-specific path location.

heul commented

Another quick workaround is to symlink the folder:
ln -s /etc/systemd/system /usr/lib/systemd/system

Thanks for these hints, this helped me installing Chef Server on Debian Jessie. May I ping you @heul and @albundy83 for a follow-up problem? http://serverfault.com/questions/736531/chef-server-12-on-debian-jessy-fails-with-unable-to-change-to-service-directory

I have sent you a mail, to give me more details and see if I can help.
But for sure it should work ;)

@heul based on advice from @jtimberman, compare to symlink, create this directory is more appropriate IMHO:
sudo mkdir -p /usr/lib/systemd/system