LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't edit my fstab (https://www.linuxquestions.org/questions/linux-newbie-8/cant-edit-my-fstab-4175493184/)

Ryanms3030 01-30-2014 04:29 PM

Can't edit my fstab
 
I'm trying to edit my fstab to so my samba shares will auto mount. When I vi /etc/fstab , I get the following message:

E325: ATTENTION
Found a swap file by the name "/etc/.fstab.swp"
owned by: root dated: Thu Jan 30 13:28:02 2014
file name: /etc/fstab
modified: YES
user name: root host name: endor
process ID: 4595
While opening file "/etc/fstab"
dated: Thu Jan 30 13:33:12 2014
NEWER than swap file!

(1) Another program may be editing the same file. If this is the case,
be careful not to end up with two different instances of the same
file when making changes. Quit, or continue with caution.
(2) An edit session for this file crashed.
If this is the case, use ":recover" or "vim -r /etc/fstab"
to recover the changes (see ":help recovery").
If you did this already, delete the swap file "/etc/.fstab.swp"
to avoid this message.
"/etc/fstab" 16 lines, 599 characters
Press ENTER or type command to continue



I've tried the suggestions in the message. There is no swap file in the directory. If I continue and hit "i" to enter insert mode I get weird results. When I hit arrow up and down to navigate it starts typing a, b , c in the lines and I can't backspace to delete them. It seems like I am not really entering insert mode but something weird is happening. Any thoughts?

saavik 01-30-2014 04:35 PM

seem weird to me too.

Well i have often had a file left open in vi, leaving the console to the way it should be done, but there always was a file at the stated directroy and after deleting it, everything was fine.

What would happen if you just open an new file with vi ?

Maybe the harddisk is full ?

Curruption of the filesystem, some other hardware error?

I do not like it, as this is not WinXXXX but reboot ?

Ryanms3030 01-30-2014 04:44 PM

Quote:

Originally Posted by saavik (Post 5108339)
seem weird to me too.

Well i have often had a file left open in vi, leaving the console to the way it should be done, but there always was a file at the stated directroy and after deleting it, everything was fine.

What would happen if you just open an new file with vi ?

Maybe the harddisk is full ?

Curruption of the filesystem, some other hardware error?

I do not like it, as this is not WinXXXX but reboot ?

I tried rebooting a couple of times. I just tried to vi my netconfig file and it is behaving the same way. So I guess it's some larger vi issue or corruption

Ryanms3030 01-30-2014 05:32 PM

I tried nano instead of vi and that worked.

myatthu 01-30-2014 07:21 PM

There will be .swp file at that directory. You can verify with below command

ls -al /directory

Since you edit with nano for your desired content
You can simply delete vi swp file

rm /directory/xxx.swp

Now you can edit again that file with vi editor.

Ryanms3030 01-30-2014 10:18 PM

Quote:

Originally Posted by myatthu (Post 5108421)
There will be .swp file at that directory. You can verify with below command

ls -al /directory

Since you edit with nano for your desired content
You can simply delete vi swp file

rm /directory/xxx.swp

Now you can edit again that file with vi editor.

Thanks

Ryanms3030 02-10-2014 12:49 PM

So, I was reading another tutorial for something all together different and it was mentioned by the author that debian based distros have a problem with vi and solution is to install:

apt-get install vim-nox


I haven't tried this yet but I will.

myatthu 02-13-2014 09:43 AM

Cool. Glad to hear that you are doing well. Good luck


All times are GMT -5. The time now is 10:18 PM.