I’m starting a post about some errors I encountered while trying out Chef on AIX, maybe it will help some of you,

even if these errors may seem obvious for an experienced guy !

Knife bootstrap errors

ERROR: Net::SSH::Disconnect: connection closed by remote host

This is a silly one, commonly resulting in a mispelled FQDN, in my experience, you just tried to bootstrap a node with the wrong domain (like nodename.google.com instead of nodename.google.fr)

You can get a better look at the error in the syslog file, on your workstation or your gateway server if you’re using one :

Dec  9 15:05:28 gatewayserver auth|security:err|error sshd[37027844]: error: connect_to nodename.fr.intranet: unknown host (Hostname and service name not provided or found)

ERROR: 413 « Request Entity Too Large »

This is mostly due to a JSON file (generated on your workstation), which is too big (> 1MB) to be uploaded to the server .

You can check the detailed error on your chef server , in erchef.log

# sudo cat opscode-erchef/erchef.log

2016-10-07 13:54:03.310 [info] json too large (<<"JSON must be no more than 1000000 bytes.">>)

2016-10-07 13:54:03.310 [error] {<<"method=PUT; path=/organizations/myorganization/nodes/Chefserver; status=413; ">>,"Request Entity Too Large"}

Solution 1 : modify chef-server.rb on the Chef server , and change the following value:

nginx['client_max_body_size'] = "400m"

Then you need to reconfigure the server :

#chef-server-ctl reconfigure

If this doesn’t change anything, well then you’re stuck just like me with my Linux on Power LPARs, every single one of them is giving me this error…

ERROR: 401 « Unauthorized »

This occurs when there is a trail of an older chef configuration (including old and osbolete validation keys , which might happen while deleting a node from the workstation – well it shouldn’t, but I did get this once or twice)

Solution : clean up manually what the knife delete command should have done itself : ssh the client you need to bootstra and delete directory /etc/chef (or at least only the /etc/chef/client.pem)

Then you will be able to bootstrap your node easily.

Knife ssh errors

FATAL: 1 node found, but does not have the required attribute to establish the connection. Try setting another attribute to open the connection using –attribute.

This one occurs when your node definition is not complete (most typically when your first chef-client run, during the bootstrap, fails for any reason) ; your IP and/or FQDN will not be set, thus no way to connect to the node later, because knife uses the node’s parameters to communicate with them.

Here is an example of a succeeded bootstrap (connected successfully to the node, successfully installed chef-client), but with a chef-client failure:

# knife node show node1
Node Name:   node1
Environment: linux
Run List:

As you can see, the only information shown is the node name and the environment. no FQDN, no IP address. which is a BIG problem.

Solution : find out why the chef-client failed (mostly because you mispelled a recipe name in the run_list, or a syntax error in the recipe, but this shouldn’t happen in a CI/CD environment, the recipes are tested before being pushed to production, aren’t they ? 😉 ), and then bootstrap again.

FYI a fully configured node should look like this :

# knife node show nodename
Node Name:   nodename
Environment: dev
FQDN:        nodename.domain
Run List:    role[AIX_base], recipe[appmanager]
Roles:       AIX_base
Recipes:     chef-client, chef-client::default, yum, yum::default, lpar2rrd, lpar2rrd::default, zabbix, zabbix::default
Platform:    aix 7.2
Tags:        GPFS_cluster_node1

Knife configure errors

# knife configure -i
/opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/lib/chef/knife/configure.rb:29:in `block in <class:Configure>': uninitialized constant Chef::Knife::ClientCreate (NameError)
from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/lib/chef/knife.rb:232:in `block in load_deps'
from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/lib/chef/knife.rb:231:in `each'
from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/lib/chef/knife.rb:231:in `load_deps'
from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/lib/chef/knife.rb:216:in `run'
from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/lib/chef/application/knife.rb:156:in `run'
from /opt/chef/embedded/lib/ruby/gems/2.3.0/gems/chef-12.14.89/bin/knife:25:in `<top (required)>'
from /usr/bin/knife:54:in `load'
from /usr/bin/knife:54:in `<main>'

Your ~/.chef directory is not empty and contains some pieces of an older configuration , which kinda bothers the new knife .

Solution : rename or backup the ~/.chef directory to ~/.chef-old and type knife configure -i again.


Chef-server-ctl errors

ERROR: The data in your request was invalid

Response: email must be valid

When issuing

# chef-server-ctl user-create admin Admin User root@localhost PASSWORD --filename "/opt/opscode/embedded/.chef/admin.pem“

Seems that localhost is not resolved

Solution : try to swap localhost with!

# chef-server-ctl user-create admin Admin User root@  PASSWORD --filename "/opt/opscode/embedded/.chef/admin.pem"
Share Button
[CHEF] common errors

Laisser un commentaire