chef-cookbooks / runit

Development repository for the Chef Runit Cookbook
https://supermarket.chef.io/cookbooks/runit
Apache License 2.0
106 stars 197 forks source link

Error executing action `start` on resource 'service[runsvdir-start]' STDERR: start: Unknown job: runsvdir-start #229

Closed coltrey closed 6 years ago

coltrey commented 6 years ago

I have a wrapper cookbook around the Jenkins cookbook which depends on runit. After switching to 4.0.3 to fix 227, the service can no longer be started.

It seems like runsvdir-start is not available on the host. The commands runsv, runsvchdir and runsvdir are available.

Does this depend on a more recent release of AWS Linux?

In the meantime, I've reverted to 3.0.6 and this is working.

Cookbook version

4.0.3

Chef-client version

12

Platform Details

AWS Amazon Linux 2016-09 Opsworks Stacks

Expected Result:

Service to be provisioned

Actual Result:

[2017-11-29T21:47:26+00:00] INFO: Processing service[runsvdir-start] action start (runit::default line 66)

================================================================================
Error executing action `start` on resource 'service[runsvdir-start]'
================================================================================

Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /sbin/start runsvdir-start ----
STDOUT: 
STDERR: start: Unknown job: runsvdir-start
---- End output of /sbin/start runsvdir-start ----
Ran /sbin/start runsvdir-start returned 1

Resource Declaration:
---------------------
# In /var/chef/runs/364353c7-8440-44a7-bb9f-98a7a08dffef/local-mode-cache/cache/cookbooks/runit/recipes/default.rb

 66: service plat_specific_sv_name do
 67:   action [:start, :enable]
 68:   # this might seem crazy, but RHEL 6 is in fact Upstart and the runit service is upstart there
 69:   provider Chef::Provider::Service::Upstart if platform?('amazon') || platform_family?('rhel') && node['platform_version'].to_i == 6
 70:   not_if { platform?('debian') && node['platform_version'].to_i < 8 } # there's no init script on debian 7...for reasons
 71: end

Compiled Resource:
------------------
# Declared in /var/chef/runs/364353c7-8440-44a7-bb9f-98a7a08dffef/local-mode-cache/cache/cookbooks/runit/recipes/default.rb:66:in `from_file'

service("runsvdir-start") do
  provider Chef::Provider::Service::Upstart
  action [:start, :enable]
  supports {:restart=>nil, :reload=>nil, :status=>nil}
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  service_name "runsvdir-start"
  pattern "runsvdir-start"
  declared_type :service
  cookbook_name "runit"
  recipe_name "default"
  not_if { #code block }
end

Platform:
---------
x86_64-linux
tas50 commented 6 years ago

@coltrey Can you fire up chef-shell and tell me what this returns:

node['platform_version'].to_i >= 7 && !platform?('amazon')

Right now in Travis and locally amazon is properly trying to start the runsvdir service

coltrey commented 6 years ago
Ohai2u ec2-user@jenkins-master-testinstance1.localdomain!
chef (12.18.31)> node['platform_version'].to_i >= 7 && !platform?('amazon')
 => false
chef (12.18.31)> node['platform_version'].to_i
 => 2016
chef (12.18.31)> !platform?('amazon')
 => false
chef (12.18.31)>

This is from an instance stood up for an integration test - taken after chef failed with the message from above (STDERR: start: Unknown job: runsvdir-start)

[root@jenkins-master-testinstance1 ~]# uname -a Linux jenkins-master-testinstance1 4.4.35-33.55.amzn1.x86_64 #1 SMP Tue Dec 6 20:30:04 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

tas50 commented 6 years ago

I'm having trouble reproducing this one. We have integration tests in Travis running on Amazon Linux w/o issue and I added chefspecs for the current logic which starts the service. It's all coming back green for Amazon Linux. Can you make sure you have the latest runit and jenkins cookbooks. Also if possible can you update to a more recent release of chef-client. Chef 12 goes EOL in April and Chef 13 has been out for about 8 months at this point.

coltrey commented 6 years ago

@tas50 I had a chance to look at it more deeply this morning and the problem is that this commit isn't in 4.0.3.

Since I'm running on AWS Opsworks Stacks, I'm limited to the version of chef they're supporting, which for now is only 12.

jshrack-ssi commented 6 years ago

@tas50 @coltrey is correct. Version 4.0.3 is missing the referenced commit which would make this work on Amazon instances. Would it be possible to either commit the change to 4.0.3 or generate a new tagged build which includes the commit? This is a hard block for those of us who use Amazon AMIs and the runit cookbook.

coltrey commented 6 years ago

@jshrack-ssi The workaround I used was to go with 3.0.6. You could probably also specify the specific commit in your Berksfile.

tas50 commented 6 years ago

I pushed 4.04. Give it a try. It has a pile of expanded testing for exactly this scenario in addition to some fixes and general cleanup

coltrey commented 6 years ago

I verified 4.0.4 is working for me.