vagrant-lxc从测试厨房运行时无法启动

时间:2014-05-05 19:23:04

标签: vagrant lxc test-kitchen

我正在尝试使用LXC来运行测试厨房。当我使用以下.kitchen.yml

driver:
  name: vagrant

provisioner:
  name: chef_solo
platforms:
   - name: ubuntu-12.04
     driver:
       box: precise-lxc
       provider: lxc

kitchen-converge失败,输出如下:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider=lxc ----
STDOUT: 
STDERR: The `lxc` package does not seem to be installed or is not accessible on the PATH.
---- End output of vagrant up --no-provision --provider=lxc ----
Ran vagrant up --no-provision --provider=lxc returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

我可以成功运行sudo which lxc-create,我已将用户更改为/ etc / sudoers中的'NOPASSWD'。如果我在.kitchen / kitchen-vagrant / default-ubuntu-1204 VM中运行vagrant up,我可以vagrant ssh进入它,并且可以在主机系统上看到它与lxc-ls一起运行。< / p>

我试图深入研究vagrant-lxc代码,并在lib / vagrant-lxc / provider.rb中暂时注释掉了 ensure_lxc_installed!kitchen converge失败并显示以下消息:

-----> Starting Kitchen (v1.2.1)
-----> Creating <default-ubuntu-1204>...
   Bringing machine 'default' up with 'lxc' provider...
   ==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
   ==> default: This is a bug with the provider. Please contact the creator       
   ==> default: of the provider you use to fix this.
   ==> default: Importing base box 'precise-lxc'...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #create action: [Expected process to exit with [0], but received '1'
---- Begin output of vagrant up --no-provision --provider=lxc ----
STDOUT: Bringing machine 'default' up with 'lxc' provider...
==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead.
==> default: This is a bug with the provider. Please contact the creator
==> default: of the provider you use to fix this.
==> default: Importing base box 'precise-lxc'...
STDERR: There was an error executing ["sudo", "rm", "/usr/share/lxc/templates/lxc-vagrant-tmp-default-ubuntu-1204_default_1399314523513_48531"]

For more information on the failure, enable detailed logging by setting
the environment variable VAGRANT_LOG to DEBUG.
---- End output of vagrant up --no-provision --provider=lxc ----
Ran vagrant up --no-provision --provider=lxc returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

环境:

  • Linux Mint 16,内核3.11.0-20
  • vagrant 1.5.4
  • vagrant-lxc 0.8
  • test-kitchen 1.2.1
  • lxc 1.0.0~alpha1-0ubuntu14.1
  • sudo 1.8.6p3-0ubuntu3.1

kitchen diagnose --all https://gist.github.com/AlexeyDemidov/11544964

的输出

1 个答案:

答案 0 :(得分:2)

我已经用简单的puts sudo which lxc-create替换了插件源中的'哪个lxc-create'的sudo_wrapper调用,并得到输出告诉我sudo需要tty。在/ etc / sudoers中注释掉'Defaults requiretty'这一行解决了这个问题。