Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

knife ssh isn't finding my nodes. I know it should be able to because when I can search for them I find them

# knife search node name:*
2 items found

Node Name:   web_01

Node Name:   admin

However, when I run knife ssh (I'll show it with the 'debug' flag) I get

# knife ssh "node:*" "uptime" -VV
DEBUG: Using configuration from /root/.chef/knife.rb
DEBUG: Signing the request as dev
DEBUG: Sending HTTP Request via GET to
FATAL: No nodes returned from search!

(yes the host is correct, I just censored it for the post).

I've tried modifying the QUERY parameter and always get the same results. I've tried:

  • node:*
  • role:*
  • *
  • *:*

Any ideas?

share|improve this question
up vote 15 down vote accepted

I figured it out. my nodes did not have an fqdn. I had to specify -a ipaddress. the error message was not helpful. I figured it out by debugging knife ssh code. there is also a bug that it does not read the attribute from the knife config file. I'm going to open up a ticket about the issue and perhaps submit a patch.

What I did to get past this was put the hostname of the chef node in my /etc/hosts file with a pointer to the IP address. For example:

You could, of course, always put it into a DNS server as well, along with the rest of your nodes. That would completely solve the problem.

share|improve this answer
To clarify for other readers, "-a ipaddress" is literal. It apparently tells knife ssh to connect by IP not FQDN. This behaviour is dumb - it should fallback this way by default. – Steve Bennett Jul 19 '12 at 2:24
@SteveBennett I agree that it should be default behavior. I see how my post can be confusing. Thanks for clarifying. – Max Jul 19 '12 at 5:55

Also, if -a ipaddress doesn't work, try -a cloud.public_ipv4

I was shown this solution after figuring out that knife ssh was trying to use internal IP addresses for my nodes and it took some asking in the chef IRC channel (#chef on before someone named retr0h showed me this.

share|improve this answer
amazing, thank you! @all if you're running ec2, and your instances have been created with public IP, but hostname is pointed to local one, use the following: knife ssh 'name:mydc1*' interactive -a node.node_name – Ilja Feb 12 at 14:25

Try knife ssh "id:*" "uptime".

Remember that knife ssh essentially does a knife search node, so your query should be one that works on knife search node (i.e., knife search node "node:*" doesn't work). knife ssh "role:*" should also work, but only if your nodes have roles assigned to them. For that matter, your original knife search node "name:*" should also work once you repurpose the query for knife ssh. So, knife ssh "name:*" "uptime".

share|improve this answer
Thanks for the reply, but I bet "No nodes" for both id:* and name:* – Max Jan 4 '12 at 12:42
OK, that's bizarre (i.e., it works for me). I've occasionally had to kick chef-solr to get new objects to show up in search, but, if you're getting results from "knife search node", you should be getting the same node list being used by "knife ssh". I don't know where to look next if the results list are different. – cjc Jan 4 '12 at 12:49

Have you ever tried knife ssh "name:*" "uptime"?

I'm using chef 10.x and it works for me.

In my opinion, when using knife search [INDEX] [QUERY], the first parameter INDEX is used to specify type of the item to be queried. While using knife ssh command, it knows that you are tryting to search nodes, so all you have to do is specify the [QUERY] part, which is name:* in your case.

share|improve this answer
I thinks @cjc 's answer means the same. – ley Jan 3 '13 at 7:57

I solved this by using ssh/config and connecting by the fqdn.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.