Unable to Edit fstab: [ Error reading lock file /etc/.fstab.swp: Not enough data read ]

SawKyrom

New Member
Jun 3, 2021
20
1
3
51
Any attempt to edit the /etc/fstab file in Proxmox VE 6.4-13 with nano results in [ Error reading lock file /etc/.fstab.swp: Not enough data read ]. The file is empty and will not save any changes.

Screenshot (324).png

Please see following file status information:

Code:
cat etc/fstab
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/pve/root / ext4 errors=remount-ro 0 1
UUID=A7B3-7337 /boot/efi vfat defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0

I've check the read/write permissions and did a CHMOD 644

Code:
root@proxmox:/etc# ls -al /etc/fstab
-rw-r--r-- 1 root root 207 Jun  2 20:04 /etc/fstab

Code:
root@proxmox:/etc# lsattr /etc/fstab
--------------e---- /etc/fstab

Code:
root@proxmox:/etc# find . -name "*.swp"
./.fstab.swp

I'm sure this is a simple fix. Should I just cp the fstab file to fstabbackup and remake the file with the cat output and edits? Or will that cause a boot error???
 
@bbgeek17 Thank you for the reply. There is plenty of storage space on all drives, but you bring up a good point... There was an episode previously where syslog file overfilled the boot SSD with errors from an USB device. I deleted the syslog file, removed the device and all was forgotten. I wonder if the fstab.swp was created during this time and is a remnant of that issue? Based on your google search article, it sounds like the correct action is to rm the fstab.swp file. I will give it another 24hrs for other replies before I dare to delete an important system file and then report back to you.

I also attempted to edit etc/fstab with vi and received the following error thus supporting idea of fstab.swp file conflicting with fstab:

Code:
E325: ATTENTION
Found a swap file by the name "/etc/.fstab.swp"
          owned by: root   dated: Mon Jul 12 21:34:36 2021
         [cannot be read]
While opening file "/etc/fstab"
             dated: Wed Jun  2 20:04:31 2021

(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" 5 lines, 207 characters

In the end, I think your articles recommendation to delete .fstab.swp is the most logical. Maybe a mv command versus rm to start. Incidentally, I did a DuckDuckGo search and that article did not appear. Maybe I should start using Google again.

Thanks for your feedback!
 
Last edited:
@bbgeek17 THANKS!!! Your article is spot on. I deleted the fstab.swp file and can now edit etc/fstab.

If anyone else finds this chat, you can also follow these steps as outlined in https://www.getsetsolution.com/solved-error-reading-lock-file
  • 1. Navigate to your Project folder: cd /etc
  • 2. Find if you have hidden .swp files in folder: find . -name "*.swp"
  • 3. Delete the .swp files: find . -name "*.swp" - delete or rm /etc/.fstab.swp
  • 4. Ensure you have deleted or not: nano fstab
THANKS ONCE MORE @bbgeek17!!!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!