Skip to content
This repository has been archived by the owner on Nov 24, 2022. It is now read-only.

lxc container does not start because of share folders #332

Closed
xrmx opened this issue Dec 17, 2014 · 13 comments
Closed

lxc container does not start because of share folders #332

xrmx opened this issue Dec 17, 2014 · 13 comments

Comments

@xrmx
Copy link

xrmx commented Dec 17, 2014

Am trying to convert a virtualbox Vagrantfile to lxc, it fails with share folders with:
lxc-start 1418810383.099 ERROR lxc_conf - No such file or directory - failed to mount '/src/foo/bar' on '/usr/lib/i386-linux-gnu/lxc/rootfs/home/vagrant/foo/libs/bar'

Config is:
config.vm.share_folder "foo", "/home/vagrant/foo", "."
config.vm.share_folder "bar", "/home/vagrant/foo/libs/bar, "../bar/"

The Vagrantfile is in /src/foo/foo and tree is like this:
/src/foo/foo
/src/foo/foo/libs
/src/foo/bar

This is a debian sid with lxc is 1.0.6 and vagrant 1.6.5.
Any hint on what could be wrong?

@fgrehm
Copy link
Owner

fgrehm commented Jan 8, 2015

Does it work if you comment out the shared folder configs?

@fgrehm fgrehm modified the milestone: v1.1.0 Jan 8, 2015
@xrmx
Copy link
Author

xrmx commented Jan 12, 2015

If i'll comment these lines it'll fail with:
There was an error executing ["sudo", "lxc-attach", "--name", "odin_default_1421057506055_89332", "--namespaces", "NETWORK|MOUNT", "--", "/sbin/ip", "-4", "addr", "show", "scope", "global", "eth0"]

@fgrehm
Copy link
Owner

fgrehm commented Jan 12, 2015

That sucks :-( I don't have a pre configured sid VM around to try this out but I'll try to have a look at this before the 1.1.0 release

@fgrehm fgrehm modified the milestone: v1.1.0 Jan 14, 2015
@Jbonnett
Copy link

I am seeing a similar error, its failing for me because i dont have eth0. I am using device names like enp0s25 Perhaps xrmx can run ifconfig and confirm on his end?
(P.S. this is all caused by the perhaps poorly named http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/)

@xrmx
Copy link
Author

xrmx commented Feb 11, 2015

@Jbonnett i have eth0, wlan0 and lo interfaces on my host

@Jbonnett
Copy link

Hrmm. the plot thickens. I was able to get up and running on my machine, but I need to do some a/b testing to find the change that fixed this error message.

@Ramblurr
Copy link

Is the title of this bug still the topic?

When I have share_folder lines in my Vagrantfile, I get LXC log entries:

      lxc-start 1424874792.098 ERROR    lxc_conf - conf.c:mount_entry:2049 - No such device - failed to mount '/home/ramblurr/src/vendor/VVV.lxc/www' on '/usr/lib64/lxc/rootfs/srv/www'
      lxc-start 1424874792.098 ERROR    lxc_conf - conf.c:lxc_setup:4163 - failed to setup the mount entries for 'VVVlxc_default_1424874785476_46564'
      lxc-start 1424874792.098 ERROR    lxc_start - start.c:do_start:688 - failed to setup the container

my shared folder lines are:

config.vm.synced_folder "config/", "/srv/config"
config.vm.synced_folder "log/", "/srv/log", :owner => "www-data"
if vagrant_version >= "1.3.0"
    config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
  else
    config.vm.synced_folder "www/", "/srv/www/", :owner => "www-data", :extra => 'dmode=775,fmode=774'
  end

Then vagrant hangs running lxc-ls in a loop waiting for the machine too boot, but it doesn't.

Any tips on getting shared folders working?

@dstelter
Copy link

In my case it was caused by existing mount_options in the the Vagrantfile. Appending the "bind" option resolved the issue.
I would suggest to modify share_folder in vagrant-lxc/driver.rb to augment existing mount_options with bind if the guest path is not a block device.

@Snkz
Copy link

Snkz commented Mar 25, 2015

@dstelter Could you elaborate? What bind option?

@dstelter
Copy link

In order to remount existing folders in a second location the bind option is needed (see http://linux.die.net/man/8/mount). Vagrant-lxc passes this flag by default, but if you specify custom mount_options this gets overwritten (see https://github.com/fgrehm/vagrant-lxc/blob/master/lib/vagrant-lxc/driver.rb#L107). It should be sufficient to modify your Vagrantfile accordingly (e.g. "dmode=0775,fmode=775,bind").

@mwild1
Copy link

mwild1 commented May 19, 2016

Confirmed - I had the same problem, thanks for the tip! I am trying to get a Vagrantfile that someone wrote for a project to work on my system under lxc. They had:

config.vm.synced_folder ".", "/vagrant", :mount_options => ["ro"]

This produced the following line in the generated lxc config:

lxc.mount.entry=/home/path/to/dir vagrant none ro 0 0

But removing the :mount_options from Vagrantfile generated a line like this:

lxc.mount.entry=/home/path/to/dir vagrant none bind,create=dir 0 0

Maybe vagrant-lxc should always append bind and create=dir to the specified mount options if they are not present?

@ccope
Copy link
Contributor

ccope commented May 20, 2016

Maybe, except there is also create=file, so it'll have to check for that.

@fgrehm fgrehm added the ignored label Nov 17, 2022
@fgrehm
Copy link
Owner

fgrehm commented Nov 17, 2022

Hey, sorry for the silence here but this project is looking for maintainers 😅

As per #499, I've added the ignored label and will close this issue. Thanks for the interest in the project and LMK if you want to step up and take ownership of this project on that other issue 👋

@fgrehm fgrehm closed this as completed Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants