# Problem when starting and stoping chef-client as init service

**URL:** <https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461>\
**Category:** Chef Infra (archive)\
**Created:** [July 13, 2010, 10:58am UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461 "2010-07-13T10:58:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacobo\_Garcia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jacobo_garcia/32/533_2.png) [@Jacobo\_Garcia](https://discourse.chef.io/u/Jacobo_Garcia)\
**Post date:** [July 13, 2010, 10:58am UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461/1 "2010-07-13T10:58:16Z")

</div>

Hi chefs,

I’m having a problem when using chef debian init scripts. The  
screenshot attached explains it better. The problem is that chef init  
script does not behave consistently; It does not stop chef-client when  
you try it but returns success, you have to manually kill chef-client.  
It returns fail when starting it but the client is started.

I’ve seen this behavior at least on 0.8.16 and 0.9.0 also on both  
ubuntu 8.04 and 10.04.

Is it a bug on the script?, does anyone know about this problem?.

Thanks in advance.

Jacobo García López de Araujo  
blog: [http://robotplaysguitar.com](http://robotplaysguitar.com)  
[http://workingwithrails.com/person/13395-jacobo-garc-a](http://workingwithrails.com/person/13395-jacobo-garc-a)

---

<div class="post-metadata">

**Author:** ![Albert\_Llop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/albert_llop/32/885_2.png) [@Albert\_Llop](https://discourse.chef.io/u/Albert_Llop)\
**Post date:** [July 13, 2010, 11:07am UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461/2 "2010-07-13T11:07:39Z")

</div>

Hola Jacobo!  
Check the pidfile variable in /etc/init.d/chef-client and see if it's the  
same than in /etc/chef/client.rb. Otherwise when starting the client it will  
create the pidfile where specified in the /etc/chef/client.rb configuration,  
but will try to stop it checking the pidfile specified in the init.d one.

## 😃 hope it helps

{ :name =\> "Albert Llop" }

On 13 July 2010 12:58, Jacobo García [jacobo.garcia@gmail.com](mailto:jacobo.garcia@gmail.com) wrote:

> Hi chefs,
> 
> I'm having a problem when using chef debian init scripts. The  
> screenshot attached explains it better. The problem is that chef init  
> script does not behave consistently; It does not stop chef-client when  
> you try it but returns success, you have to manually kill chef-client.  
> It returns fail when starting it but the client is started.
> 
> I've seen this behavior at least on 0.8.16 and 0.9.0 also on both  
> ubuntu 8.04 and 10.04.
> 
> Is it a bug on the script?, does anyone know about this problem?.
> 
> Thanks in advance.
> 
> Jacobo García López de Araujo  
> blog: [http://robotplaysguitar.com](http://robotplaysguitar.com)  
> [NameBright - Coming Soon](http://workingwithrails.com/person/13395-jacobo-garc-a)

---

<div class="post-metadata">

**Author:** ![Jacobo\_Garcia](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jacobo_garcia/32/533_2.png) [@Jacobo\_Garcia](https://discourse.chef.io/u/Jacobo_Garcia)\
**Post date:** [July 13, 2010, 2:27pm UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461/3 "2010-07-13T14:27:46Z")

</div>

That worked fine.

Thanks!

Jacobo García López de Araujo  
blog: [http://robotplaysguitar.com](http://robotplaysguitar.com)  
[http://workingwithrails.com/person/13395-jacobo-garc-a](http://workingwithrails.com/person/13395-jacobo-garc-a)

On Tue, Jul 13, 2010 at 1:07 PM, Albert Llop [mrsimo@gmail.com](mailto:mrsimo@gmail.com) wrote:

> Hola Jacobo!  
> Check the pidfile variable in /etc/init.d/chef-client and see if it's the  
> same than in /etc/chef/client.rb. Otherwise when starting the client it will  
> create the pidfile where specified in the /etc/chef/client.rb configuration,  
> but will try to stop it checking the pidfile specified in the init.d one.
> 
> ## 😃 hope it helps
> 
> { :name =\> "Albert Llop" }
> 
> On 13 July 2010 12:58, Jacobo García [jacobo.garcia@gmail.com](mailto:jacobo.garcia@gmail.com) wrote:
> 
> > Hi chefs,
> > 
> > I'm having a problem when using chef debian init scripts. The  
> > screenshot attached explains it better. The problem is that chef init  
> > script does not behave consistently; It does not stop chef-client when  
> > you try it but returns success, you have to manually kill chef-client.  
> > It returns fail when starting it but the client is started.
> > 
> > I've seen this behavior at least on 0.8.16 and 0.9.0 also on both  
> > ubuntu 8.04 and 10.04.
> > 
> > Is it a bug on the script?, does anyone know about this problem?.
> > 
> > Thanks in advance.
> > 
> > Jacobo García López de Araujo  
> > blog: [http://robotplaysguitar.com](http://robotplaysguitar.com)  
> > [http://workingwithrails.com/person/13395-jacobo-garc-a](http://workingwithrails.com/person/13395-jacobo-garc-a)

---

<div class="post-metadata">

**Author:** ![Albert\_Llop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/albert_llop/32/885_2.png) [@Albert\_Llop](https://discourse.chef.io/u/Albert_Llop)\
**Post date:** [July 13, 2010, 2:38pm UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461/4 "2010-07-13T14:38:14Z")

</div>

## Awesome!

{ :name =\> "Albert Llop" }

On 13 July 2010 16:27, Jacobo García [jacobo.garcia@gmail.com](mailto:jacobo.garcia@gmail.com) wrote:

> That worked fine.
> 
> Thanks!
> 
> Jacobo García López de Araujo  
> blog: [http://robotplaysguitar.com](http://robotplaysguitar.com)  
> [NameBright - Coming Soon](http://workingwithrails.com/person/13395-jacobo-garc-a)
> 
> On Tue, Jul 13, 2010 at 1:07 PM, Albert Llop [mrsimo@gmail.com](mailto:mrsimo@gmail.com) wrote:
> 
> > Hola Jacobo!  
> > Check the pidfile variable in /etc/init.d/chef-client and see if it's the  
> > same than in /etc/chef/client.rb. Otherwise when starting the client it  
> > will  
> > create the pidfile where specified in the /etc/chef/client.rb  
> > configuration,  
> > but will try to stop it checking the pidfile specified in the init.d one.
> > 
> > ## 😃 hope it helps
> > 
> > { :name =\> "Albert Llop" }
> > 
> > On 13 July 2010 12:58, Jacobo García [jacobo.garcia@gmail.com](mailto:jacobo.garcia@gmail.com) wrote:
> > 
> > > Hi chefs,
> > > 
> > > I'm having a problem when using chef debian init scripts. The  
> > > screenshot attached explains it better. The problem is that chef init  
> > > script does not behave consistently; It does not stop chef-client when  
> > > you try it but returns success, you have to manually kill chef-client.  
> > > It returns fail when starting it but the client is started.
> > > 
> > > I've seen this behavior at least on 0.8.16 and 0.9.0 also on both  
> > > ubuntu 8.04 and 10.04.
> > > 
> > > Is it a bug on the script?, does anyone know about this problem?.
> > > 
> > > Thanks in advance.
> > > 
> > > Jacobo García López de Araujo  
> > > blog: [http://robotplaysguitar.com](http://robotplaysguitar.com)  
> > > [NameBright - Coming Soon](http://workingwithrails.com/person/13395-jacobo-garc-a)

---

<div class="post-metadata">

**Author:** ![Marcus\_Bointon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/marcus_bointon/32/896_2.png) [@Marcus\_Bointon](https://discourse.chef.io/u/Marcus_Bointon)\
**Post date:** [July 13, 2010, 2:49pm UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461/5 "2010-07-13T14:49:38Z")

</div>

On 13 Jul 2010, at 16:27, Jacobo García wrote:

> On Tue, Jul 13, 2010 at 1:07 PM, Albert Llop [mrsimo@gmail.com](mailto:mrsimo@gmail.com) wrote:
> 
> > Hola Jacobo!  
> > Check the pidfile variable in /etc/init.d/chef-client and see if it's the  
> > same than in /etc/chef/client.rb. Otherwise when starting the client it will  
> > create the pidfile where specified in the /etc/chef/client.rb configuration,  
> > but will try to stop it checking the pidfile specified in the init.d one.

I'm seeing the same thing, but in my vanilla install of chef 0.96 on lucid, /etc/chef/client.rb is empty.

## Marcus

Marcus Bointon  
Synchromedia Limited: Creators of [http://www.smartmessages.net/](http://www.smartmessages.net/)  
UK resellers of info@hand CRM solutions  
[marcus@synchromedia.co.uk](mailto:marcus@synchromedia.co.uk) | [http://www.synchromedia.co.uk/](http://www.synchromedia.co.uk/)

---

<div class="post-metadata">

**Author:** ![Albert\_Llop](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/albert_llop/32/885_2.png) [@Albert\_Llop](https://discourse.chef.io/u/Albert_Llop)\
**Post date:** [July 13, 2010, 3:30pm UTC](https://discourse.chef.io/t/problem-when-starting-and-stoping-chef-client-as-init-service/1461/6 "2010-07-13T15:30:14Z")

</div>

Well then, I guess it uses the defaults? It must use /srv/chef/run or  
something like that, so you should modify the scripts in /etc/init.d. But I  
didn't know you could even have chef-client working without a config file so  
no idea.

## Goodluck!

{ :name =\> "Albert Llop" }

On 13 July 2010 16:49, Marcus Bointon [marcus@synchromedia.co.uk](mailto:marcus@synchromedia.co.uk) wrote:

> On 13 Jul 2010, at 16:27, Jacobo García wrote:
> 
> > On Tue, Jul 13, 2010 at 1:07 PM, Albert Llop [mrsimo@gmail.com](mailto:mrsimo@gmail.com) wrote:
> > 
> > > Hola Jacobo!  
> > > Check the pidfile variable in /etc/init.d/chef-client and see if it's  
> > > the  
> > > same than in /etc/chef/client.rb. Otherwise when starting the client it  
> > > will  
> > > create the pidfile where specified in the /etc/chef/client.rb  
> > > configuration,  
> > > but will try to stop it checking the pidfile specified in the init.d  
> > > one.
> 
> I'm seeing the same thing, but in my vanilla install of chef 0.96 on lucid,  
> /etc/chef/client.rb is empty.
> 
> ## Marcus
> 
> Marcus Bointon  
> Synchromedia Limited: Creators of [http://www.smartmessages.net/](http://www.smartmessages.net/)  
> UK resellers of info@hand CRM solutions  
> [marcus@synchromedia.co.uk](mailto:marcus@synchromedia.co.uk) | [http://www.synchromedia.co.uk/](http://www.synchromedia.co.uk/)
