"/vagrant" shared folder does not exist
Asked Answered
C

1

7

When I create a virtual machine through vagrant, and ssh into the machine the "/vagrant" folder does not exist.

Currently Running the following

Note there is no mention of "Mounting Shared Folders" when the machine boots up. The Vagrantfile is the standard file created from "vagrant init".

Any help on to why this may be happening would be much appreciated. Thanks.

Cormack answered 30/5, 2016 at 2:49 Comment(1)
I have the same issue with Ubuntu 16.04 (vagrant init ubuntu/xenial64), but 14.04 works fine.Deering
A
7

make sure that in your Vagrantfile you dont have something

config.vm.synced_folder ".", "/vagrant", disabled: true

Also if you dont, force the default /vagrant folder to be shared

config.vm.synced_folder ".", "/vagrant"

when booting your VM, you should have logs like

==> default: Mounting shared folders...
    default: /vagrant => /Users/.....path to project directory

If nothing works, 2 things you can explore:

  • is sync_folder working with another folder definition ?
  • boot with debug option vagrant up --debug to see whats happening after Mounting shared folders
Apophyllite answered 30/5, 2016 at 7:9 Comment(6)
Synced folders were not initially disabled. Adding the config.vm.synced_folder ".","/vagrant" worked. However, that seems like a bit of a workaround. Is that not supposed to be default behavior?Cormack
it could be because of a 1) global vagrantfile or the 2) box vagrantfile - to check create a VM from another box (like ubuntu/wily64 for example) and see if /vagrant is set; if it works it means your current box has Vagrantfile which deactivate the sync folder. If the folder is still disabled it could be because it is disabled in a global vagrantfileApophyllite
ok then it might be an issue with the previous box, check if you have a file ~/.vagrant.d/boxes/<yourboxwithissue>/0/virtualbox/Vagrantfile ? if you do check content of the file to see if you have a disable sync folderApophyllite
None of these worked for me. Vagrant refuses to mount the host directory to /vagrant.Pashalik
@Distortum which box do you have ?Apophyllite
@FredericHenri never mind. It was caused by the box not having my ssh public key. Without ssh authentication, there’s no file sync.Pashalik

© 2022 - 2024 — McMap. All rights reserved.