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

Use LVM to create container #359

Closed
fpeterschmitt opened this issue Apr 2, 2015 · 11 comments · Fixed by #361
Closed

Use LVM to create container #359

fpeterschmitt opened this issue Apr 2, 2015 · 11 comments · Fixed by #361
Milestone

Comments

@fpeterschmitt
Copy link

Hi,

I encounter a problem while using LVM to store containers.

vagrant-1.7.2-1.x86_64
CentOS 7.1
ruby 2.0.0p598

Here is the Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
    config.vm.provider :lxc do |lxc|
        lxc.backingstore = 'lvm'
        lxc.backingstore_option '--vgname', 'linux'
        lxc.backingstore_option '--fssize', '2G'
        lxc.backingstore_option '--fstype', 'ext4'
    end

    config.vm.define "testvagrant" do |node|
        node.vm.box = "fgrehm/precise64-lxc"
        node.vm.provider :lxc do |lxc|
            lxc.container_name = :machine
            lxc.backingstore_option '--vgname', 'linux'
            lxc.backingstore_option '--fssize', '2G'
            lxc.backingstore_option '--fstype', 'ext4'
            lxc.backingstore_option '--lvname', "lxc_testvagrant"
        end
    end
end

Here is the most important message :

INFO interface: error: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

Also, I dont know if it can be possible to bypass LVM asking to wipe old filesystem metadata, for the moment i workarounded it by disable detection.

But, well, I can't figure out why the rootfs is the LVM device path… maybe a bug while handling lvm backingstore?

The full debug trace:

INFO subprocess: Starting process: ["/usr/bin/sudo", "cp", "/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/scripts/lxc-template", "/usr/share/lxc/templates/lxc-vagrant-tmp-testvagrant"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
 INFO subprocess: Starting process: ["/usr/bin/sudo", "chmod", "+x", "/usr/share/lxc/templates/lxc-vagrant-tmp-testvagrant"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG driver: Creating container...
 INFO subprocess: Starting process: ["/usr/bin/sudo", "lxc-create", "-B", "lvm", "--template", "vagrant-tmp-testvagrant", "--name", "testvagrant", "--vgname", "linux", "--fssize", "2G", "--fstype", "ext4", "--lvname", "lxc_testvagrant", "--", "--tarball", "/root/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-precise64-lxc/1.2.0/lxc/rootfs.tar.gz", "--config", "/root/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-precise64-lxc/1.2.0/lxc/lxc-config"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: File descriptor 3 (/var/lib/lxc/testvagrant/partial) leaked on lvcreate invocation. Parent PID 26619: lxc-create
DEBUG subprocess: stdout:   Logical volume "lxc_testvagrant" created.
DEBUG subprocess: stdout: Unpacking the rootfs
DEBUG subprocess: stderr: tar: var/lib/sudo: implausibly old time stamp 1970-01-01 01:00:00
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31994
DEBUG subprocess: Exit status: 0
 INFO driver: Removing LXC template
 INFO subprocess: Starting process: ["/usr/bin/sudo", "rm", "/usr/share/lxc/templates/lxc-vagrant-tmp-testvagrant"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
 INFO machine: New machine ID: "testvagrant"
DEBUG lxc: Instantiating the container for: "testvagrant"
 INFO subprocess: Starting process: ["/usr/bin/sudo", "lxc-ls"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: 01-mail
02-web
04-gitlab
08-dns
21-fah
22-wesnoth
30-ceramique
31-psql
32-xmpp
93-centreon-decathlon
testvagrant
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
 INFO warden: Calling IN action: #<Proc:0x00000002e8e9d0@/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:94 (lambda)>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::ConfigValidate:0x000000020c4b88>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::BoxCheckOutdated:0x000000020c4b38>
 INFO interface: output: Checking if box 'fgrehm/precise64-lxc' is up to date...
 INFO interface: output: ==> testvagrant: Checking if box 'fgrehm/precise64-lxc' is up to date...
 INFO downloader: Downloader starting download: 
 INFO downloader:   -- Source: https://atlas.hashicorp.com/fgrehm/precise64-lxc
 INFO downloader:   -- Destination: /tmp/vagrant20150402-26574-11ch7cf
 INFO subprocess: Starting process: ["/opt/vagrant/bin/../embedded/bin/curl", "-q", "--fail", "--location", "--max-redirs", "10", "--user-agent", "Vagrant/1.7.2", "-H", "Accept: application/json", "--output", "/tmp/vagrant20150402-26574-11ch7cf", "https://atlas.hashicorp.com/fgrehm/precise64-lxc"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   120  100   120    0     0    266      0 --:--:-- --:--:-- --:--:--   301
100  1501  100  1501    0     0   2118      0 --:--:-- --:--:-- --:--:--  2118
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 31999
DEBUG subprocess: Exit status: 0
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::Call:0x000000024f8330>
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x00000002d4a0d8>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::IsState:0x00000002d731b8>
DEBUG is_state: Checking if machine state is 'running'
 INFO subprocess: Starting process: ["/usr/bin/sudo", "lxc-info", "--name", "testvagrant"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: Name:           testvagrant
DEBUG subprocess: stdout: State:          STOPPED
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG is_state: -- Machine state: stopped
 INFO warden: Calling OUT action: #<Vagrant::Action::Builtin::IsState:0x00000002d731b8>
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Warden:0x00000002ed4520>
 INFO warden: Calling IN action: #<Proc:0x00000003687cb8@/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:94 (lambda)>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::Provision:0x00000002ed4278>
 INFO provision: Checking provisioner sentinel file...
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::EnvSet:0x00000002eff2e8>
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::HandleForwardedPortCollisions:0x00000002eff2c0>
DEBUG environment: Attempting to acquire process-lock: fpcollision
DEBUG environment: Attempting to acquire process-lock: dotlock
 INFO environment: Acquired process lock: dotlock
 INFO environment: Released process lock: dotlock
 INFO environment: Acquired process lock: fpcollision
 INFO handle_port_collisions: Detecting any forwarded port collisions...
DEBUG handle_port_collisions: Extra in use: []
DEBUG handle_port_collisions: Remap: {}
DEBUG handle_port_collisions: Repair: true
 INFO handle_port_collisions: Attempting to repair FP collision: 2222
 INFO handle_port_collisions: Repaired FP collision: 2222 to 2200
 INFO interface: info: Fixed port collision for 22 => 2222. Now on port 2200.
 INFO interface: info: ==> testvagrant: Fixed port collision for 22 => 2222. Now on port 2200.
 INFO warden: Calling IN action: #<Vagrant::LXC::Action::PrepareNFSValidIds:0x00000002f23f58>
 INFO subprocess: Starting process: ["/usr/bin/sudo", "lxc-ls"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: 01-mail
02-web
04-gitlab
08-dns
21-fah
22-wesnoth
30-ceramique
31-psql
32-xmpp
93-centreon-decathlon
testvagrant
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
 INFO warden: Calling IN action: #<VagrantPlugins::SyncedFolderNFS::ActionCleanup:0x00000002f3ee70>
DEBUG host: Searching for cap: nfs_prune
DEBUG host: Checking in: redhat
DEBUG host: Checking in: linux
DEBUG host: Found cap: nfs_prune in linux
 INFO nfs: NFS pruning. Valid IDs: ["01-mail", "02-web", "04-gitlab", "08-dns", "21-fah", "22-wesnoth", "30-ceramique", "31-psql", "32-xmpp", "93-centreon-decathlon", "testvagrant"]
DEBUG host: Searching for cap: nfs_prune
DEBUG host: Checking in: redhat
DEBUG host: Checking in: linux
DEBUG host: Found cap: nfs_prune in linux
 INFO host: Execute capability: nfs_prune [#<Vagrant::Environment: /root/vagrant>, #<Vagrant::UI::Prefixed:0x00000002e5d330 @logger=#<Log4r::Logger:0x00000002e5d218 @fullname="vagrant::ui::interface", @outputters=[], @additive=true, @name="interface", @path="vagrant::ui", @parent=#<Log4r::Logger:0x00000001d99350 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x00000001fb4db0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000001fb4d38>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x00000001fbe108 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x00000001d9b7e0 @level=0, @outputters=[]>, @level=1, @trace=false>, @level=1, @trace=false>, @opts={}, @prefix=:testvagrant, @ui=#<Vagrant::UI::Basic:0x00000002e09f50 @logger=#<Log4r::Logger:0x00000002e09e60 @fullname="vagrant::ui::interface", @outputters=[], @additive=true, @name="interface", @path="vagrant::ui", @parent=#<Log4r::Logger:0x00000001d99350 @fullname="vagrant", @outputters=[#<Log4r::StderrOutputter:0x00000001fb4db0 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x00000001fb4d38>, @name="stderr", @level=0, @formatter=#<Log4r::DefaultFormatter:0x00000001fbe108 @depth=7>, @out=#<IO:<STDERR>>>], @additive=true, @name="vagrant", @path="", @parent=#<Log4r::RootLogger:0x00000001d9b7e0 @level=0, @outputters=[]>, @level=1, @trace=false>, @level=1, @trace=false>, @opts={:color=>:default}, @lock=#<Mutex:0x00000002e78248>>>, ["01-mail", "02-web", "04-gitlab", "08-dns", "21-fah", "22-wesnoth", "30-ceramique", "31-psql", "32-xmpp", "93-centreon-decathlon", "testvagrant"]] (redhat)
 INFO linux: Pruning invalid NFS entries...
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::SyncedFolderCleanup:0x00000002f5f760>
 INFO synced_folder_cleanup: Invoking synced folder cleanup for: lxc
 INFO warden: Calling IN action: #<Vagrant::Action::Builtin::SyncedFolders:0x0000000352d8b8>
 INFO synced_folders: Synced Folder Implementation: lxc
 INFO synced_folders:   - /vagrant: . => /vagrant
 INFO synced_folders: Invoking synced folder prepare for: lxc
 INFO interface: output: Setting up mount entries for shared folders...
 INFO interface: output: ==> testvagrant: Setting up mount entries for shared folders...
 INFO subprocess: Starting process: ["/usr/bin/sudo", "which", "lxc-version"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: which: no lxc-version in (/sbin:/bin:/usr/sbin:/usr/bin)
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 1
 INFO subprocess: Starting process: ["/usr/bin/sudo", "lxc-create", "--version"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: 1.0.7
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
 INFO subprocess: Starting process: ["/usr/bin/sudo", "lxc-config", "lxc.lxcpath"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: /var/lib/lxc
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
 INFO subprocess: Starting process: ["/usr/bin/sudo", "cat", "/var/lib/lxc/testvagrant/config"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stdout: # Template used to create this container: /usr/share/lxc/templates/lxc-vagrant-tmp-testvagrant
# Parameters passed to the template: --tarball /root/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-precise64-lxc/1.2.0/lxc/rootfs.tar.gz --config /root/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-precise64-lxc/1.2.0/lxc/lxc-config
# For additional config options, please look at lxc.container.conf(5)

##############################################
# Container specific configuration (automatically set)
lxc.rootfs = /dev/linux/lxc_testvagrant
lxc.utsname = testvagrant

##############################################
# Network configuration (automatically set)
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = virbr0

##############################################
# vagrant-lxc base box specific configuration
# Default pivot location
lxc.pivotdir = lxc_putold

# Default mount entries
lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry = sysfs sys sysfs defaults 0 0

# Default console settings
lxc.devttydir = lxc
lxc.tty = 4
lxc.pts = 1024

# Default capabilities
lxc.cap.drop = sys_module mac_admin mac_override sys_time

# When using LXC with apparmor, the container will be confined by default.
# If you wish for it to instead run unconfined, copy the following line
# (uncommented) to the container's configuration file.
#lxc.aa_profile = unconfined

# To support container nesting on an Ubuntu host while retaining most of
# apparmor's added security, use the following two lines instead.
#lxc.aa_profile = lxc-container-default-with-nesting
#lxc.hook.mount = /usr/share/lxc/hooks/mountcgroups

# Uncomment the following line to autodetect squid-deb-proxy configuration on the
# host and forward it to the guest at start time.
#lxc.hook.pre-start = /usr/share/lxc/hooks/squid-deb-proxy-client

# If you wish to allow mounting block filesystems, then use the following
# line instead, and make sure to grant access to the block device and/or loop
# devices below in lxc.cgroup.devices.allow.
#lxc.aa_profile = lxc-container-default-with-mounting

# Default cgroup limits
lxc.cgroup.devices.deny = a
## Allow any mknod (but not using the node)
lxc.cgroup.devices.allow = c *:* m
lxc.cgroup.devices.allow = b *:* m
## /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
## consoles
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 5:1 rwm
## /dev/{,u}random
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 1:9 rwm
## /dev/pts/*
lxc.cgroup.devices.allow = c 5:2 rwm
lxc.cgroup.devices.allow = c 136:* rwm
## rtc
lxc.cgroup.devices.allow = c 254:0 rm
## fuse
lxc.cgroup.devices.allow = c 10:229 rwm
## tun
lxc.cgroup.devices.allow = c 10:200 rwm
## full
lxc.cgroup.devices.allow = c 1:7 rwm
## hpet
lxc.cgroup.devices.allow = c 10:228 rwm
## kvm
lxc.cgroup.devices.allow = c 10:232 rwm
## To use loop devices, copy the following line to the container's
## configuration file (uncommented).
#lxc.cgroup.devices.allow = b 7:* rwm

##############################################
# vagrant-lxc container specific configuration
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG driver: Guest path: vagrant
DEBUG driver: Guest path doesn't exist, creating: /dev/linux/lxc_testvagrant/vagrant
 INFO subprocess: Starting process: ["/usr/bin/sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: stderr: mkdir: cannot create directory ‘/dev/linux/lxc_testvagrant’: Not a directory
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 1
ERROR warden: Error occurred: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
 INFO warden: Beginning recovery process...
 INFO warden: Calling recover: #<Vagrant::Action::Builtin::HandleForwardedPortCollisions:0x00000002eff2c0>
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO environment: Released process lock: fpcollision
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
ERROR warden: Error occurred: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
ERROR warden: Error occurred: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
 INFO warden: Beginning recovery process...
 INFO warden: Calling recover: #<Vagrant::Action::Builtin::Call:0x000000024f8330>
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Calling recover: #<Vagrant::Action::Builtin::Call:0x000000020c4c78>
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
ERROR warden: Error occurred: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
ERROR warden: Error occurred: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO warden: Beginning recovery process...
 INFO warden: Recovery complete.
 INFO environment: Released process lock: machine-action-2392f3e1e78511e04d58877ac9a3965d
 INFO environment: Running hook: environment_unload
 INFO runner: Preparing hooks for middleware sequence...
 INFO runner: 1 hooks defined.
 INFO runner: Running action: #<Vagrant::Action::Builder:0x00000002f4c4f8>
ERROR vagrant: Vagrant experienced an error! Details:
ERROR vagrant: #<Vagrant::LXC::Errors::ExecuteError: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.>
ERROR vagrant: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
ERROR vagrant: /root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/sudo_wrapper.rb:47:in `block in execute'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/retryable.rb:17:in `retryable'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/sudo_wrapper.rb:37:in `execute'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/sudo_wrapper.rb:17:in `run'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/driver.rb:102:in `share_folder'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/synced_folder.rb:41:in `block in prepare'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/synced_folder.rb:21:in `each'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/synced_folder.rb:21:in `prepare'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/synced_folders.rb:80:in `block in call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/synced_folders.rb:78:in `each'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/synced_folders.rb:78:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/synced_folder_cleanup.rb:28:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/synced_folders/nfs/action_cleanup.rb:25:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/action/prepare_nfs_valid_ids.rb:14:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:160:in `handle'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:42:in `block in call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb:41:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/env_set.rb:19:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/provision.rb:80:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/call.rb:53:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/box_check_outdated.rb:68:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/action/create.rb:33:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/root/.vagrant.d/gems/gems/vagrant-lxc-1.1.0/lib/vagrant-lxc/action/handle_box_metadata.rb:41:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/handle_box.rb:56:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/call.rb:53:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/warden.rb:34:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/builder.rb:116:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `block in run'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/util/busy.rb:19:in `busy'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/action/runner.rb:66:in `run'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:214:in `action_raw'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:191:in `block in action'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:516:in `lock'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `call'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/machine.rb:178:in `action'
/opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/batch_action.rb:82:in `block (2 levels) in run'
 INFO interface: error: There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
There was an error executing ["sudo", "mkdir", "-p", "/dev/linux/lxc_testvagrant/vagrant"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
 INFO interface: Machine: error-exit ["Vagrant::LXC::Errors::ExecuteError", "There was an error executing [\"sudo\", \"mkdir\", \"-p\", \"/dev/linux/lxc_testvagrant/vagrant\"]\n\nFor more information on the failure, enable detailed logging by setting\nthe environment variable VAGRANT_LOG to DEBUG."]
@fgrehm
Copy link
Owner

fgrehm commented Apr 2, 2015

Before I dig into this, would you mind trying to reproduce that from within one of the VBox VMs available from https://github.com/fgrehm/vagrant-lxc-vbox-hosts?

@fpeterschmitt
Copy link
Author

Yes, i'll give a try on my machine.

@fpeterschmitt
Copy link
Author

So, same behavior, same message on a Debian 7 (not upgraded).

Do you want me to test on the latest and oldest Ubuntu you provide?

@ccope
Copy link
Contributor

ccope commented Apr 3, 2015

I think I remember this issue (I set up lxc + lvm about a year ago with a patched version of vagrant-lxc). The bug is here: https://github.com/fgrehm/vagrant-lxc/blob/master/lib/vagrant-lxc/driver.rb#L94-L101

In order to support shared folders on separate block devices, I think that check would have to be done via lxc-attach on a running container.

@ccope
Copy link
Contributor

ccope commented Apr 3, 2015

My hacky fix to stop shared folders from being created was this: ccope@045918b

Edit: You can't check for 'none' here, because mainline vagrant-lxc went with specifying "best" as the default. You could check for 'best' instead, and manually override your backingstore to be lvm, so you could then effectively disable shared folders.

Edit2: You can probably disregard my hacky fix. I had to preserve shared folders in my old setup for... reasons. This would probably be a non-issue if you just disabled all shared folders (including the default vagrant one). If you actually need them, the changes in my previous comment need to be made.

@fpeterschmitt
Copy link
Author

The real problem is rootfs storing the LV block device's path. This hack is ok for workaround but definitely not the solution.

Anyway, thanks for that, i'll use a local patched version of this plugin so I can build containers on LVM, but this issue should stay open until the solution for rootfs is found.

I may have time this -long- week end to watch for it.

@fpeterschmitt
Copy link
Author

cant wait to watch for

Well, seems like the lxc-template script is not setting the correct rootfs, maybe because "--rootfs" option is not passed to it. The LXC Vagrant driver get the rootfs from the LXC configuration file so…

If i hard-code the correct LXC_ROOTFS path in the template, the container creates correctly, and shared folder too.

@fgrehm
Copy link
Owner

fgrehm commented Apr 3, 2015

Sorry but I'm not familiar with LVM to better understand this :-/
The lxc-template that is provided with the plugin is based on the download script provided by Ubuntu's lxc template packages. does the script needs to be updated to grab latest goodies from upstream?

@fpeterschmitt
Copy link
Author

In fact, LVM setup works like a charm as it is handled by the lxc-create command.

I identified two problems, which are running that order:

  1. The lxc.rootfs is not set with the good value: /dev/<vgname>/<lvname> instead of /var/lib/lxc/testvagrant/rootfs/. Look at the debug log.
  2. The driver is post-reading the configuration file to retrieve the rootfs value (this is bad…), so the creation of shared folder cannot happen.

Here are my proposals:

The lxc-template given by you should be called with --rootfs <real lxc rootfs>, and --rootfs shall be a required parameter. Then, blindly set lxc.rootfs in the configuration with something like sed "s/lxc\.rootfs.*/lxc.rootfs=${LXC_ROOTFS}/g" -i ${LXC_PATH}/config.

<real lxc rootfs> should be fully handled by the vagrant-lxc driver, in (ruby) memory, not post-reading its value from configuration generation, see: https://github.com/fgrehm/vagrant-lxc/blob/master/lib/vagrant-lxc/driver.rb#L50

@fpeterschmitt
Copy link
Author

Correction to what I said with rootfs:

I've created an LXC container with lxc-1.0.x and rootfs is /dev/<vgname>/<lvname>, and it's ok because lxc-start will auto-mount/unmount the device so we don't need an fstab entry.

Hum. We need here something like rootfs_directory and a rootfs_device

If fact, the driver needs to be fully aware of the storage mode of the container. I believe it's the same for btrfs, isn't it?

@ccope
Copy link
Contributor

ccope commented Apr 5, 2015

I brought this issue up in the past: #235 (comment)

@leryan, try adding this line to your Vagrantfile inside the config block to work around the issue for the time being:
config.vm.synced_folder ".", "/vagrant", :disabled => true

Your Vagrantfile works for me when I add that. Except there's now a failure in vagrant halt where it tries to rm data in the tmp directory, thinking it is in /dev/linux/lxc_testvagrant/tmp/.

@fgrehm when using LVM (and presumably btrfs), the rootfs is not mounted in the host's mount namespace. The 'roofts' is a block device, such as /dev/lxc/container_name. Thus, trying to manipulate the container's filesystem from the host will fail. It looks like we can fix it for real now by replacing the existing shared folder mountpoint creation logic with a mount option: lxc/lxc#78 (comment)

I'll make a PR for the shared folder bit tomorrow. Filed #360 for the halt bug.

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

Successfully merging a pull request may close this issue.

4 participants