Chef Error message (Please Help)

Hi Everyone,

I am getting a following error on my Chef server. Please advise.

ubuntu@ip-172-31-44-218:~$ knife client list
ERROR: CONFIGURATION ERROR:chef-admin-server is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://.

What's the output of:

$ grep url ~/.chef/config.rb

It should look something like:

chef_server_url "https://server.example.com:443/organizations/my_org"

Also, what's the output of:

$ knife client list -VVV

The "-VVV" will show the REST HTTP headers and extra detail. You probably just need to fix the "chef_server_url" in your ~/.chef/config.rb file.

Hi There,

Here is the output. Please help.

ubuntu@ip-172-31-44-218:~$ grep url ~/.chef/config.rb
grep: /home/ubuntu/.chef/config.rb: No such file or directory
ubuntu@ip-172-31-44-218:~$ knife client list -VVV
ERROR: CONFIGURATION ERROR:chef-admin-server is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://.
ubuntu@ip-172-31-44-218:~$

Do you have any files in ~/.chef/ ?

What is the output of:

$ ls ~/.chef/

Here is the documentation for how to let "knife" know where your chef server is located:

These are the minimum entries you need in there (client_key, node_name, chef_server_url) to do a command like "knife client list".

$ awk '{print $1}' ~/.chef/config.rb
client_key
node_name
chef_server_url

Also, what host are you running the knife command on? Your chef workstation (eg, laptop), a chef node, or something else? If you are running it from your chef workstation, then your "node_name" is your username as it exists on the chef server. If you are running on a chef node, then you can run via sudo or root, and use the node config and authorization (via /etc/chef/client.rb)

How do I fix this error

ERROR: CONFIGURATION ERROR:chef-admin-server is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://.

If you are on a chef managed node (that runs chef-client), then you can run using root or sudo:

sudo knife client list

(Because it will find the chef_server_url config setting in the /etc/chef/client.rb file)

If you are on your chef workstation (your laptop/desktop or node where you manage cookbook files, etc), then you
need to create a ~/.chef/config.rb config file with your chef username, client key, and chef server URL.

Alternatively, you can specify all the config options on the command line when running the knife command.

Eg, "knife --help" shows that you can pass the chef server URL via the "--server-url URL" option.

Do you know, or have, your chef server URL (including the org name)?

Hi Karl,

I only have one server which I am configuring for data dog agents deployments. I am still getting this error

ubuntu@ip-172-31-44-218:~$ sudo knife client list
ERROR: CONFIGURATION ERROR:[https://ip-172-31-44-218.us-east-2.compute.internal/organizations/prod] is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://.

Normally you wouldn't run knife on the chef-server itself. you would want to install chef-workstation on your laptop, From that point you would want to do the following,

  • make sure you have configured a user and an organization on the chef-server
  • make sure that user has to correct rights
  • download the pem file you created for the user to your workstation
  • create a chef-repo containing a .chef folder which will contain your config.rb and pem file

Please look at the following docs and make sure you've followed all the correct steps. Normally your chef server wouldn't appear as a chef-client when doing a knife client list as you wouldn't usually bootstrap it.

install infra server
install workstation
configure workstation

Hi Sam,

I have setup a Chef server and I am getting this error when run any command. Please advise how to fix it. Much appreciate your help.

ubuntu@ip-172-31-44-218:~$ knife cookbook upload datadog
ERROR: CONFIGURATION ERROR:chef-admin-server is an invalid chef_server_url. The URL must start with http://, https://, or chefzero://.