Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vagrant 1.3.x sync folder syntax confusion #2564

Closed
bitinn opened this issue Dec 2, 2013 · 21 comments
Closed

vagrant 1.3.x sync folder syntax confusion #2564

bitinn opened this issue Dec 2, 2013 · 21 comments

Comments

@bitinn
Copy link

bitinn commented Dec 2, 2013

see my comment below for updates.

#2564 (comment)


here is the basic output from vagrant up:

[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Running 'pre-boot' VM customizations...
[default] Booting VM...
GuestAdditions 4.3.2 running --- OK.
[default] Waiting for machine to boot. This may take a few minutes...
[default] Machine booted and ready!
[default] Setting hostname...
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- /vagrant
[default] -- /tmp/vagrant-puppet/manifests

no more output beyond last line.

here is the last thousand line output with command VAGRANT_LOG=debug vagrant up, vagrant seems to retry ssh with virtualbox repeatedly and to no success, but does not timeout itself.

https://gist.github.com/bitinn/7744788

@bitinn
Copy link
Author

bitinn commented Dec 2, 2013

forgot to mention i am on vagrant 1.3.5 and virtualbox 4.3.2, i was using vagrant 1.2.x with virtualbox 4.2.x without issues, only updated to latest when i upgrade to mac osx mavericks.

it seems every time I reboot my host machine, my vm would be broken and had to vagrant destroy and provision again to get them working...

i will try uninstall virtualbox and report back.

@bitinn
Copy link
Author

bitinn commented Dec 2, 2013

with vagrant 1.3.5 and latest virtualbox 4.3.4, i observe this issue, if i ran vagrant destroy then the next vagrant up will run provision and server is started with correct setup. But any vm restart beyond that will break vagrant, for example vagrant reload, will result in the same stalled output.

my Vagrantfile

Vagrant.configure("2") do |config|

    config.vm.box = "precise64"
    config.vm.box_url = "http://files.vagrantup.com/precise64.box"

    if defined? VagrantVbguest
        config.vbguest.auto_update = true
    end

    config.vm.hostname = "leaf"

    if Vagrant::Util::Platform.windows?
        config.vm.synced_folder "www", "/var/www", :mount_options => ["dmode=777","fmode=777"], :owner => "vagrant", :group => "vagrant"
    else
        config.vm.synced_folder "www", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
    end

    config.vm.network :private_network, ip: "192.168.10.10"

    config.vm.provision :shell, :inline => "echo \"Asia/Hong_Kong\" | sudo tee /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata"

    config.vm.provider :virtualbox do |vb|
        vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
        vb.customize ["modifyvm", :id, "--memory", "512"]
    end

    config.vm.provision :puppet do |puppet|
        puppet.facter = { "fqdn" => "local.leaf", "hostname" => "leaf" }
        puppet.manifests_path = "manifests"
        puppet.manifest_file  = "base.pp"
        puppet.module_path = "modules"
        puppet.options = "--verbose --debug"
    end

end

@bitinn
Copy link
Author

bitinn commented Dec 2, 2013

tried this for multiple times, clean install vagrant 1.3.5, virtualbox 4.3.4 with puppet 3.3.2 and vagrant guest 0.10 (pre-release) on OSX Mavericks. same issue persists, first vagrant up always works, after first halt, up or reload will trigger said issue in OP.

i have tried:

  1. check /etc/exports as well as running sudo nfsd checkexports
  2. use a simplify vagrantfile, without guest plugin or puppet or nfs
  3. check my /etc/hosts file has correct localhost entry
  4. switch vm to latest ubuntu precise build
  5. virtualbox restart

to no success, would appreciate some suggestions...

@bitinn
Copy link
Author

bitinn commented Dec 3, 2013

Tried 2 more combinations on OSX 10.9:

vagrant 1.3.5 + virtualbox 4.2.20: still the same issue, initial vagrant up work, subsequent ones stalled (with or without --provision flag)

vagrant 1.2.7 + virtualbox 4.2.20: works! the only thing different is vagrantfile config, in particular the part about extra=> mount_options change:

my old 1.2 config

if Vagrant::Util::Platform.windows?
    config.vm.synced_folder "www", "/var/www", :extra => "dmode=777,fmode=777", :owner => "vagrant", :group => "vagrant"
else
    config.vm.synced_folder "www", "/var/www", :extra => "dmode=777,fmode=777", :nfs => true
end

vs 1.3 config

if Vagrant::Util::Platform.windows?
    config.vm.synced_folder "www", "/var/www", :mount_options => ["dmode=777","fmode=777"], :owner => "vagrant", :group => "vagrant"
else
    config.vm.synced_folder "www", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=777"] }
end

I will change my issue title to reflect this discovery.

@mitchellh
Copy link
Contributor

Ah, I think this is fixed. The issue is that initctl emit is blocking. I added a --no-wait in the referenced commit and that should fix this.

@0xqd
Copy link

0xqd commented Dec 14, 2013

is this released in the latest version of vagrant ?

@mitchellh
Copy link
Contributor

Yes

@Nalum
Copy link

Nalum commented Feb 13, 2014

@mitchellh I'm getting this Issue of the synced folders being empty, I was on 1.3.5 and upgraded to 1.4.3, and I still get it. I didn't uninstall vagrant before upgrading, could that be why it's still happening?

VirtualBox is version 4.3.0

@Nalum
Copy link

Nalum commented Feb 13, 2014

Just tried with a fresh install of vagrant 1.4.3 (removed my user configs also) and virtualbox 4.3.6 and it is still happening. I'm on OSX 10.8.5 and this is the result of the VAGRANT_LOG=debug vagrant up app_cms

@mitchellh
Copy link
Contributor

@Nalum What do you mean by synced folders being empty? You mean they exist but the contents are empty and shouldn't be? Run mount to check that they're mounted properly. Make sure the guest additions are up to date.

@Nalum
Copy link

Nalum commented Feb 13, 2014

@mitchellh When vagrant is started after being halted the synced folders are not synced with their host system folders. So the folders exist but are owned by root and do not contain the content of the host system folder. I've just tried it again after installing vagrant-vbguest and they (/vagrant, /home/vagrant/..ssh, /var/www/app-cms/project) are still empty. I've also destroyed and brought them up again, first run of up is fine and second run, after halt, is still empty.

This is the output I get from running mount:

/dev/mapper/precise64-root on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
/dev/sda1 on /boot type ext2 (rw)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw)
/vagrant on /vagrant type vboxsf (uid=1000,gid=1000,rw)
/home/vagrant/..ssh on /home/vagrant/..ssh type vboxsf (uid=1000,gid=1000,rw)
/var/www/app-cms/project on /var/www/app-cms/project type vboxsf (uid=33,gid=33,rw)

This is the same with first run of vagrant up where the folders are properly synced.

These are the lines I have for the synced folders:

app_cms.vm.synced_folder "#{ENV['HOME']}/git-repos/app.tv", "/var/www/app-cms/project", :mount_options => ['dmode=777','fmode=777'], owner: "www-data", group: "www-data"
app_cms.vm.synced_folder "#{ENV['HOME']}/.ssh", "/home/vagrant/..ssh", owner: "vagrant", group: "vagrant"

@kikitux
Copy link
Contributor

kikitux commented Feb 13, 2014

On Fri, Feb 14, 2014 at 5:14 AM, Luke Mallon notifications@github.comwrote:

home/vagrant/..ssh

why ..ssh ?

@Nalum
Copy link

Nalum commented Feb 13, 2014

@kikitux I didn't want to over write the .ssh folder in case it was used by vagrant.

@tmatilai
Copy link
Contributor

@Nalum vboxsf synced folder being empty is a typical issue of buggy and too old guest additions on the guest. As Vagrant warned you, your box has v4.2.0 while the VirtualBox in the host is 4.3. So either rebuild the box, or vagrant plugin install vagrant-vbguest to update the additions automatically when needed.

@tmatilai
Copy link
Contributor

@Nalum eh, sorry, you already said you did that...
Could you please update the gist with up-to-date guest additions.

@Nalum
Copy link

Nalum commented Feb 14, 2014

Updated log.

@tmatilai
Copy link
Contributor

@Nalum thanks. There seem to be still problem with the guest additions. lsmod won't list them, so Vagrant warns that "GuestAdditions seems to be installed (4.3.6) correctly, but not running.". That should have been printed without debug log level too.

So maybe vagrant-vbguest failed to install the additions, someone updated the kernel, or there is some other problem on the box.

@Nalum
Copy link

Nalum commented Feb 14, 2014

Thanks @tmatilai, I've just done a clean up, halt, up with out the chef provisioner and it's working fine. I'll need to figure out what the chef recipe is doing. Any pointers?

@tmatilai
Copy link
Contributor

@Nalum what chef recipe? As far as I can see you didn't share any information of that. But if your provisioner updates the kernel or even reboots the VM you can expect things to break.

@Nalum
Copy link

Nalum commented Feb 14, 2014

@tmatilai it is one written by my company, can't share it unfortunately. It is doing an apt-get update then installing some packages. I don't see anywhere that looks like it is updating the Kernel or rebooting the VM.

Really appreciate the help guys. Gonna have to go through the recipe on my own.

@Nalum
Copy link

Nalum commented Feb 14, 2014

Just leaving this here for anyone else that might come across the same issue.

The Chef recipe was adding a .bash_ps1 file which contained the line:

trap 'echo -ne "\033[00m"' DEBUG

Once this was removed the synced folders worked as they are supposed to.

@hashicorp hashicorp locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants