|
|
| Saving your Node Data The following directions involve deleting the data associated with this node. If the node attributes or run_list would be hard to recreate, you may want to save them: |
on management station
on affected node:
When chef-client runs, it will register the API client and generate the correct key.
- 2. You are trying to authenticate with a node_name that is different from the one you used on your first chef-client run.
This can happen for a number of reasons. For example, if your client.rb file does not specify your node name and you have recently changed the systems hostname. Running chef client with debug logging will allow you to see the node name the client is trying to authenticate with:You can fix this by explicitly setting the node name in the client.rb file or with chef-client's -N option to match the name originally used to register. Alternatively, you can re-register using the method described above.
- 3. If you are using Hosted Chef, your node name matches another users username on the platform.
This issue is documented here: http://tickets.opscode.com/browse/CHEF-2240. If you have unsuccessfully attempted the solutions above, click the Help link from http://manage.opscode.com and request an analyst to verify this is the issue. To rename the node without changing the hostname, follow these steps:- Capture you node data by either or byand copy/paste.
- Delete the node, client and client.pem on the node.
- On the node to be renamed:
- Run the chef client on the node and specify the new node name:
- Replace your node data
- Run the chef-client again (and in all future instances) as or addto the /etc/chef/client.rb file.
- Capture you node data by either
To rename your node by changing the host name, delete the node,client and client.pem as described above, change the hostname on the host and run the chef-client as normal.
- Common errors with Chef-Client, Knife and Chef-Server
- 401 Unauthorized (using node's API client)
- 401 Unauthorized (using validator API client)
- 401 Unauthorized (Failed to Authenticate as "NODENAME")
- 401 Unauthorized (Please synchronize the clock)
- 403 Forbidden
- Commit or stash your changes before importing cookbooks
- No such file or directory - /etc/chef/validation.pem
- Can not find config file
- Can't convert Array into String
- Directory not found error when uploading cookbooks
- Windows Specific
- Chef Server Specific
401 Unauthorized (using validator API client)Error on Hosted Chef: Error on Open Source: Fix: In Hosted Chef, you can recreate this key by going to http://manage.opscode.com and selecting 'organizations' in the upper right side of the screen. You can then select 'Regenerate validation key' next to the organization you need the key for. You will then want to replace this on the client. Be aware that any other nodes you have will no longer work until you distribute the new validation.pem to them.
If you've also lost your client_key for knife, you can also regenerate this at http://manage.opscode.com by selecting your username in the upper right and then 'get private key'. Copy these keys over to your node. Your node should be able to register now, as long as there is not still a client by the same name. If there is, you will need to delete that client first. Note that on Opscode Hosted Chef, you currently will need to delete the node as well, because the default permissions only allow the client that created the node to modify it. On a Chef Server, you can recreate the key by following these steps. First you'll want to remove your validation key on the server, which is typically stored at /etc/chef/validation.pem. Afterwards you can restart the chef-server to create a new key pair on both the disk and in the database: The same process works with the webui key pair, which knife uses as the default “admin” key to create initial knife clients: If you’ve also lost your client key for your knife client, you will need to create another one. Use a new client name unless you’re sure that the server does not still contain a registration for the previous client. After creating the new client, you can delete the old one from the server using ‘knife client delete MY_OLD_CLIENT’ by replacing MY_OLD_CLIENT with the name of the former client. Copy these keys over to your node. Your node should be able to register now, as long as there is not still a client by the same name. If there is, you will need to delete that client first. You should now be able to run the chef-client command without errors. 401 Unauthorized (Failed to Authenticate as "NODENAME")Error on Hosted Chef: There is an open Hosted Chef bug that user names and client names cannot be the same.
Future activities to implement name spacing will address this, but pending this bug being fixed, if your proposed NODENAME is already an existing User name - the authentication will fail for this reason. To validate that this is the cause, search the Opscode Community Site Users to see if there is an existing user with the same name as what you attempted to name the node. Changing the NODENAME to being unique will address this error. If your node name is unique, and there is no overlapping user name, please provide support with the debug output of the chef-client run and we'll determine and address the cause. 401 Unauthorized (Please synchronize the clock)Error on Hosted Chef: Error on Open Source: Fix: 403 ForbiddenError on Hosted Chef: Fix: This is an example of a 403 error on a specific object: What we are specifically looking for is the type of http request, in this case PUT, and where it tried to PUT to, in this case a specific node/object. Because this points to a specific node instead of the nodes group, this will be an issue with the object permissions. If this pointed to the nodes group, this would be an issue with the global permissions on nodes instead. These errors do not just apply to nodes, you may see these errors for any section of the management console such as Roles, Cookbooks or Environments.
To fix the object permissions, you'll want to follow these steps: If this is an issue with the global permissions the error will look a bit different. This is an example of a 403 error on the global permissions: The difference is that here it is referring to the entire nodes group, instead of a specific object/node. To fix the global permissions you'd want to follow these steps: More information on the API requests and associated errors can also be found on the Server API page. Commit or stash your changes before importing cookbooksThis isn't really an error, but can be confusing to new users. When you try to install a cookbook with changes that have not been committed to git you will get this error: Fix: Alternatively, if you do not want to commit the changes, you can save the changes for later (reverting the branch to the state of the latest commit) by running Afterwards you can re-enter the command to install the cookbook. No such file or directory - /etc/chef/validation.pemError: Fix: Can not find config fileError: Fix: Can't convert Array into StringError: Fix: 1. Make sure you are running this command from your chef-repo directory which has the .chef file in it. Knife will need direct access to the .chef file, which contains it's config. 2. If you are using the --distro switch, confirm the bootstrap file exists in one of the directories it checks:
In the example above, the bootstrap file could be located at ~/chef-repo/.chef/bootstrap/ubuntu.erb. More information on this is on the Knife Bootstrap and the Custom Knife Bootstrap Script pages. 3. Check the knife.rb file for any relative paths and try using the full absolute path instead. Directory not found error when uploading cookbooksError: Fix: The vendored runit is supposed to come with its own .chef directory, but in this case, it was not available, causing the ENOENT. Windows SpecificThese errors below are common on Windows systems and may not apply to Linux/Mac. Knife cookbook site installError: Fix: Cannot find a version for nodeError: Fix: Alternatively, you can downgrade your Ruby to 1.8.7 to get around this error. No such file to load – ruby-wmiError: Fix: Chef Server SpecificThese errors are specific to using the Open Source Chef Server, and are not something you will see when using Hosted Chef. Starting rabbitmq-server: FAILEDThis error only occurs in Ubuntu versions 11.04 and below when installing chef-server. It is a rabbitmq-server issue that is related to this Rabbitmq bug: https://bugs.launchpad.net/ubuntu/+source/rabbitmq-server/+bug/653405 Error: Fix: 1. Edit /etc/hostname and /etc/hosts so the hostname in /etc/hostname resolves to 127.0.1.1 or 127.0.0.1 in /etc/hosts. 4. Remove this rabbitmq file so it gets properly installed next time: 5. Re-install Chef and Chef Server:
|
