# Chef-client first-run restorecon error

**URL:** <https://discourse.chef.io/t/chef-client-first-run-restorecon-error/4769>\
**Category:** Chef Infra (archive)\
**Created:** [November 6, 2013, 3:21pm UTC](https://discourse.chef.io/t/chef-client-first-run-restorecon-error/4769 "2013-11-06T15:21:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rechler\_Mark](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Rechler\_Mark](https://discourse.chef.io/u/Rechler_Mark)\
**Post date:** [November 6, 2013, 3:21pm UTC](https://discourse.chef.io/t/chef-client-first-run-restorecon-error/4769/1 "2013-11-06T15:21:04Z")

</div>

Hi All,

With the newer version of Chef, we’re experiencing an odd error where the first run of chef-client (which is done during kickstart) dies when trying to render out the resolv.conf template:

Error executing action `create` on resource 'template[/etc/resolv.conf]  
Mixlib::ShellOut::ShellCommandFailed^[[0m  
------------------------------------^[[0m  
Expected process to exit with [0], but received ‘1’  
---- Begin output of /sbin/restorecon -R /etc/resolv.conf ----  
STDOUT:  
STDERR: No such file or directory  
---- End output of /sbin/restorecon -R /etc/resolv.conf ----  
Ran /sbin/restorecon -R /etc/resolv.conf returned 1^[[0m

The odd thing is selinux is disabled so it should not even be attempting a restorecon. The escape characters are somewhat concerning too.

Thanks in advance!  
Mark

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [November 6, 2013, 3:27pm UTC](https://discourse.chef.io/t/chef-client-first-run-restorecon-error/4769/2 "2013-11-06T15:27:15Z")

</div>

On Wednesday, November 6, 2013 at 7:21 AM, Rechler, Mark wrote:

> Hi All,
> 
> With the newer version of Chef, we're experiencing an odd error where the first run of chef-client (which is done during kickstart) dies when trying to render out the resolv.conf template:
> 
> Error executing action `create` on resource 'template[/etc/resolv.conf]  
> Mixlib::ShellOut::ShellCommandFailed^[[0m  
> ------------------------------------^[[0m  
> Expected process to exit with [0], but received '1'  
> ---- Begin output of /sbin/restorecon -R /etc/resolv.conf ----  
> STDOUT:  
> STDERR: No such file or directory  
> ---- End output of /sbin/restorecon -R /etc/resolv.conf ----  
> Ran /sbin/restorecon -R /etc/resolv.conf returned 1^[[0m
> 
> The odd thing is selinux is disabled so it should not even be attempting a restorecon. The escape characters are somewhat concerning too.
> 
> Thanks in advance!  
> Mark

Chef runs `selinuxenabled` and checks the return code to determine if selinux is enabled. Do you know of a reason why this command could return 0 if selinux is actually disabled?

Code: [chef/lib/chef/util/selinux.rb at main · chef/chef · GitHub](https://github.com/opscode/chef/blob/master/lib/chef/util/selinux.rb)

--  
Daniel DeLeo

---

<div class="post-metadata">

**Author:** ![Rechler\_Mark](https://avatars.discourse-cdn.com/v4/letter/r/ecc23a/32.png) [@Rechler\_Mark](https://discourse.chef.io/u/Rechler_Mark)\
**Post date:** [November 6, 2013, 4:38pm UTC](https://discourse.chef.io/t/chef-client-first-run-restorecon-error/4769/3 "2013-11-06T16:38:08Z")

</div>

Thanks for the help Daniel! selinuxenabled was returning 0. Turned out to be this bug:  
[http://serverfault.com/questions/340679/centos-6-kickstart-ignoring-selinux-disabled](http://serverfault.com/questions/340679/centos-6-kickstart-ignoring-selinux-disabled)

Setting a kernel option for selinux=0 made everything run correctly.

Thanks again,  
Mark

* * *

From: Daniel DeLeo [ddeleo@kallistec.com] on behalf of Daniel DeLeo [dan@kallistec.com]  
Sent: Wednesday, November 06, 2013 10:27 AM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: chef-client first-run restorecon error

On Wednesday, November 6, 2013 at 7:21 AM, Rechler, Mark wrote:

Hi All,

With the newer version of Chef, we’re experiencing an odd error where the first run of chef-client (which is done during kickstart) dies when trying to render out the resolv.conf template:  
Error executing action `create` on resource 'template[/etc/resolv.conf]  
Mixlib::ShellOut::ShellCommandFailed^[[0m  
------------------------------------^[[0m  
Expected process to exit with [0], but received ‘1’  
---- Begin output of /sbin/restorecon -R /etc/resolv.conf ----  
STDOUT:  
STDERR: No such file or directory  
---- End output of /sbin/restorecon -R /etc/resolv.conf ----  
Ran /sbin/restorecon -R /etc/resolv.conf returned 1^[[0m

The odd thing is selinux is disabled so it should not even be attempting a restorecon. The escape characters are somewhat concerning too.

Thanks in advance!  
Mark  
Chef runs `selinuxenabled` and checks the return code to determine if selinux is enabled. Do you know of a reason why this command could return 0 if selinux is actually disabled?

Code: [https://github.com/opscode/chef/blob/master/lib/chef/util/selinux.rb](https://github.com/opscode/chef/blob/master/lib/chef/util/selinux.rb)

–  
Daniel DeLeo
