# Chef-client with role failing

**URL:** <https://discourse.chef.io/t/chef-client-with-role-failing/10753>\
**Category:** Chef Infra (archive)\
**Created:** [April 12, 2017, 10:34am UTC](https://discourse.chef.io/t/chef-client-with-role-failing/10753 "2017-04-12T10:34:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akajain](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@akajain](https://discourse.chef.io/u/akajain)\
**Post date:** [April 12, 2017, 10:34am UTC](https://discourse.chef.io/t/chef-client-with-role-failing/10753/1 "2017-04-12T10:34:03Z")

</div>

I am following the tutorials on [chef.io](http://chef.io) ([https://learn.chef.io/tutorials/manage-a-node/ubuntu/bring-your-own-system/run-chef-client-periodically/](https://learn.chef.io/tutorials/manage-a-node/ubuntu/bring-your-own-system/run-chef-client-periodically/))  
and trying to run a knife ssh command to run chef-client

`knife ssh 'role:web' 'sudo chef-client' --ssh-user root --ssh-password 'XXXX' --attribute ipaddress`

But getting the following error. Other commands like `knife node list` works fine

```
10.51.231.60 [2017-04-12T15:57:30+05:30] INFO: Forking chef instance to converge
...
10.51.231.60 Starting Chef Client, version 12.19.36
10.51.231.60 [2017-04-12T15:57:30+05:30] INFO: ***Chef 12.19.36***
10.51.231.60 [2017-04-12T15:57:30+05:30] INFO: Platform: x86_64-linux
10.51.231.60 [2017-04-12T15:57:30+05:30] INFO: Chef-client pid: 6611
10.51.231.60 [2017-04-12T15:57:34+05:30] INFO: HTTP Request Returned 401 Unautho
rized: error
10.51.231.60
10.51.231.60 ===================================================================
=============
10.51.231.60 Chef encountered an error attempting to load the node data for "nod
e-akajain"
10.51.231.60 ===================================================================
=============
10.51.231.60
10.51.231.60 Authentication Error:
10.51.231.60 ---------------------
10.51.231.60 Failed to authenticate to the chef server (http 401).
10.51.231.60
10.51.231.60 Server Response:
10.51.231.60 ----------------
10.51.231.60 Invalid signature for user or client 'node-akajain'
10.51.231.60
10.51.231.60 Relevant Config Settings:
10.51.231.60 -------------------------
10.51.231.60 chef_server_url "https://fqdn/organizations/akaorg"
10.51.231.60 node_name "node-akajain"
10.51.231.60 client_key "/etc/chef/client.pem"
10.51.231.60
10.51.231.60 If these settings are correct, your client_key may be invalid, or
10.51.231.60 you may have a chef user with the same client name as this node.
10.51.231.60
10.51.231.60 Platform:
10.51.231.60 ---------
10.51.231.60 x86_64-linux
10.51.231.60
10.51.231.60
10.51.231.60 Running handlers:
10.51.231.60 [2017-04-12T15:57:34+05:30] ERROR: Running exception handlers
10.51.231.60 Running handlers complete
10.51.231.60 [2017-04-12T15:57:34+05:30] ERROR: Exception handlers complete
10.51.231.60 Chef Client failed. 0 resources updated in 03 seconds
10.51.231.60 [2017-04-12T15:57:34+05:30] FATAL: Stacktrace dumped to /var/chef/c
ache/chef-stacktrace.out
10.51.231.60 [2017-04-12T15:57:34+05:30] FATAL: Please provide the contents of t
he stacktrace.out file if you file a bug report
10.51.231.60 [2017-04-12T15:57:34+05:30] ERROR: 401 "Unauthorized"
10.51.231.60 [2017-04-12T15:57:34+05:30] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)`
```

---

<div class="post-metadata">

**Author:** ![thommay](https://avatars.discourse-cdn.com/v4/letter/t/f08c70/32.png) [@thommay](https://discourse.chef.io/u/thommay)\
**Post date:** [April 12, 2017, 10:38am UTC](https://discourse.chef.io/t/chef-client-with-role-failing/10753/2 "2017-04-12T10:38:01Z")

</div>

have you rebuilt that node since the first time you registered it with the chef server?

---

<div class="post-metadata">

**Author:** ![akajain](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@akajain](https://discourse.chef.io/u/akajain)\
**Post date:** [April 12, 2017, 10:40am UTC](https://discourse.chef.io/t/chef-client-with-role-failing/10753/3 "2017-04-12T10:40:21Z")

</div>

No. I am trying to delete the node from chef server and bootstrap again now.

---

<div class="post-metadata">

**Author:** ![akajain](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@akajain](https://discourse.chef.io/u/akajain)\
**Post date:** [April 12, 2017, 10:44am UTC](https://discourse.chef.io/t/chef-client-with-role-failing/10753/4 "2017-04-12T10:44:45Z")

</div>

Cleaning up and bootstrapping again fixed the issue. Any idea why did I face that issue? Why other knife commands were working fine including knife ssh with a recipe in run\_list?
