So I was recovering a virtual machine this morning from an unexpected shutdown and discovered that Apache was failing to start because of this error message:

AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled/.vhost.conf.swp: Invalid command 'b0VIM', perhaps misspelled or defined by a module not included in the server configuration Action 'start' failed.

Sure enough I found the .swp file in sites-enabled, did some research on it first which yielded next to nothing, and then moved it into a temp directory and started up Apache just fine.

System seems to be running a-ok now but it leaves me with an uneasy feeling in my stomach to just move a file that I don't know anything about and walk away so I figured I'd see if anyone could explain what this file is all about and more importantly that I'm not going to see some negative repercussions later for moving it. I figure it's because of the server being improperly shut down but better safe than sorry



Is it possible you opened the vhost.conf file earlier with 'vi'? It creates a swap file (.swp) to notify other users when they open the same file, and in case your session crashes, it will store unsaved changes. It is save to remove this file if and only if nobody else is editing the file (Thanks to MadHatter for correcting me).

  • 2
    Safe, if and only if someone isn't currently editing the file. UNIX is a multi-user OS! – MadHatter Jun 19 '15 at 12:24
  • I stand corrected. That is right MadHatter. – Exsisto Jun 19 '15 at 12:25
  • You can also use vi -r option to recover the unsaved changes stored in the .swp file. – Tero Kilkanen Jun 21 '15 at 2:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.