1

I am trying to edit a file using nano and whenever I open the file for editing it gives me the following message:

File /path/to/file is being edited (by root with nano 2.5.3. PID 12345); continue?

Yet I can not find the process id in the list of running processes when I grep the pid or when I list all processes. I am unsure as to how to get to the bottom of this. I'm on an ubuntu 16.04 VM.

Dark Star1
  • 1,355
  • 6
  • 21
  • 37
  • 2
    Depending on what you did before there is probably a leftover/stale lock file and no actual process; see cross-dupes https://askubuntu.com/questions/730188/file-var-log-syslog-is-being-edited-message-in-nano and https://unix.stackexchange.com/questions/287798/file-server-js-is-being-edited-by-root-with-nano-2-4-2-pid-xxxx-continue – dave_thompson_085 Jun 30 '17 at 08:17

3 Answers3

3

Try to use ps aux | grep nano and pidof nano to check if that process actually exists. If not try to find nano temporary file in the same location as your file. It should be name like that: file.save.

mrc02_kr
  • 164
  • 7
  • 2
    It turns out that there was a nano swap file at the same location. I found this post: https://askubuntu.com/a/730195 which gave me the clue. – Dark Star1 Jun 30 '17 at 09:10
1

The following information should help. 1. Are you using top to find the pid of the process. How are you trying to get it. 2. Have your tried to get the process status. Try ps -ef |grep *Pid shown*

Update your question for further dig at it.

Dextro67
  • 333
  • 2
  • 10
0

use the command ls -la to find the temporary file. Its extension should be .swp remove that file and you should be able to open and edit the file again.