Operating System - HP-UX
1753765 Members
6107 Online
108799 Solutions
New Discussion юеВ

Re: /etc/passwd file busy -- try again

 
Ngoh Chean Siung
Super Advisor

/etc/passwd file busy -- try again

Hi,

Attemp to add a user using the useradd command and receive the error message :
/etc/passwd file busy -- try again

Above error message is occured when I try to add a new user.

Below is the solution proposed by HP engineer

The useradd command will be unable to add users if the file /etc/.pwd.lock is missing. Add the file using the following method:

1. touch /etc/.pwd.lock
2. chmod 400 /etc/.pwd.lock
3. chown root:sys /etc/.pwd.lock

Check to see if there is a file /etc/ptmp and rename it to something else or move it.
mv /etc/ptmp /tmp/ptmp

Check to see if the chfn process is running with the command:
ps -ef | grep chfn

chfn will lock the /etc/passwd file. If it is running, determine if it needs to be running and kill it if it does not.

Question:
1) What is .pwd.lock for? How can this file missing?

2) what is the ptmp file ? How it will relate to above problem?

regards
4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: /etc/passwd file busy -- try again

Having multiple users edit the /etc/passwd file at the same time is a disaster waiting to happen.

Any time a user runs the passwd command or is forced to, there is a brief but synconized edit on /etc/passwd or /etc/shadow if you shadow the the files in /tcb/files/auth if your system is trusted.

The most common cause of this problem is a vi or vipw session that was left open and terminated abnormally.

vipw is a tool specifically designed to prevent multple users from editing the /etc/passwd file at the same time.

Though this thread may answer your question:http://search.hp.com/redirect.html?url=http%3A//forums1.itrc.hp.com/service/forums/questionanswer.do%3FthreadId%3D728419&qt=/etc/.pwd.lock&hit=1

The thread does answer your questions.

I would recommend the following:

pwck
grpck
authck

Lets test the integrity of the passwd file.

Now the passwd file on 11.00 systems can be hit another way. If the root filesystem gets too full, I've seen the /etc/group and/or /etc/passwd file get reduced to zero bytes.

I've seen this behavior on well patched 11.00 systems. But not on 11i v1 and above systems.

Some food for thought.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sridhar Bhaskarla
Honored Contributor

Re: /etc/passwd file busy -- try again

Hi,

Both files are used to control access to /etc/passwd file as multiple commands can be run simultaneously (for ex., groupmod and passwd). For me it looks like different tools use different locking mechanisms or both as an additional level of scrutiny. For ex., lckpwdf and ulckpwdf manage .pwd.lock file. When you invoke 'vipw' to manually edit the password, it will make a copy of it to the temporary file 'ptmp' and makes modifications to it. Other commands will also do the same but if there is already an /etc/ptmp file, then they will fail. Crashed 'vipw' session can leave /etc/ptmp left and that can cause issues when the account administration commands are run.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Ngoh Chean Siung
Super Advisor

Re: /etc/passwd file busy -- try again

Hi Sri,

1) Can I manually execute lckpwdf and ulckpwdf? May I know what action that will invoke these 2 commands?

2) Any possible case that the .pwd.lock file is missing? Can I hv some example? Because my boss wants to know.

regards.
Sridhar Bhaskarla
Honored Contributor

Re: /etc/passwd file busy -- try again

Hi,

1. No. Those two are routines used by programs that modify /etc/passwd|group file. It works like a semaphore.

2. It's a simple file and files can get deleted. It could be by accident. It's difficult to mention why that file wouldn't exist there. If you used account related commands before, then most likely that file was removed by accident. Could be a patch issue that a command is not behaving as it is supposed to. Try to be up-to-date on patches.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try