I've got a vagrant vm set-up with a project structure on my host machine like so:
PlayApps --> App1 -----------> all application/project files
App2 -----------> ""
App3 -----------> ""
(etc..)
.VagrantFiles --> VagrantFile
bootstrap.sh
(etc...)
I cd
into my .VagrantFiles directory and then launch the VM. In my VagrantFile for that VM I'm sharing this directory:
config.vm.synced_folder "../", "/Shared"
with the goal of sharing everything in the PlayApps directory (multiple projects) with the VM. When I launch the VM and ssh
in I see the directory /Shared and I can cd
into it, but when I try to list the contents with ls -al
I'm getting the following error:
ls: cannot open directory .: Operation not permitted.
When I do ls -al
on the directory containing /Shared this is what I see (among other directories):
d????????? ? ? ? ? ? Shared/ and
d????????? ? ? ? ? ? vagrant/
I tried to sudo chmod 666
the /Shared directory, thinking that it was a permissions error, but got the following error:
chmod: cannot access '/Shared': Protocol error
Vagrant, ssh, and "ops" in general is fairly new to me so any pointers, suggestions, answers would be GREATLY appreciated.
Have you moved/renamed any parent directory of your vagrant box while it was suspended?
If so, run vagrant halt
, undo any renames, then vagrant up
and you project dir should be back!
I encountered the exact same issue after renaming the parent dir where my Vagrantfile + project files reside.
Ran additional scenarios which confirm that renaming a vagrant project's parent directory while the VM is suspended causes this permissions problem; however, if you completely shut down the VM with vagrant halt
your are free to rename.
Yesterday had a perfectly functional RoR env on Ubuntu precise32 box. Exited the shell, ran vagrant suspend
and shut down my workstation.
Today day I booted up my workstation (host machine) and renamed the parent directory of my vagrant project, like so:
└── ORIGINAL_DIR_NAME
├── Vagrantfile
└── PROJECT
└── NEW_DIR_NAME
├── Vagrantfile
└── PROJECT
After, I ran vagrant up
, vagrant ssh
. Once in the VM shell I couldn't cd into /vagrant.
ls -alh /
from the guest shell returned:
ls: cannot access /vagrant: Protocol error
[...]
drwxrwxrwt 2 root root 4.0K Aug 4 21:17 tmp
drwxr-xr-x 10 root root 4.0K Sep 14 2012 usr
d????????? ? ? ? ? ? vagrant
drwxr-xr-x 11 root root 4.0K Aug 4 19:23 var
[...]
also tried chmod on /vagrant
and got this:
chmod: cannot access `/vagrant': Protocol error
First attempted fix was running vagrant suspend
, renaming the parent directory back to its original value, then running vagrant up
. Unfortunately that trashed the entire vagrant VM and it's stuck in vagrant pergatory - won't fully boot or shutdown.
So, the correct fix is to exit all vagrant ssh shells, run vagrant halt
(not suspend) to make sure it's OFF (not asleep), and revert any recent renames to parent directories. Then vagrant up
and see if you can get into /vagrant
! After that, if you want to rename your folders just vagrant halt
, rename, and vagrant up
.