我有一个似乎与此类似的问题:Berkshelf cookbooks are not being copied to the Vagrant directory,但我相信它是截然不同的。
当我运行一个流浪汉条款时,它失败了,声称它无法加载它尝试过的第一本食谱:
==> default: [2014-09-02T12:43:07+00:00] ERROR: Cookbook apt not found. If you're loading apt fr
om another cookbook, make sure you configure the dependency in your metadata
在加载时,我看到了正在挂载相应共享文件夹的消息:
==> default: Mounting shared folders...
default: /var/www => D:/Rob/VMs/vdd/data
default: /vagrant => D:/Rob/VMs/vdd
default: /tmp/vagrant-chef-3/chef-solo-2/roles => D:/Rob/VMs/vdd/chef/roles
default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks => C:/Users/29007/.berkshelf/default/vagr
ant/berkshelf-20140822-13996-1eqat7m-default
default: /tmp/vagrant-chef-3/chef-solo-3/data_bags => D:/Rob/VMs/vdd/chef/data_bags
他们确实在那里:
vagrant@vagrant-ubuntu-trusty-64:/tmp/vagrant-chef-3/chef-solo-1/cookbooks$ pwd
/tmp/vagrant-chef-3/chef-solo-1/cookbooks
vagrant@vagrant-ubuntu-trusty-64:/tmp/vagrant-chef-3/chef-solo-1/cookbooks$ ls
apache2 chef-sugar logrotate php yum
apt database my-cookbook postgresql yum-epel
aws dmg mysql runit yum-mysql-community
Berksfile.lock git mysql-chef_gem windows
build-essential iis openssl xfs
chef_handler iptables pacman xml
我的猜测是,不是试图从该位置加载它们,而是从主机上的vagrant目录中的cookbook加载它们。但是,我也有那里所有那些食谱的副本(我打算配置它,以便它不会依赖于Berkshelf)。
这是我的solo.rb的cookbook配置(安装为/vagrant/chef/solo.rb):
cookbook_path ["/vagrant/chef/cookbooks/berks", "/vagrant/chef/cookbooks/core", "/vagrant/chef/cookbooks/custom"]
似乎我的solo.rb文件似乎没有被读过?
更新 Tensibai在下面的评论中要求更完整的日志,所以这里是:
D:\Rob\VMs\vdd>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: Clearing any previously set forwarded ports...
Skipping Berkshelf with --no-provision
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
default: Adapter 2: hostonly
==> default: Forwarding ports...
default: 35729 => 35729 (adapter 1)
default: 8983 => 8983 (adapter 1)
default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
default: /var/www => D:/Rob/VMs/vdd/data
default: /vagrant => D:/Rob/VMs/vdd
default: /tmp/vagrant-chef-3/chef-solo-2/roles => D:/Rob/VMs/vdd/chef/roles
default: /tmp/vagrant-chef-3/chef-solo-1/cookbooks => C:/Users/29007/.berkshelf/default/vagr
ant/berkshelf-20140822-13996-1eqat7m-default
default: /tmp/vagrant-chef-3/chef-solo-3/data_bags => D:/Rob/VMs/vdd/chef/data_bags
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
D:\Rob\VMs\vdd>vagrant provision
Updating Vagrant's berkshelf: 'C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-1399
6-1eqat7m-default'
Resolving cookbook dependencies...
Fetching 'my-cookbook' from source at .
Using apache2 (2.0.0)
Using apt (2.5.3)
Using aws (2.4.0)
Using build-essential (2.0.6)
Using chef-sugar (2.2.0)
Using chef_handler (1.1.6)
Using database (2.3.0)
Using dmg (2.2.0)
Using git (4.0.2)
Using iis (2.1.2)
Using iptables (0.14.0)
Using logrotate (1.6.0)
Using my-cookbook (0.1.0) from source at .
Using mysql (5.4.4)
Using mysql-chef_gem (0.0.2)
Using openssl (2.0.0)
Using pacman (1.1.1)
Using php (1.4.6)
Using postgresql (3.4.2)
Using runit (1.5.10)
Using windows (1.34.2)
Using xfs (1.1.0)
Using xml (1.2.6)
Using yum (3.2.4)
Using yum-epel (0.4.0)
Using yum-mysql-community (0.1.10)
Vendoring apache2 (2.0.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-
1eqat7m-default/apache2
Vendoring apt (2.5.3) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/apt
Vendoring aws (2.4.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/aws
Vendoring build-essential (2.0.6) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-2014082
2-13996-1eqat7m-default/build-essential
Vendoring chef-sugar (2.2.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-139
96-1eqat7m-default/chef-sugar
Vendoring chef_handler (1.1.6) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-1
3996-1eqat7m-default/chef_handler
Vendoring chef_handler (1.1.6) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-1
3996-1eqat7m-default/chef_handler
Vendoring database (2.3.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996
-1eqat7m-default/database
Vendoring dmg (2.2.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/dmg
Vendoring git (4.0.2) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/git
Vendoring iis (2.1.2) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/iis
Vendoring iptables (0.14.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-1399
6-1eqat7m-default/iptables
Vendoring logrotate (1.6.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-1399
6-1eqat7m-default/logrotate
Vendoring my-cookbook (0.1.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13
996-1eqat7m-default/my-cookbook
Vendoring mysql (5.4.4) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1e
qat7m-default/mysql
Vendoring mysql-chef_gem (0.0.2) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822
-13996-1eqat7m-default/mysql-chef_gem
Vendoring openssl (2.0.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-
1eqat7m-default/openssl
Vendoring pacman (1.1.1) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1
eqat7m-default/pacman
Vendoring php (1.4.6) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/php
Vendoring postgresql (3.4.2) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-139
96-1eqat7m-default/postgresql
Vendoring runit (1.5.10) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1
eqat7m-default/runit
Vendoring windows (1.34.2) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996
-1eqat7m-default/windows
Vendoring xfs (1.1.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/xfs
Vendoring xml (1.2.6) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/xml
Vendoring yum (3.2.4) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996-1eqa
t7m-default/yum
Vendoring yum-epel (0.4.0) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20140822-13996
-1eqat7m-default/yum-epel
Vendoring yum-mysql-community (0.1.10) to C:/Users/29007/.berkshelf/default/vagrant/berkshelf-20
140822-13996-1eqat7m-default/yum-mysql-community
==> default: Running provisioner: shell...
default: Running: C:/Users/29007/AppData/Local/Temp/vagrant-shell20140902-9376-m72i1a.sh
==> default: stdin: is not a tty
==> default: +--------------------------------------+
==> default: | |
==> default: | ooooo oooo ooooooooo ooooooooo |
==> default: | 888 88 888 88o 888 88o |
==> default: | 888 88 888 888 888 888 |
==> default: | 88888 888 888 888 888 |
==> default: | 888 o888ooo88 o888ooo88 |
==> default: | |
==> default: +--------------------------------------+
==> default: Updating Chef to 11.12.4 version. This may take a few minutes...
==> default: Running provisioner: chef_solo...
Generating chef JSON and uploading...
==> default: Running chef-solo...
==> default: stdin: is not a tty
==> default: [2014-09-02T23:42:57+00:00] INFO: Forking chef instance to converge...
==> default: [2014-09-02T23:42:57+00:00] INFO: *** Chef 11.12.4 ***
==> default: [2014-09-02T23:42:57+00:00] INFO: Chef-client pid: 3195
==> default: [2014-09-02T23:43:05+00:00] INFO: Setting the run_list to ["role[vdd]"] from CLI op
tions
==> default: [2014-09-02T23:43:05+00:00] INFO: Run List is [role[vdd]]
==> default: [2014-09-02T23:43:05+00:00] INFO: Run List expands to [apt, apache2, mysql::client,
mysql::server, vdd::apache, vdd::graphviz, vdd::vdd_sites, vdd::php, vdd::uploadprogress, vdd::
mailcatcher, vdd::phpmyadmin, vdd::mysql, vdd::xdebug, vdd::git, vdd::webgrind, vdd::mc, vdd::ap
c, vdd::rsync, vdd::curl, vdd::composer, vdd::drush, vdd::vdd_help, vdd::vim, vdd::patchutils, v
dd::siege, vdd_example, desktop_tools]
==> default: [2014-09-02T23:43:05+00:00] INFO: Starting Chef Run for vagrant-ubuntu-trusty-64
==> default: [2014-09-02T23:43:05+00:00] INFO: Running start handlers
==> default: [2014-09-02T23:43:05+00:00] INFO: Start handlers complete.
==> default: [2014-09-02T23:43:06+00:00] ERROR: Running exception handlers
==> default: [2014-09-02T23:43:06+00:00] ERROR: Exception handlers complete
==> default: [2014-09-02T23:43:06+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stackt
race.out
==> default: [2014-09-02T23:43:06+00:00] ERROR: Cookbook apt not found. If you're loading apt fr
om another cookbook, make sure you configure the dependency in your metadata
==> default: [2014-09-02T23:43:06+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run p
rocess exited unsuccessfully (exit code 1)
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
答案 0 :(得分:1)
经过一些研究后,我认为你的问题来自HERE
vagrant-berkshelf插件看起来有些ENV变量以获得厨师配置,如果我理解它,它将覆盖您之前使用的任何厨师独奏配置。
确定所有这一切的根本原因的最佳方法是在VAGRANT_LOG env变量设置为info set VAGRANT_LOG=info
然后vagrant provision
您应该能够获取生成的client.rb文件的确切位置,以便在VM中检查它,并查看用于cookbook的路径。
希望它会有所帮助