LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2014, 09:05 AM   #16
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18

Can you find any error msg at syslog message?
Code:
cat /var/log/messages |grep -i error
cat /var/log/audit/audit.log |grep -i error
Find lock file
Code:
find /etc -name *.lock
find /etc -name *.swp
Let's make sure not holding by others
Code:
fuser /etc/passwd*
fuser /etc/shadow*
fuser /etc/gshadow*
After su to root, try uid
Code:
id
Can you try to achieve with GUI?
Code:
system-config-users

Last edited by myatthu; 02-07-2014 at 09:43 AM.
 
Old 02-07-2014, 11:20 AM   #17
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by myatthu View Post
Can you find any error msg at syslog message?
Code:
cat /var/log/messages |grep -i error
cat /var/log/audit/audit.log |grep -i error
...which will return LOTS of messages, most of which won't apply to the users current problem. And the audit.log file will only be there if auditing is enabled. Neither of these suggestions will give any real information as to the OP's problem.
Quote:
Find lock file
Code:
find /etc -name *.lock
find /etc -name *.swp
...which you've added to this post. Again, the find command you have for the lock files won't actually FIND anything, since they may be HIDDEN, and that was pointed out before you edited this post. And again, the .swp file will ALSO be hidden (so that find command won't work either), and again, does nothing to address the problem. If the passwd file is being edited with vi, that won't cause the problem they're seeing. And just doing a "ps -ef | grep vi" will tell them if anyone is using VI, and on what file.
Quote:
Let's make sure not holding by others
Code:
fuser /etc/passwd*
fuser /etc/shadow*
fuser /etc/gshadow*
...which you've also added to this post. And again, these commands won't help at all. It is the presence of the .lock file that is causing this. Those commands may return false positives (if run when someone is logging in).
Quote:
After su to root, try uid
Code:
id
..which will do what, exactly? If they su to root, then they'll be root.
Quote:
Can you try to achieve with GUI?
Code:
system-config-users
...which won't do any good, since it calls the same system functions that the CLI utility does, and will die with the same error.
 
Old 02-07-2014, 07:36 PM   #18
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Dear TBOne,
Both of us are trying to suggest sakshi.garg23 problem. Definitely, you are far senior and much more experience than me. I agree that my troubleshooting way may mislead to sakshi.garg23 sometime. But I didn't do it purposely. You keep referring my signature about RHCE. Yes I earn it humbly for this certificate. It signature doesn't mean I know everything about redhat linux. I still need to learn a lot and keep learning.
I will also learn from your suggestion and advice. That is why I join this community. My primary reason to join this community is to share my experience with community and discuss other people difficulty.
Let's try to solve sakshi.garg23 problem together.
 
Old 02-08-2014, 10:07 AM   #19
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by myatthu View Post
Dear TBOne,
Both of us are trying to suggest sakshi.garg23 problem. Definitely, you are far senior and much more experience than me. I agree that my troubleshooting way may mislead to sakshi.garg23 sometime. But I didn't do it purposely.
You are suggesting things that either:
Won't work at all
Or have NO bearing on the problem at all
All you are doing is confusing someone who needs help by posting bad and misleading advice. Things like the "mount" command, .swp files, and the 'find' commands that won't ever return anything(???) No point to any of it.
Quote:
You keep referring my signature about RHCE. Yes I earn it humbly for this certificate. It signature doesn't mean I know everything about redhat linux. I still need to learn a lot and keep learning.
If you claim to have certifications, you should have the KNOWLEDGE to back them up. The things you're suggesting indicate you don't. This is another great reason I give so little weight to 'certifications'.
Quote:
I will also learn from your suggestion and advice. That is why I join this community. My primary reason to join this community is to share my experience with community and discuss other people difficulty. Let's try to solve sakshi.garg23 problem together.
If you'd like to try to help with this problem, then stop posting meaningless and bad advice. What you learn and how is up to you. But posting bad and misleading advice that doesn't address the problems posted is POINTLESS, and only serves to confuse someone who is looking for help.
 
Old 02-09-2014, 03:23 AM   #20
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Dear TBOne,

Thank you for your advice. I will keep in your suggestions.
 
Old 02-10-2014, 03:44 AM   #21
sakshi.garg23
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
Thanks TB0ne for your response. I tried to ls -a /etc/*.lock but didn't get anything. Also did ps -ef |grep passwd but no process is running.

[root@hostname ~]# ls -a /etc/*.lock
ls: /etc/*.lock: No such file or directory
[root@hostname ~]# ps -ef|grep passwd
root 13703 13652 0 14:46 pts/1 00:00:00 grep passwd
[root@hostname ~]# ps -ef|grep passwd*
root 13705 13652 0 14:46 pts/1 00:00:00 grep passwd*
[root@hostname ~]# ps -ef|grep *passwd*
root 13707 13652 0 14:46 pts/1 00:00:00 grep *passwd*
 
Old 02-10-2014, 08:35 AM   #22
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sakshi.garg23 View Post
Thanks TB0ne for your response. I tried to ls -a /etc/*.lock but didn't get anything. Also did ps -ef |grep passwd but no process is running.

[root@hostname ~]# ls -a /etc/*.lock
ls: /etc/*.lock: No such file or directory
[root@hostname ~]# ps -ef|grep passwd
root 13703 13652 0 14:46 pts/1 00:00:00 grep passwd
[root@hostname ~]# ps -ef|grep passwd*
root 13705 13652 0 14:46 pts/1 00:00:00 grep passwd*
[root@hostname ~]# ps -ef|grep *passwd*
root 13707 13652 0 14:46 pts/1 00:00:00 grep *passwd*
Ok, but again, that may not return anything...please re-read the previous posts. The file may start with a period ("."), which makes it a hidden file. So, do an "ls -a /etc/.*.lock" instead.
 
Old 02-11-2014, 04:01 AM   #23
sakshi.garg23
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
I got a file after doing ls -a /etc/.*.lock, removed it, listed it ( was gone ), then tried to delete the user, but again got the error message. The file reappeared.

[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]# rm -f /etc/.pwd.lock
[root@hostname ~]# ls -a /etc/.*.lock
ls: /etc/.*.lock: No such file or directory
[root@hostname ~]# userdel -r nishant
userdel: unable to lock group file
[root@hostname ~]# ps -ef |grep passwd
root 16867 16817 0 14:48 pts/2 00:00:00 grep passwd
[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]#
 
Old 02-11-2014, 09:42 AM   #24
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sakshi.garg23 View Post
I got a file after doing ls -a /etc/.*.lock, removed it, listed it ( was gone ), then tried to delete the user, but again got the error message. The file reappeared.

[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]# rm -f /etc/.pwd.lock
[root@hostname ~]# ls -a /etc/.*.lock
ls: /etc/.*.lock: No such file or directory
[root@hostname ~]# userdel -r nishant
userdel: unable to lock group file
[root@hostname ~]# ps -ef |grep passwd
root 16867 16817 0 14:48 pts/2 00:00:00 grep passwd
[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]#
Well, at least the lock file has been found, but SOMETHING has to be creating it. Have there been any updates/patches to the system lately? Can you do an lsof on that file, to see what process(es) have it open?
 
Old 02-12-2014, 04:40 AM   #25
sakshi.garg23
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
lsof didn't give any output for the file

[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]# lsof |grep /etc/.pwd.lock
[root@hostname ~]#
 
Old 02-12-2014, 04:41 AM   #26
sakshi.garg23
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
And no patches/updates were done on the system.
 
Old 02-12-2014, 08:14 AM   #27
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by sakshi.garg23 View Post
lsof didn't give any output for the file

[root@hostname ~]# ls -a /etc/.*.lock
/etc/.pwd.lock
[root@hostname ~]# lsof |grep /etc/.pwd.lock
[root@hostname ~]#
No, you don't pipe lsof through grep...just run "lsof /etc/.pwd.lock". You want to know what process has THAT file open.

And are you using LDAP/NIS by any chance? Have you recently booted the system?
 
Old 02-12-2014, 08:59 AM   #28
ixion22600
LQ Newbie
 
Registered: Nov 2013
Posts: 23

Rep: Reputation: Disabled
this might help

http://goforunix.blogspot.ro/2008/12...word-file.html
 
Old 02-12-2014, 09:05 AM   #29
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,632

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by ixion22600 View Post
Right...except that the OP already said they DID remove the lock file, and it came back. See the previous posts.
 
Old 02-13-2014, 01:03 AM   #30
sakshi.garg23
LQ Newbie
 
Registered: Feb 2014
Posts: 12

Original Poster
Rep: Reputation: Disabled
i did lsof, but got nothing :

[root@hostname ~]# lsof /etc/.pwd.lock
[root@hostname ~]# uptime
12:00:15 up 65 days, 17:39, 1 user, load average: 0.03, 0.03, 0.04
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to edit PAM DB of VSFTPD (..add user, delete user, change user password ) jsaravana87 Linux - Server 1 10-02-2012 08:49 AM
groupadd: unable to lock group file?! macagent Linux - Newbie 6 07-08-2007 05:31 PM
useradd: unable to lock password file shivadk Linux - Networking 1 12-13-2005 02:20 AM
userdel: unable to lock password file asc3ndant Linux - General 1 06-20-2003 01:07 PM
unable to lock password file beefyd Linux - Security 3 09-08-2002 09:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration