-   Linux - Newbie (
-   -   File Locked (

smight 04-24-2006 10:51 AM

File Locked
I was trying to modify my hosts file and lost my connection. Since regaining my connection I am getting an edit: error: the file is already locked by another user//hosts root /dev/ttyp51

I've never encountered this before and wanted to know what command would clear this..



EchoWarrior 04-24-2006 11:05 AM

I think a reboot could help :)

reddazz 04-24-2006 11:06 AM

Does the problem happen when you try to edit the file? What editor are you using?

smight 04-24-2006 11:11 AM

I am using VI..

vi hosts
edit: error: the file etc.. etc..

Hope this helps.. I would assume there would be a simple command to release this. A reboot sounds painful..



EchoWarrior 04-24-2006 11:19 AM

If you lost your connection, I think the machine still "thinks" you are still logged in.
Maybe there is a timeout or something when it understands you aren't logged in anymore.

I think thats the problem.

Agrouf 04-24-2006 11:25 AM

what does 'ps aux' report?
Try killing the other vi.
Show no mercy with that process.

smight 04-24-2006 11:25 AM

Terminating that remote terminal fixed the issue.. Thanks for the help..


reddazz 04-24-2006 11:26 AM

If there is a vi process already running, try killing that. Also you could try removing the *.swp file that vi creates when you are editing a file.

smight 04-24-2006 11:33 AM

Just for future reference where is that .swp file contained and by what process ( command ) would I remove it?

smight 04-24-2006 12:30 PM

alrighty.. Apparently that did not work.. I am still unable to unlock this file and edit it. I can view it but it is read only, which does me absolutely no good..

#vi hosts
New file: hosts
edit: error: the file is already locked by another user
//hosts root /dev/ttyp51 04/24/06,09:24:34

ps -aux root shows no VI process running

there is vhand however and it has an unassigned ttyp

Would it be safe to assume if the connection is lost and the ttyp is cleared that this pid I am searching for will most likely not have an associated ttyp number?


reddazz 04-25-2006 12:16 AM

In vi, you can write to a file even if its read only by using w!. Have you tried using a different editor?

All times are GMT -5. The time now is 06:55 AM.