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

Support vagrant-lxc #68

Closed
varac opened this issue Jan 31, 2017 · 8 comments
Closed

Support vagrant-lxc #68

varac opened this issue Jan 31, 2017 · 8 comments

Comments

@varac
Copy link

varac commented Jan 31, 2017

Hej,

first of all th for this awesome plugin, I was so lucky to finally remove NFS from my box !
It works great with vagrant-libvirt, but fails with vagrant-lxc:

--- vagrant/fgrehm » vagrant up --provider=lxc     

Ignoring ruby-libvirt-0.7.0 because its extensions are not built.  Try: gem pristine ruby-libvirt --version 0.7.0
Bringing machine 'default' up with 'lxc' provider...
==> default: Importing base box 'fgrehm/precise64-lxc'...
==> default: Checking if box 'fgrehm/precise64-lxc' is up to date...
==> default: Starting container...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 10.0.3.196:22
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: 
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: 
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Installing SSHFS client...
==> default: Mounting SSHFS shared folder...
==> default: Mounting folder via SSHFS: /home/varac/vagrant/fgrehm => /vagrant
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
==> default: Checking Mount..
Mounting SSHFS shared folder via slave SSHFS mount failed. Please
look at the below STDERR output from the processes that were run.

SSH command:

Warning: Permanently added '10.0.3.196' (ECDSA) to the list of known hosts.
fuse: device not found, try 'modprobe fuse' first

SFTP command:

A proper fix would be appreciated!

@dustymabe
Copy link
Owner

hmm. so sshfs uses fuse (kernel module) and you are running a container which means you are sharing the kernel with the host. You might be able to modprobe fuse on the host before doing vagrant up and see if that works.

@varac
Copy link
Author

varac commented Feb 1, 2017

@dustymabe my kernel (4.8.0-34-generic #36-Ubuntu) has fuse included, not as a module:

--- ~ » lsmod |grep fuse
--- ~ » modprobe fuse
--- ~ » lsmod |grep fuse

even trying modprobe fuse explictily on my host it fails the same.

@dustymabe
Copy link
Owner

dustymabe commented Feb 2, 2017

does /dev/fuse exist on your host? that might need to get bind mounted into the container.

@dustymabe
Copy link
Owner

@varac ^^

@varac
Copy link
Author

varac commented Feb 11, 2017

@dustymabe yes it does

--- ~ » ls /dev/fuse -la
crw-rw-rw- 1 root root 10, 229 Feb 11 14:09 /dev/fuse

@dustymabe
Copy link
Owner

can you try to bind mount that into the container? I have no idea how to do this with vagrant-lxc, but I believe that is what needs to be done.

@varac
Copy link
Author

varac commented Feb 22, 2017

@dustymabe Thx for looking into this. But I didn't debug further, I'm fine with vagrant-lxc with it's default way of mounting shared folders.

@varac varac closed this as completed Feb 22, 2017
@robkinyon-roivant
Copy link

What's needed here is a verification that /dev/fuse exists on the guest and, if not, execute mknod -m 666 /dev/fuse c 10 229. This is a well-known issue in mounting sshfs within LXC containers.

Failed attempts:

  • Because of Add feature to mount folders post-provisioning? hashicorp/vagrant#936, you cannot do this from within the Vagrantfile as a provisioning step.
  • I tried to set things up so that the synced folder was disabled, then I would provision everything, then run vagrant sshfs --mount with a :host_script provisioning step, but that didn't work because the synced folder is disabled. :(

Finally, this also has to be done on every run because, if the device doesn't exist in the container template, it won't exist on reboot either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants