HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=15)
-   -   Problems with groups/grpconv (http://www.howtoforge.com/forums/showthread.php?t=732)

linuxfast 2nd October 2005 12:56

Problems with groups/grpconv
 
Last night I decided to migrate all my users/sites to my ISPConfig server.
All appeared to be going well....

After adding maybe 10 sites and over 100 email accounts, I noticed a strange problem. Files that were usually owned by root root where now showing root 1
I looked at the /etc/group file and to my horror all my groups had disappeared and the only lines left in there where the last 5 groups added by ISPConfig.
I am uncertain why this happened but I am guessing it may be because my usernames had hyphens in them (-). Can anyone confirm that this may be true or is true ?

On further investigation, I found that each time I added/changed users in ISPConfig, a grpconv command was executed which ran at 100% cpu and 100% mem, and eventually was killed with an Out Of Memory message in the messages file.

After googling for a while, I found that grpconv can go into an endless loop until killed with an OOM.
I do not know whether the original corruption of /etc/group and /etc/gshadow was a result of the grpconv hanging or whether the grpconv hanging was a result of the corruption.
After manually fixing the group and gshadow files, I ran grpck which found some duplicate entries and some other small problems.
grpconv now executes fast and without problems.

One thing I do notice however, is that groups created by ISPConfig, for instance:

web1:x:10001:admispconfig,adminuser

When web1 has been deleted, this group remains and is not deleted. Is this normal or have I got another problem here ? If it IS normal, would it not be better for the group to be deleted also, once the web has been removed from the recycle bin ?

This brings me onto another issue..... after playing around with ISPConfig, and removing it and reinstalling it etc, ISPConfig seems to have no regard for already assigned UIDs. It seems to always start with 10001 regardless of whether this is already in use or not. :eek: .This causes immediate problems with /etc/passwd and /etc/group (and may have been the initial cause of my problems).
ISPConfig needs to check that UIDs are not in use before it decides to use them itself !!
My advice to anyone would be to make a backup of /etc/passwd /etc/shadow /etc/group and /etc/gshadow before installing ISPConfig just in case there are problems later, in fact after this experience I will be making backups of these 4 files on every server that I have.

Any comments Falko/Till ? My server seems to be running spot on now so I am happy again, but it's been a hell of a 24hrs

Edit:
If I add a new group manually for something, for instance:

groupadd testgroup

this group is assinged the next ID, which will be 1 higher than the last ispconfig site.
If you then add a new site in ISPConfig, it doesn't check for the next id, it just knows the last one it created itself so uses the same one that testgroup took.

falko 2nd October 2005 13:56

Quote:

I looked at the /etc/group file and to my horror all my groups had disappeared and the only lines left in there where the last 5 groups added by ISPConfig.
I am uncertain why this happened but I am guessing it may be because my usernames had hyphens in them (-). Can anyone confirm that this may be true or is true ?
Never heard of anything like that.

Quote:

When web1 has been deleted, this group remains and is not deleted. Is this normal or have I got another problem here ? If it IS normal, would it not be better for the group to be deleted also, once the web has been removed from the recycle bin ?
It should be deleted after you've deleted the web site also from the recycle bin.

Quote:

This brings me onto another issue..... after playing around with ISPConfig, and removing it and reinstalling it etc, ISPConfig seems to have no regard for already assigned UIDs. It seems to always start with 10001 regardless of whether this is already in use or not. .This causes immediate problems with /etc/passwd and /etc/group (and may have been the initial cause of my problems).
Therefore you can set the starting user id and group id under Management -> Server -> Settings -> Other. You have to go sure yourself that these ids do not interfere with others you use on the system.

linuxfast 2nd October 2005 14:07

Thanks for the reply


Quote:

Quote:
When web1 has been deleted, this group remains and is not deleted. Is this normal or have I got another problem here ? If it IS normal, would it not be better for the group to be deleted also, once the web has been removed from the recycle bin ?


It should be deleted after you've deleted the web site also from the recycle bin.
OK. Can you tell me where in the ISPConfig code this group deletion takes place so that I may find out why it is not working on my system ?


Quote:

Quote:
This brings me onto another issue..... after playing around with ISPConfig, and removing it and reinstalling it etc, ISPConfig seems to have no regard for already assigned UIDs. It seems to always start with 10001 regardless of whether this is already in use or not. .This causes immediate problems with /etc/passwd and /etc/group (and may have been the initial cause of my problems).



Therefore you can set the starting user id and group id under Management -> Server -> Settings -> Other. You have to go sure yourself that these ids do not interfere with others you use on the system.
Setting the starting user id and group id is all good and well, but if i do a manual groupadd for whatever reason, it will ALWAYS use the last used id + 1 and therefore the next group ISPConfig adds will be the same.
So basically, if this is not changed/fixed, the command groupadd can never be used by anyone or any application without specifying an id
Would it not make more sense for ISPConfig to check first ?

falko 2nd October 2005 14:15

Quote:

OK. Can you tell me where in the ISPConfig code this group deletion takes place so that I may find out why it is not working on my system ?
It's the function web_delete() in /root/ispconfig/scripts/lib/config.lib.php. But you can check the logfile first: /home/admispconfig/ispconfig/ispconfig.log.

Quote:

Setting the starting user id and group id is all good and well, but if i do a manual groupadd for whatever reason, it will ALWAYS use the last used id + 1 and therefore the next group ISPConfig adds will be the same.
So basically, if this is not changed/fixed, the command groupadd can never be used by anyone or any application without specifying an id
Would it not make more sense for ISPConfig to check first ?
See man groupadd. With groupadd -g gid group You can set the group id.

linuxfast 2nd October 2005 14:49

Quote:

It's the function web_delete() in /root/ispconfig/scripts/lib/config.lib.php. But you can check the logfile first: /home/admispconfig/ispconfig/ispconfig.log.
Ok the logfile looks fine, but it doesn't show creating/deleting users/groups.

im finding hard to understand the web_delete() function too, I can see where it backs up the website then removes it, and then backs up mysql and then deletes that, but I can't find exactly where it removes the group.
Can you help me further please ?

falko 2nd October 2005 14:57

Quote:

Originally Posted by linuxfast
Ok the logfile looks fine, but it doesn't show creating/deleting users/groups.

im finding hard to understand the web_delete() function too, I can see where it backs up the website then removes it, and then backs up mysql and then deletes that, but I can't find exactly where it removes the group.
Can you help me further please ?

I'm sorry, it's not web_delete(), it's in the function user_delete(). :o

linuxfast 2nd October 2005 15:06

Hehe OK

Well I am looking at this:

Code:

$mod->system->delgroup("web".$web_doc_id);
    //$mod->log->caselog("groupdel web$web_doc_id &> /dev/null", $this->FILE, __LINE__);

what is the commented out line ? If I uncomment, will this log the action in the log file ?

Ughhh my head is hurting now, is there any quick way that I can log all actions by the function wf() in ispconfig_file_lib.php using your logging class ?

This may help me find why groups are not being deleted :confused:

falko 2nd October 2005 19:45

Quote:

Originally Posted by linuxfast
Hehe OK

Well I am looking at this:

Code:

$mod->system->delgroup("web".$web_doc_id);
    //$mod->log->caselog("groupdel web$web_doc_id &> /dev/null", $this->FILE, __LINE__);

what is the commented out line ? If I uncomment, will this log the action in the log file ?

Ughhh my head is hurting now, is there any quick way that I can log all actions by the function wf() in ispconfig_file_lib.php using your logging class ?

This may help me find why groups are not being deleted :confused:

You could use
PHP Code:

$mod->log->caselog("groupdel web$web_doc_id &> /dev/null"$this->FILE__LINE__); 

and comment out the other line.
That should log the action into the log file.
There's no quick way for logging every action. You'd have to add the code for logging to every single action manually...

linuxfast 2nd October 2005 22:31

OK Cool
Thanks Falko, will give it a try

Pramod Venugopal 22nd December 2005 21:27

I have experienced the group deletion as well. All except the groups of the 3 last users I edited were deleted.

Thankfully I keep backups of /etc/group, /etc/gshadow etc so restoration was not a big problem. But this issue is scary.


All times are GMT +2. The time now is 02:36.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.