LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   File Locked (https://www.linuxquestions.org/questions/linux-newbie-8/file-locked-438345/)

smight 04-24-2006 09: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..

Thanks!

Smight

EchoWarrior 04-24-2006 10:05 AM

I think a reboot could help :)

reddazz 04-24-2006 10:06 AM

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

smight 04-24-2006 10:11 AM

Vi
 
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..

Thanks

Smight

EchoWarrior 04-24-2006 10: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 10:25 AM

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

smight 04-24-2006 10:25 AM

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

Smight

reddazz 04-24-2006 10: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 10: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 11:30 AM

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?

Thanks!!
Smight

reddazz 04-24-2006 11:16 PM

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 03:54 AM.