LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-24-2006, 09:51 AM   #1
smight
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Rep: Reputation: 0
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
 
Old 04-24-2006, 10:05 AM   #2
EchoWarrior
Member
 
Registered: Aug 2005
Location: Finland
Distribution: Gentoo 2006.0, Debian 3.1r0
Posts: 60

Rep: Reputation: 15
I think a reboot could help
 
Old 04-24-2006, 10:06 AM   #3
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Does the problem happen when you try to edit the file? What editor are you using?
 
Old 04-24-2006, 10:11 AM   #4
smight
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 04-24-2006, 10:19 AM   #5
EchoWarrior
Member
 
Registered: Aug 2005
Location: Finland
Distribution: Gentoo 2006.0, Debian 3.1r0
Posts: 60

Rep: Reputation: 15
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.
 
Old 04-24-2006, 10:25 AM   #6
Agrouf
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: LFS
Posts: 1,591

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

Last edited by Agrouf; 04-24-2006 at 10:29 AM.
 
Old 04-24-2006, 10:25 AM   #7
smight
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Solution

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

Smight
 
Old 04-24-2006, 10:26 AM   #8
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
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.
 
Old 04-24-2006, 10:33 AM   #9
smight
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
Just for future reference where is that .swp file contained and by what process ( command ) would I remove it?
 
Old 04-24-2006, 11:30 AM   #10
smight
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Original Poster
Rep: Reputation: 0
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
 
Old 04-24-2006, 11:16 PM   #11
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

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


Reply

Tags
file, locked


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Thunderbird profile locked without lock file surfer63 Linux - Software 1 11-10-2005 08:30 AM
file locked by another user Dagk Linux - Newbie 6 09-14-2005 09:08 PM
File owner and File group locked - root deiphage Linux - Hardware 5 02-05-2005 01:30 PM
Mozilla Firebird (locked file) bkeating Linux - Software 3 10-23-2003 06:33 PM
File Locked guyd Linux - Newbie 7 08-24-2003 05:30 PM


All times are GMT -5. The time now is 02:50 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration