How Do You Troubleshoot a Chef Client That Has the Results of “knife client list” as “404 not found”?

Problem scenario
You set up Chef server and Chef client on Linux servers.  On the Chef client server you run this command:

knife client list

You get this as the output:

ERROR: The object you are looking for could not be found
Response: <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <title>Chef - 404 Not Found</title>
  <link media="all" rel="stylesheet" type="text/css" href="/css/all.css" />
  <!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="/css/lt7.css" /><![endif]-->
</head>
<body>
  <div class="header-block">
    <div id="header">
      <strong class="logo"><a href="https://www.chef.io">Chef</a></strong>
    </div>
  </div>
  <div id="wrapper">
    <div id="main">
      <div class="mybox">
        <div id="content">
          <h1>404 - Not Found</h1>
          <p>Sorry, I can't find what you are looking for.</p>
        </div>
      </div>
    </div>
  </div>
  <div class="footer-block">
    <div id="footer">
      <div class="mybox">
      </div>
      <div class="footer-bottom">
        <span>&copy; 2010&thinsp;&ndash;&thinsp;2017 Chef Software, Inc. All Rights Reserved</span>
      </div>
    </div>
  </div>
</body>
</html>

What do you do?

Solution
Find knife.rb.   (Use "sudo find / -name knife.rb".)   In this file find the "chef_server_url".

Verify the end of the URL has "/organizations/nameOfOrganization" (with no quotes where "nameOfOrganization" is the name of your organization as configured on the Chef server).  Some directions (or instructions) on different websites do not make it clear that the URL must have this last part, with the FQDN of the Chef server as the first part.

If the URL does not have "/organizations/nameOfOrganization", the above error may occur when running "knife client list". If this posting has not helped you, you may also want to see this posting.

Leave a comment

Your email address will not be published.