Fixing the vagrant sshfs remount after timeout error

“Connection to 127.0.0.1 closed by remote host” The dreaded ‘vagrant sshfs remount after timeout’ error when using vagrant-sshfs. It happens when forgetting to suspend the guest machine before the host machine hibernates. If you use vagrant along with the vagrant-sshfs plugin to mount host folders inside the guest you may come across this error from time to time. – “Connection to 127.0.0.1 closed by remote host”.

The error happens when the local filesystem times out. For example, your mac goes into hibernation overnight. I used to think the only way to get round this was to suspend every night and resume every morning. Recently, I stumbled on the following fix. So no need to restart your vagrant machine if the filesystems unmount.

Type into your terminal (on the host machine)

cd projectname
vagrant sshfs --unmount
vagrant sshfs --mount

Your folders will all detach (if not already detached) and re-attach. Its much quicker than destroying the environment and waiting for provisioning :)

Leave a Reply