When using init instead of systemd on Ubuntu 16.04, Chef runs /lib/systemd/systemd-sysv-install enable zookeeper to enable the service. This fails, as it seems more strict in adhering to LSB init runtime dependency definitions than previous init systems. This can be fixed by adding the Default-Start and Default-Stop parameters to the LSB init block. I would be happy to submit a PR to add these parameters. See below for the chef run failure:
* service[zookeeper] action enable
================================================================================
Error executing action `enable` on resource 'service[zookeeper]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /bin/systemctl --system enable zookeeper ----
STDOUT:
STDERR: zookeeper.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable zookeeper
insserv: Script zookeeper is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `zookeeper'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `zookeeper'
update-rc.d: error: zookeeper Default-Start contains no runlevels, aborting.
---- End output of /bin/systemctl --system enable zookeeper ----
Ran /bin/systemctl --system enable zookeeper returned 1
Resource Declaration:
---------------------
# In /tmp/kitchen/cache/cookbooks/apache_zookeeper/recipes/service_init.rb
30: service 'zookeeper' do
31: supports :status => true, :restart => true
32: action [:enable, :start]
33: end
Compiled Resource:
------------------
# Declared in /tmp/kitchen/cache/cookbooks/apache_zookeeper/recipes/service_init.rb:30:in `from_file'
service("zookeeper") do
action [:enable, :start]
default_guard_interpreter :default
service_name "zookeeper"
enabled nil
running nil
masked nil
pattern "zookeeper"
declared_type :service
cookbook_name "apache_zookeeper"
recipe_name "service_init"
supports {:status=>true, :restart=>true}
end
System Info:
------------
chef_version=14.1.12
platform=ubuntu
platform_version=16.04
ruby=ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
program_name=/opt/chef/bin/chef-client
executable=/opt/chef/bin/chef-client
Recipe: apache_zookeeper::configure
* ruby_block[restart_zookeeper_svc] action run
- execute the ruby block restart_zookeeper_svc
Recipe: apache_zookeeper::service_init
* service[zookeeper] action restart
- restart service service[zookeeper]
Running handlers:
[2018-06-06T17:24:01+00:00] ERROR: Running exception handlers
Running handlers complete
[2018-06-06T17:24:01+00:00] ERROR: Exception handlers complete
Chef Client failed. 34 resources updated in 04 minutes 34 seconds
[2018-06-06T17:24:01+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2018-06-06T17:24:01+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-06-06T17:24:01+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: service[zookeeper] (apache_zookeeper::service_init line 30) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /bin/systemctl --system enable zookeeper ----
STDOUT:
STDERR: zookeeper.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable zookeeper
insserv: Script zookeeper is broken: incomplete LSB comment.
insserv: missing `Default-Start:' entry: please add even if empty.
insserv: missing `Default-Stop:' entry: please add even if empty.
insserv: Default-Start undefined, assuming empty start runlevel(s) for script `zookeeper'
insserv: Default-Stop undefined, assuming empty stop runlevel(s) for script `zookeeper'
update-rc.d: error: zookeeper Default-Start contains no runlevels, aborting.
---- End output of /bin/systemctl --system enable zookeeper ----
Ran /bin/systemctl --system enable zookeeper returned 1
When using init instead of systemd on Ubuntu 16.04, Chef runs
/lib/systemd/systemd-sysv-install enable zookeeper
to enable the service. This fails, as it seems more strict in adhering to LSB init runtime dependency definitions than previous init systems. This can be fixed by adding theDefault-Start
andDefault-Stop
parameters to the LSB init block. I would be happy to submit a PR to add these parameters. See below for the chef run failure: