# Group resource not creating the group

**URL:** <https://discourse.chef.io/t/group-resource-not-creating-the-group/2609>\
**Category:** Chef Infra (archive)\
**Created:** [March 1, 2012, 6:18pm UTC](https://discourse.chef.io/t/group-resource-not-creating-the-group/2609 "2012-03-01T18:18:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [March 1, 2012, 6:18pm UTC](https://discourse.chef.io/t/group-resource-not-creating-the-group/2609/1 "2012-03-01T18:18:14Z")

</div>

Does anyone know why the group resource would not create the group.  
The error keeps coming back saying groupmod cannot find the group. I  
would have thought that it would have used groupadd.

Here is the snippet from the recipe…

group “abc123” do

gid 405

action :create

end

error -\> line 55) had an error: Chef::Exceptions::Exec: groupmod  
userroot returned 10, expected 0

Error 10 says group does not exist, well I am trying to create it.  
What am I doing wrong.??

Randy

---

<div class="post-metadata">

**Author:** ![Peter\_Norton](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Norton](https://discourse.chef.io/u/Peter_Norton)\
**Post date:** [March 1, 2012, 6:31pm UTC](https://discourse.chef.io/t/group-resource-not-creating-the-group/2609/2 "2012-03-01T18:31:05Z")

</div>

Do you have some directory services (e.g. openldap, NIS, AD) that already  
has this group created? If so and if your new node doesn't have admin  
rights, you're going to get this.

-Peter

On Thu, Mar 1, 2012 at 1:18 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org) wrote:

> Does anyone know why the group resource would not create the group. The  
> error keeps coming back saying groupmod cannot find the group. I would  
> have thought that it would have used groupadd.\*\*\*\*
> 
> * * *
> 
> Here is the snippet from the recipe..\*\*\*\*
> 
> group "abc123" do\*\*\*\*
> 
> gid 405\*\*\*\*
> 
> action :create\*\*\*\*
> 
> end\*\*\*\*
> 
> * * *
> 
> error -\> line 55) had an error: Chef::Exceptions::Exec: groupmod userroot  
> returned 10, expected 0 \*\*\*\*
> 
> * * *
> 
> Error 10 says group does not exist, well I am trying to create it. What  
> am I doing wrong.??\*\*\*\*
> 
> * * *
> 
> Randy\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Bryan\_Berry](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/bryan_berry/32/213_2.png) [@Bryan\_Berry](https://discourse.chef.io/u/Bryan_Berry)\
**Post date:** [March 1, 2012, 6:33pm UTC](https://discourse.chef.io/t/group-resource-not-creating-the-group/2609/3 "2012-03-01T18:33:11Z")

</div>

wherever possible i avoid hardcoding uid and gids for this reason

On Thu, Mar 1, 2012 at 7:31 PM, Peter Norton [pn+chef-list@knewton.com](mailto:pn+chef-list@knewton.com)wrote:

> Do you have some directory services (e.g. openldap, NIS, AD) that already  
> has this group created? If so and if your new node doesn't have admin  
> rights, you're going to get this.
> 
> -Peter
> 
> On Thu, Mar 1, 2012 at 1:18 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)wrote:
> 
> > Does anyone know why the group resource would not create the group. The  
> > error keeps coming back saying groupmod cannot find the group. I would  
> > have thought that it would have used groupadd.\*\*\*\*
> > 
> > * * *
> > 
> > Here is the snippet from the recipe..\*\*\*\*
> > 
> > group "abc123" do\*\*\*\*
> > 
> > gid 405\*\*\*\*
> > 
> > action :create\*\*\*\*
> > 
> > end\*\*\*\*
> > 
> > * * *
> > 
> > error -\> line 55) had an error: Chef::Exceptions::Exec: groupmod userroot  
> > returned 10, expected 0 \*\*\*\*
> > 
> > * * *
> > 
> > Error 10 says group does not exist, well I am trying to create it. What  
> > am I doing wrong.??\*\*\*\*
> > 
> > * * *
> > 
> > Randy\*\*\*\*

---

<div class="post-metadata">

**Author:** ![Van\_Fossan\_Randy](https://avatars.discourse-cdn.com/v4/letter/v/8797f3/32.png) [@Van\_Fossan\_Randy](https://discourse.chef.io/u/Van_Fossan_Randy)\
**Post date:** [March 1, 2012, 6:50pm UTC](https://discourse.chef.io/t/group-resource-not-creating-the-group/2609/4 "2012-03-01T18:50:28Z")

</div>

Turns out the same group exists in our ldap. The local group needs to  
be there at build time and in case of an ldap failure. I will have to  
bypass the chef group resource for now and mod the /etc/group file  
directory.

Note: this isn’t a failure in chef, just the way we have implemented  
some groups. L

Thanks

Randy

From: Peter Norton [[mailto:pn+chef-list@knewton.com](mailto:pn+chef-list@knewton.com)]  
Sent: Thursday, March 01, 2012 1:31 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: group resource not creating the group

Do you have some directory services (e.g. openldap, NIS, AD) that  
already has this group created? If so and if your new node doesn’t have  
admin rights, you’re going to get this.

-Peter

On Thu, Mar 1, 2012 at 1:18 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
wrote:

Does anyone know why the group resource would not create the group.  
The error keeps coming back saying groupmod cannot find the group. I  
would have thought that it would have used groupadd.

Here is the snippet from the recipe…

group “abc123” do

gid 405

action :create

end

error -\> line 55) had an error: Chef::Exceptions::Exec: groupmod  
userroot returned 10, expected 0

Error 10 says group does not exist, well I am trying to create it.  
What am I doing wrong.??

Randy

---

<div class="post-metadata">

**Author:** ![Peter\_Norton](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Peter\_Norton](https://discourse.chef.io/u/Peter_Norton)\
**Post date:** [March 1, 2012, 7:20pm UTC](https://discourse.chef.io/t/group-resource-not-creating-the-group/2609/5 "2012-03-01T19:20:49Z")

</div>

You can probably get around this with a not\_if clause, and keep the  
structure simple. This should let it only run if directory services aren't  
available. It could cause problems if the cookbook and the ldap server get  
out of sync if you use this a lot.

-Peter

On Thu, Mar 1, 2012 at 1:50 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org) wrote:

> Turns out the same group exists in our ldap. The local group needs to be  
> there at build time and in case of an ldap failure. I will have to  
> bypass the chef group resource for now and mod the /etc/group file  
> directory. \*\*\*\*
> 
> * * *
> 
> Note: this isn’t a failure in chef, just the way we have implemented some  
> groups. L\*\*\*\*
> 
> * * *
> 
> Thanks\*\*\*\*
> 
> Randy\*\*\*\*
> 
> * * *
> 
> _From:_ Peter Norton [[mailto:pn+chef-list@knewton.com](mailto:pn+chef-list@knewton.com)]  
> _Sent:_ Thursday, March 01, 2012 1:31 PM  
> _To:_ [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
> _Subject:_ [chef] Re: group resource not creating the group\*\*\*\*
> 
> * * *
> 
> Do you have some directory services (e.g. openldap, NIS, AD) that already  
> has this group created? If so and if your new node doesn't have admin  
> rights, you're going to get this.\*\*\*\*
> 
> * * *
> 
> -Peter\*\*\*\*
> 
> On Thu, Mar 1, 2012 at 1:18 PM, Van Fossan,Randy [vanfossr@oclc.org](mailto:vanfossr@oclc.org)  
> wrote:\*\*\*\*
> 
> Does anyone know why the group resource would not create the group. The  
> error keeps coming back saying groupmod cannot find the group. I would  
> have thought that it would have used groupadd.\*\*\*\*
> 
> * * *
> 
> Here is the snippet from the recipe..\*\*\*\*
> 
> group "abc123" do\*\*\*\*
> 
> gid 405\*\*\*\*
> 
> action :create\*\*\*\*
> 
> end\*\*\*\*
> 
> error -\> line 55) had an error: Chef::Exceptions::Exec: groupmod userroot  
> returned 10, expected 0 \*\*\*\*
> 
> * * *
> 
> Error 10 says group does not exist, well I am trying to create it. What  
> am I doing wrong.??\*\*\*\*
> 
> * * *
> 
> Randy\*\*\*\*
> 
> * * *
