[comp.unix.wizards] /etc/passwd file is busy, help.

pdwalker@bcarh667.bnr.ca (07/18/90)

I am having a problem with my /etc/passwd file.  Whenever I try to 'vipw' or
use 'passwd' I get the following message:
	Temporary file busy; try again later.	(with passwd)
	vipw: password file busy		(with vipw)

I am guessing that at sometime in the past, the file was locked to prevent
filesharing, but the process died leaving the file in the locked state.	

Does anyone know how I can unlock the file?  It is getting to be a little
irritating.

Please respond by email, as I am not a regular reader of these news groups.

Thanks in advance.

Paul D. Walker					(613)765-2590
Bell Northern Research			Bitnet: pdwalker@bnr.ca
Ottawa, Ontario.			Usenet: uunet!bnrgate!bcarh667!pdwa

kseshadr@quasar.intel.com (Kishore Seshadri) (07/20/90)

In article <3242@bnr-rsc.UUCP>, pdwalker@bcarh667 writes:
>I am having a problem with my /etc/passwd file.  Whenever I try to 'vipw' or
>use 'passwd' I get the following message:
>	Temporary file busy; try again later.	(with passwd)
>	vipw: password file busy		(with vipw)
>
>I am guessing that at sometime in the past, the file was locked to prevent
>filesharing, but the process died leaving the file in the locked state.	
I'm not sure what U*IX you're using, but the ones I've seen usually create
an intermediate file called /etc/ptmp. On Ultrix and some other systems,
vipw tries to open the /etc/ptmp with the O_EXCL|O_CREAT flags. If the open
gets an EEXIST error, it prints the busy message and quits. You can fix
this by deleting the /etc/ptmp file. You should probably do a diff on
/etc/ptmp and /etc/passwd before blowing away /etc/ptmp and see what has
been changed. On SunOS, vipw opens the passwd file and tries to get an
exclusive lock using flock. If the file is locked, you should look for
a vipw process still running and kill it (think twice before you do this).
This should free the lock.

>
>Does anyone know how I can unlock the file?  It is getting to be a little
>irritating.
In the first place you shouldn't normally be killing vipw leaving the ptmp
file in place. Nor should you stay in vipw longer than necessary. Anyway,
as a last resort, you should be able to edit the file using vi.

Kishore Seshadri
kishore@mipos3.intel.com
===============================================================================
Kishore Seshadri (Speaking only for myself) Intel Corp., Santa Clara, CA
CSNET: kseshadr@mipos3.intel.com ARPA: kseshadr%mipos3.intel.com@relay.cs.net
UUCP:{amdcad,decwrl,hplabs,oliveb,pur-ee,qantel}!intelca!mipos3!kseshadr