- From: <
>
- To:
- Subject: [chef] Error executing action `restart` on resource 'service[smbd]'
- Date: Thu, 21 Aug 2014 11:05:06 -0700 (PDT)
i am having a problem installing samba on ubuntu. i am using the samba
cookbook:
Vendoring samba (0.11.4) to
/vagrant/containers/smbServer/berks-cookbooks/samba
and chef 11.14.6:
==> smbServer: downloading
https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/13.04/x86_64/chef_11.14.6-1_amd64.deb
==> smbServer: to file /tmp/install.sh.781/chef_11.14.6-1_amd64.deb
==> smbServer: trying wget...
==> smbServer: Comparing checksum with sha256sum...
==> smbServer: Installing Chef 11.14.6
after recipe server.rb installs the samba config file, it restarts samba:
template node["samba"]["config"] do
source "smb.conf.erb"
owner "root"
group "root"
mode 00644
variables :shares => shares["shares"]
svcs.each do |s|
notifies :restart, "service[#{s}]"
end
end
however, instead of using upstart, the service resource runs the smbd script
in
/etc/init.d:
==> smbServer:
================================================================================
==> smbServer: Error executing action `restart` on resource 'service[smbd]'
==> smbServer:
================================================================================
==> smbServer:
==> smbServer:
==> smbServer: Mixlib::ShellOut::ShellCommandFailed
==> smbServer: ------------------------------------
==> smbServer: Expected process to exit with [0], but received '1'
==> smbServer:
==> smbServer: ---- Begin output of /etc/init.d/smbd start ----
==> smbServer:
==> smbServer: STDOUT:
==> smbServer:
==> smbServer: STDERR:
==> smbServer:
==> smbServer: ---- End output of /etc/init.d/smbd start ----
==> smbServer:
==> smbServer: Ran /etc/init.d/smbd start returned 1
==> smbServer:
==> smbServer:
==> smbServer: Resource Declaration:
==> smbServer: ---------------------
==> smbServer: # In
/tmp/vagrant-chef-2/chef-solo-1/cookbooks/samba/recipes/server.rb
==> smbServer:
==> smbServer:
==> smbServer:
==> smbServer: 49: service s do
==> smbServer:
==> smbServer: 50: pattern "smbd|nmbd" if node["platform"] =~ /^arch$/
==> smbServer:
==> smbServer: 51: action [:enable, :start]
==> smbServer:
==> smbServer: 52: end
==> smbServer:
==> smbServer: 53: end
==> smbServer:
==> smbServer:
==> smbServer:
==> smbServer: Compiled Resource:
==> smbServer: ------------------
==> smbServer: # Declared in
/tmp/vagrant-chef-2/chef-solo-1/cookbooks/samba/recipes/server.rb:49:in `block
in from_file'
==> smbServer:
==> smbServer:
==> smbServer:
==> smbServer: service("smbd") do
==> smbServer:
==> smbServer: action [:enable, :start]
==> smbServer:
==> smbServer: updated true
==> smbServer:
==> smbServer: supports {:restart=>false, :reload=>false, :status=>false}
==> smbServer:
==> smbServer: retries 0
==> smbServer:
==> smbServer: retry_delay 2
==> smbServer:
==> smbServer: guard_interpreter :default
==> smbServer:
==> smbServer: service_name "smbd"
==> smbServer:
==> smbServer: enabled true
==> smbServer:
==> smbServer: running true
==> smbServer:
==> smbServer: pattern "smbd"
==> smbServer:
==> smbServer: cookbook_name :samba
==> smbServer:
==> smbServer: recipe_name "server"
==> smbServer:
==> smbServer: end
==> smbServer:
==> smbServer:
the /etc/init.d/smbd script has a check for ubuntu upstart at the beginning of
the start block:
. /lib/lsb/init-functions
case $1 in
start)
if init_is_upstart; then
exit 1
fi
and promptly exits with an error:
/etc/init.d$ . /lib/lsb/init-functions; init_is_upstart; echo $?
1
if this is a cookbook error and not an error on my part, it may be a
regression
of a previous bug:
https://tickets.opscode.com/browse/CHEF-3320
i fixed my problem by overriding the samba cookbook provider:
# node["samba"]["services"] is nil here
Chef::Log.info("smbCookbook/recipes/default.rb-Chef::node[samba][services]:<#{node['samba']['services']}>")
['smbd', 'nmbd'].each do |s|
begin
r = resources(:service => "#{s}")
# switch to my cookbook to locate template
r.provider Chef::Provider::Service::Upstart
rescue Chef::Exceptions::ResourceNotFound
Chef::Log.warn "could not find service #{s} to modify"
end
end
i go the idea to do this from a template override gist:
https://gist.github.com/fujin/1713157
- [chef] Error executing action `restart` on resource 'service[smbd]', david, 08/21/2014
Archive powered by MHonArc 2.6.16.