I was attempting to install a package on Linux Mint using chef-solo when I was greeted by this rather strange error:
Thankfully the first result for the search term chef "override load_current_resource" is the bug CHEF-1152. This details a problem with Scientific Linux not being recognised as a derivative of Redhat Enterprise Linux.
As a result of this, Chef doesn’t know which providers should be used on that platform to install packages, start services, etc. The ticket also includes a patch which adds the relevant support to the file lib/chef/platform.rb
Now that we know what’s caused that error we have a better idea of what’s happening on Mint. A search for chef providers mint turns up bug CHEF-2697 which notes that it is due to be fixed in version 0.10.10. But what if we want to fix it now without modifying the Chef codebase?
The first step is to find out what Ohai thinks our platform is:
A search of Chef::Platform confirms that there are no references to linuxmint. There is an entry for Ubuntu from which Mint is derived. Now we could cheat and modify /etc/lsb-release, where that string comes from, to pretend that we are Ubuntu. But don’t do that, it is likely to cause more problems than it solves.
Chef::Platform gives us two helpful methods set() and find_provider(). These can be used to register Mint in the same way as Ubuntu. We loop over the four resource types in question, looking up the default value for Ubuntu and setting the default for Mint.
I’m only using chef-solo so I’ve placed this in my solo.rb. However from my understanding this could also be done in client.rb, a library within a cookbook, or an attributes file. Hopefully that should get you going until 0.10.10 rolls around.