You are not logged in.

#1 2018-12-08 23:08:26

pdxleif
Member
Registered: 2011-10-26
Posts: 7

[SOLVED} vim: unable to open swap file, recovery impossible.

As of a few days ago, I get that message every time I open a file in vim, I get that error about "unable to open swap file", and then when I try to save a file, it tells me "E510: Can't make backup file (add ! to override)", so I have to use "w!" to get past that.
I've uninstalled vim / gvim, rm -r'd the /usr/share/vim directory in between doing that, but it still happens.
My /home is btrfs. If I edit a file on /tmp, I still get that opening message about unable to open swap, but I don't get the error about "Can't make backup file" when saving.

Edit: false alarm - it turned out my $HOME/.cache filesystem was hosed, and vim has ~/.cache/vim/backup// set as the backupdir by default. (according to :se backup? backupdir? backupext?) The filesystem was unrecoverable, so I recreated it.

Last edited by pdxleif (2018-12-14 22:51:09)

Offline

#2 2018-12-09 00:05:51

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: [SOLVED} vim: unable to open swap file, recovery impossible.

Please remember to mark your thread as SOLVED.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-12-09 00:57:16

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED} vim: unable to open swap file, recovery impossible.

By default, Arch Linux's configuration will set the backup, swap, and undo directories to subdirectories of ${XDG_CACHE_HOME:-$HOME/.cache} for security reasons.

BTW why is that "filesystem" hosed? Usually the cache directory is the one XDG directory you do not share... the only other thing I can think of people doing to it is mounting it as a tmpfs, which shouldn't be getting hosed, but recreated...

Last edited by eschwartz (2018-12-09 00:59:31)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2018-12-14 22:56:06

pdxleif
Member
Registered: 2011-10-26
Posts: 7

Re: [SOLVED} vim: unable to open swap file, recovery impossible.

Files in $HOME/.cache seem to get corrupted (specifically, chrome files in there) when my computer locks up and I have to hard reset. I've made that a separate filesystem (that's a scratch filesystem with a bunch of tiny writes where I don't care about data durability), so it won't mess up anything else for me if it gets hosed.
Maybe I need to think of a better check / alerting mechanism for that, though - apparently that filesystem got screwed up, and I didn't notice until vim started acting funny.
I found out what was going on with vim when I was still able to use vim as root. I'm used to the .swp files being next to the files I'm editing - when I noticed they weren't there I went hunting for what directories vim was using.

Offline

Board footer

Powered by FluxBB