我正在尝试使用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
环境:
kitchen diagnose --all
https://gist.github.com/AlexeyDemidov/11544964
答案 0 :(得分:2)
我已经用简单的puts sudo which lxc-create
替换了插件源中的'哪个lxc-create'的sudo_wrapper调用,并得到输出告诉我sudo需要tty。在/ etc / sudoers中注释掉'Defaults requiretty'这一行解决了这个问题。