How to install Chef-client on SLES 11 x86_64


#1

Hi,
I’d install chef-client on SLES x86_64 but I don’t see the corresponding client in the download page. I found a client only for the s390x architecture. How can I proceed on x86_64 hosts?

Regards,
Rosario


#2

You can just install the Red Hat Enterprise Linux RPMs for now; we expect to have separate SLES downloads for the next release of chef but the code is the same.


#3

Thanks for your reply. I’ve already tried it, using EL6 package and the installation is fine. The problem is raised during the first execution of the Chef-Client. In fact ruby requires glibc >=2.12 while the latest version on SLES 11 SP4 is 2.11.

/opt/chef/embedded/bin/ruby: /lib64/libpthread.so.0: version `GLIBC_2.12' not found (required by /opt/chef/embedded/lib/libruby.so.2.3)

How can I solve this?


#4

For Sles 11 you can install chef-client with rvm + ruby 2.4 + chef gems.

tpl-sles11:~ # cat /etc/SuSE-release 
SUSE Linux Enterprise Server 11 (x86_64)
VERSION = 11
PATCHLEVEL = 4
tpl-sles11:~ # chef-client --version
Chef: 13.0.118

#5

We absolutely don’t support chef installed with gems, and would never recommend that you do so on production systems.
The most recent current build, https://downloads.chef.io/chef/current/13.0.123#sles , now has x86_64 rpms for both 11 and 12; we’ll be doing a stable release in about two weeks time that’ll have SLES rpms. For now, I’d recommend that you install the current RPMs and ensure that they work for you. There are very few changes between the 13.0 release and what is in current.

Cheers,
-Thom


#6

Hi,
I’ve tried to bootstrap the node using the suggested current release. I’ve added the chef-client::default recipe to the run-list but the first Chef execution fails because of the following.

192.168.56.165 Recipe: chef-client::systemd_service
192.168.56.165 * template[/etc/systemd/system/chef-client.service] action create
192.168.56.165 * Parent directory /etc/systemd/system does not exist.
192.168.56.165 ================================================================================
192.168.56.165 Error executing action create on resource 'template[/etc/systemd/system/chef-client.service]'
192.168.56.165 ================================================================================
192.168.56.165
192.168.56.165 Chef::Exceptions::EnclosingDirectoryDoesNotExist
192.168.56.165 ------------------------------------------------
192.168.56.165 Parent directory /etc/systemd/system does not exist.
192.168.56.165
192.168.56.165 Resource Declaration:
192.168.56.165 ---------------------
192.168.56.165 # In /var/chef/cache/cookbooks/chef-client/recipes/systemd_service.rb
192.168.56.165
192.168.56.165 18: template ‘/etc/systemd/system/chef-client.service’ do
192.168.56.165 19: source 'systemd/chef-client.service.erb’
192.168.56.165 20: mode '644’
192.168.56.165 21: variables(client_bin: client_bin, sysconfig_file: “/etc/#{conf_dir}/#{env_file}”)
192.168.56.165 22: notifies :restart, ‘service[chef-client]’, :delayed
192.168.56.165 23: end
192.168.56.165 24:
192.168.56.165
192.168.56.165 Compiled Resource:
192.168.56.165 ------------------
192.168.56.165 # Declared in /var/chef/cache/cookbooks/chef-client/recipes/systemd_service.rb:18:in `from_file’
192.168.56.165
192.168.56.165 template("/etc/systemd/system/chef-client.service") do
192.168.56.165 action [:create]
192.168.56.165 default_guard_interpreter :default
192.168.56.165 source “systemd/chef-client.service.erb"
192.168.56.165 variables {:client_bin=>”/usr/bin/chef-client", :sysconfig_file=>"/etc/sysconfig/chef-client"}
192.168.56.165 declared_type :template
192.168.56.165 cookbook_name "chef-client"
192.168.56.165 recipe_name "systemd_service"
192.168.56.165 owner nil
192.168.56.165 group nil
192.168.56.165 mode "644"
192.168.56.165 path "/etc/systemd/system/chef-client.service"
192.168.56.165 verifications []
192.168.56.165 end
192.168.56.165
192.168.56.165 System Info:
192.168.56.165 ------------
192.168.56.165 chef_version=13.0.123
192.168.56.165 platform=suse
192.168.56.165 platform_version=11.4
192.168.56.165 ruby=ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
192.168.56.165 program_name=chef-client worker: ppid=4834;start=16:14:56;
192.168.56.165 executable=/opt/chef/bin/chef-client
192.168.56.165
192.168.56.165
192.168.56.165 Running handlers:
192.168.56.165 [2017-04-21T16:15:02+02:00] ERROR: Running exception handlers
192.168.56.165 Running handlers complete
192.168.56.165 [2017-04-21T16:15:02+02:00] ERROR: Exception handlers complete
192.168.56.165 Chef Client failed. 8 resources updated in 05 seconds
192.168.56.165 [2017-04-21T16:15:02+02:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
192.168.56.165 [2017-04-21T16:15:02+02:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
192.168.56.165 [2017-04-21T16:15:02+02:00] ERROR: template[/etc/systemd/system/chef-client.service] (chef-client::systemd_service line 18) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /etc/systemd/system does not exist.
192.168.56.165 [2017-04-21T16:15:02+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Do you suggest a specific recipe to be used instead of the default one?

Regards,
Rosario


#7

In order to allow the correct execution of the chef-client recipe, I’ve changed the default attributes file in this way

case node[‘platform_family’]
when ‘suse’

  • default[‘chef_client’][‘init_style’] = ‘systemd’
  • default[‘chef_client’][‘init_style’] = node[‘init_package’]

and then restarted the bootstrap command with knife. Now it works because the “init” style has been used instead of “systemd”.

What about i386 architecture?

Regards,
Rosario


#8

We’ve not had any customer demand for i386 architecture packages for SLES that I’m aware of, so it’s unlikely to happen.


#9

OK for i386.

Anyway, after the first correct execution of the chef-client on the SLES11 x86_64 host, I see that the following ones are in error because of this:

#<Errno::EISDIR: Is a directory @ io_fread - /> had an error:
Is a directory @ io_fread - /

Any suggestion?

The stacktrace.out file has the following:
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/mixin/from_file.rb:30:in read' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/mixin/from_file.rb:30:infrom_file’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/run_context.rb:363:in load_recipe_file' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/policy_builder/expand_node_object.rb:100:inblock in setup_run_context’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/policy_builder/expand_node_object.rb:99:in each' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/policy_builder/expand_node_object.rb:99:insetup_run_context’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/client.rb:513:in setup_run_context' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/client.rb:281:inrun’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application.rb:291:in block in fork_chef_client' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application.rb:279:infork’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application.rb:279:in fork_chef_client' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application.rb:244:inblock in run_chef_client’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/local_mode.rb:44:in with_server_connectivity' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application.rb:232:inrun_chef_client’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application/client.rb:464:in sleep_then_run_chef_client' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application/client.rb:451:inblock in interval_run_chef_client’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application/client.rb:450:in loop' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application/client.rb:450:ininterval_run_chef_client’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application/client.rb:434:in run_application' > /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/lib/chef/application.rb:59:inrun’
> /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.0.123/bin/chef-client:26:in <top (required)>' > /usr/bin/chef-client:58:inload’
> /usr/bin/chef-client:58:in `’


#10

That doesn’t make a tonne of sense to me; are you running chef as a daemon?
Are your config options (/etc/chef/client.rb) more or less standard?


#11

Yes, the node’s run-list is
chef-client::config
chef-client::default

without changing any particular attribute apart of the frequency execution. In my opinion, remembering that I’ve used the ‘init’ init style instead of the systemd, I guess that it is not compatible with the SLES hosts (BTW not even systemd works on SLES, maybe it works with OpenSuse but not with SLES). What do you think?

My workaround is to use the cron recipe on SLES and it looks to work fine.

Regards,
Rosario


#12

I don’t think that should make any difference; I’ll see if I can replicate it.


#13

So running chef-client in daemon mode manually doesn’t have this problem, but running from the init script does. I’m going to keep looking.


#14

Thanks a lot even if I don’t know if we are facing the same issue. I’ve included the chef-client::default in the run-list, which means daemon mode. Am I right?

Regards,
Rosario


#15

I mean the difference between running chef-client -d on the command line, and including chef-client::service with service set to init, and hence running chef-client from init.
The former case is fine and runs over and over. The latter case, with the same run list, breaks in the way you posted.


#16

OK, thanks for the clarification. Anyway, now I’m working using the chef-client as a cron job. If I can support you in some way to test some configuration in my environment, please let me know.

Thanks again,
Rosario


#17

Has any progress been made on supporting sles 11 with the default chef client cookbook.


#18

@ant4r3s @thommay

I appear to be able to reproduce this error/behavior via LXD/LXC when launching an Ubuntu 16.04 instance and starting the first run of Chef 13.1.31 via cloud-init.

Same stack trace:

Errno::EISDIR: Is a directory @ io_fread - /
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/mixin/from_file.rb:30:in read' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/mixin/from_file.rb:30:infrom_file’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/run_context.rb:363:in load_recipe_file' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/policy_builder/expand_node_object.rb:100:inblock in setup_run_context’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/policy_builder/expand_node_object.rb:99:in each' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/policy_builder/expand_node_object.rb:99:insetup_run_context’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:513:in setup_run_context' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/client.rb:281:inrun’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:291:in block in fork_chef_client' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:279:infork’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:279:in fork_chef_client' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:244:inblock in run_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/local_mode.rb:44:in with_server_connectivity' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:232:inrun_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:464:in sleep_then_run_chef_client' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:451:inblock in interval_run_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:450:in loop' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:450:ininterval_run_chef_client’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application/client.rb:434:in run_application' /opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/lib/chef/application.rb:59:inrun’
/opt/chef/embedded/lib/ruby/gems/2.4.0/gems/chef-13.1.31/bin/chef-client:26:in <top (required)>' /usr/bin/chef-client:58:inload’
/usr/bin/chef-client:58:in `’

The cloud-init profile I am using is as follows:

config:
user.user-data: |
#cloud-config
# Original Docs:
# http://cloudinit.readthedocs.io/en/latest/topics/examples.html#install-and-run-chef-recipes
chef:
# Valid values are ‘gems’ and ‘packages’ and ‘omnibus’
install_type: omnibus
# if install_type is ‘omnibus’, change the url to download
omnibus_url: “https://www.chef.io/chef/install.sh
# Boolean: run ‘install_type’ code even if chef-client
# appears already installed.
force_install: false
log_level: :debug
# Chef settings
server_url: "https://api.chef.io/organizations/REDACTED/“
# Default validation name is chef-validator
validation_name: "chef-validator"
validation_cert: |
REDACTED
ssl_verify_mode: :verify_peer
run_list:
- “recipe[chef-client::default]”
# Run chef-client after configuration is dropped on disk.
exec: true
# Do not try to run in daemon mode since we configure the daemon via the
# chef-client cookbook. This makes the behavior more like a knife bootstrap.
# The default cloud-init options are:
# [’-d’, ‘-i’, ‘1800’, ‘-s’, ‘20’]
# https://git.launchpad.net/cloud-init/tree/cloudinit/config/cc_chef.py?id=ad2680a689ab78847ccce7766d6591797d99e219#n137
exec_arguments:
- “”

# Capture all subprocess output into a logfile
# Useful for troubleshooting cloud-init issues
output: {all: '| tee -a /var/log/cloud-init-output.log'}

EDIT

Debug output also contains some interesting information:

[2017-06-25T20:29:34+00:00] DEBUG: Loading recipe chef-client::default via include_recipe
[2017-06-25T20:29:34+00:00] DEBUG: Found recipe default in cookbook chef-client
[2017-06-25T20:29:34+00:00] DEBUG: Loading recipe chef-client::service via include_recipe
[2017-06-25T20:29:34+00:00] DEBUG: Found recipe service in cookbook chef-client
[2017-06-25T20:29:34+00:00] DEBUG: Loading recipe chef-client::systemd_service via include_recipe
[2017-06-25T20:29:34+00:00] DEBUG: Found recipe systemd_service in cookbook chef-client
[2017-06-25T20:29:34+00:00] DEBUG: Using executable? and ‘which’ since we’re on Linux
[2017-06-25T20:29:34+00:00] DEBUG: Using chef-client bin from node attributes
[2017-06-25T20:29:34+00:00] DEBUG: Found chef-client in /usr/bin/chef-client
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic directory resource enabled on node include: [Chef::Resource::Directory]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for directory is Chef::Resource::Directory
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic directory resource enabled on node include: [Chef::Resource::Directory]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for directory is Chef::Resource::Directory
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic directory resource enabled on node include: [Chef::Resource::Directory]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for directory is Chef::Resource::Directory
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic directory resource enabled on node include: [Chef::Resource::Directory]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for directory is Chef::Resource::Directory
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic directory resource enabled on node include: [Chef::Resource::Directory]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for directory is Chef::Resource::Directory
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic systemd_unit resource enabled on node include: [Chef::Resource::SystemdUnit]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for systemd_unit is Chef::Resource::SystemdUnit
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic template resource enabled on node include: [Chef::Resource::Template]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for template is Chef::Resource::Template
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic service resource enabled on node include: [Chef::Resource::Service]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for service is Chef::Resource::Service
[2017-06-25T20:29:34+00:00] DEBUG: Resources for generic systemd_unit resource enabled on node include: [Chef::Resource::SystemdUnit]
[2017-06-25T20:29:34+00:00] DEBUG: Resource for systemd_unit is Chef::Resource::SystemdUnit
[2017-06-25T20:29:34+00:00] DEBUG: Loading recipe file /
[2017-06-25T20:29:34+00:00] DEBUG: Re-raising exception: Errno::EISDIR - Is a directory @ io_fread - /

This is starting to feel a little more like like it is likely a bug in the chef-client cookbook, but if so it has been a bug for quite some time as I originally had the error using a really old 3.3.x version of the chef-client cookbook.