2

安装在 Mac OS X 1.9.2 Maverick 上

初始化的流浪者盒子

vagrant init .

伯克斯文件

source "https://api.berkshelf.com"

cookbook "vim"
cookbook "git"
cookbook "npm"
cookbook "nvm"
cookbook "nodejs"

获取的食谱

$ berks vendor

流浪文件

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hashicorp/precise64"

  config.vm.network :forwarded_port, guest: 8080, host: 8081

  config.omnibus.chef_version = :latest

  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "berks-cookbooks"
    chef.add_recipe "vim"
    chef.add_recipe "git"
    chef.add_recipe "npm"
    chef.add_recipe "nvm"
    chef.add_recipe "nodejs"

  end

end

启动了盒子

$ vagrant up

当我从 chef/ubuntu-13.04 更改为 hashcorp/precise64 时出现这些错误

错误

[2014-05-07T13:03:23+00:00] INFO: *** Chef 11.12.4 ***
[2014-05-07T13:03:23+00:00] INFO: Chef-client pid: 1704
[2014-05-07T13:03:30+00:00] INFO: Setting the run_list to ["recipe[vim]", "recipe[git]", "recipe[npm]", "recipe[nvm]", "recipe[nodejs]"] from CLI options
[2014-05-07T13:03:30+00:00] INFO: Run List is [recipe[vim], recipe[git], recipe[npm], recipe[nvm], recipe[nodejs]]
[2014-05-07T13:03:30+00:00] INFO: Run List expands to [vim, git, npm, nvm, nodejs]
[2014-05-07T13:03:30+00:00] INFO: Starting Chef Run for precise64
[2014-05-07T13:03:30+00:00] INFO: Running start handlers
[2014-05-07T13:03:30+00:00] INFO: Start handlers complete.
[2014-05-07T13:03:31+00:00] INFO: WindowsPackage light-weight resource already initialized -- overriding!
[2014-05-07T13:03:31+00:00] WARN: Cloning resource attributes for package[curl] from prior resource (CHEF-3694)
[2014-05-07T13:03:31+00:00] WARN: Previous package[curl]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/npm/recipes/default.rb:26:in `from_file'
[2014-05-07T13:03:31+00:00] WARN: Current  package[curl]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nvm/recipes/default.rb:29:in `from_file'
[2014-05-07T13:03:31+00:00] WARN: Cloning resource attributes for package[build-essential] from prior resource (CHEF-3694)
[2014-05-07T13:03:31+00:00] WARN: Previous package[build-essential]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/build-essential/recipes/_debian.rb:24:in `block in from_file'
[2014-05-07T13:03:31+00:00] WARN: Current  package[build-essential]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nvm/recipes/default.rb:34:in `from_file'
[2014-05-07T13:03:31+00:00] WARN: Cloning resource attributes for package[libssl-dev] from prior resource (CHEF-3694)
[2014-05-07T13:03:31+00:00] WARN: Previous package[libssl-dev]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nodejs/recipes/install_from_source.rb:27:in `from_file'
[2014-05-07T13:03:31+00:00] WARN: Current  package[libssl-dev]: /tmp/vagrant-chef-1/chef-solo-1/cookbooks/nvm/recipes/default.rb:37:in `from_file'

================================================================================
Error executing action `install` on resource 'package[vim]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y install vim=2:7.3.429-2ubuntu2.1 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libgpm2 libpython2.7 python2.7 python2.7-minimal vim-common vim-runtime
  vim-tiny
Suggested packages:
  gpm python2.7-doc binfmt-support ctags vim-doc vim-scripts indent
The following NEW packages will be installed:
  libgpm2 libpython2.7 vim vim-runtime
The following packages will be upgraded:
  python2.7 python2.7-minimal vim-common vim-tiny
4 upgraded, 4 newly installed, 0 to remove and 62 not upgraded.
Need to get 5,603 kB/13.4 MB of archives.
After this operation, 28.1 MB of additional disk space will be used.
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7 amd64 2.7.3-0ubuntu3.1
  404  Not Found
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7-minimal amd64 2.7.3-0ubuntu3.1
  404  Not Found
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libpython2.7 amd64 2.7.3-0ubuntu3.1
  404  Not Found
STDERR: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.1_amd64.deb  404  Not Found
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7-minimal_2.7.3-0ubuntu3.1_amd64.deb  404  Not Found
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/libpython2.7_2.7.3-0ubuntu3.1_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---- End output of apt-get -q -y install vim=2:7.3.429-2ubuntu2.1 ----
Ran apt-get -q -y install vim=2:7.3.429-2ubuntu2.1 returned 100


Resource Declaration:
---------------------
# In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/vim/recipes/package.rb

 30:   package vim_base_pkg
 31: end



Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/vim/recipes/package.rb:30:in `block in from_file'

package("vim") do
  action :install
  retries 0
  retry_delay 2
  guard_interpreter :default
  package_name "vim"
  version "2:7.3.429-2ubuntu2.1"
  cookbook_name :vim
  recipe_name "package"
end



[2014-05-07T13:03:32+00:00] INFO: Running queued delayed notifications before re-raising exception
[2014-05-07T13:03:32+00:00] ERROR: Running exception handlers
[2014-05-07T13:03:32+00:00] ERROR: Exception handlers complete
[2014-05-07T13:03:32+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-05-07T13:03:32+00:00] ERROR: package[vim] (vim::package line 30) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y install vim=2:7.3.429-2ubuntu2.1 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
  libgpm2 libpython2.7 python2.7 python2.7-minimal vim-common vim-runtime
  vim-tiny
Suggested packages:
  gpm python2.7-doc binfmt-support ctags vim-doc vim-scripts indent
The following NEW packages will be installed:
  libgpm2 libpython2.7 vim vim-runtime
The following packages will be upgraded:
  python2.7 python2.7-minimal vim-common vim-tiny
4 upgraded, 4 newly installed, 0 to remove and 62 not upgraded.
Need to get 5,603 kB/13.4 MB of archives.
After this operation, 28.1 MB of additional disk space will be used.
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7 amd64 2.7.3-0ubuntu3.1
  404  Not Found
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main python2.7-minimal amd64 2.7.3-0ubuntu3.1
  404  Not Found
Err http://us.archive.ubuntu.com/ubuntu/ precise-updates/main libpython2.7 amd64 2.7.3-0ubuntu3.1
  404  Not Found
STDERR: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7_2.7.3-0ubuntu3.1_amd64.deb  404  Not Found
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/python2.7-minimal_2.7.3-0ubuntu3.1_amd64.deb  404  Not Found
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/p/python2.7/libpython2.7_2.7.3-0ubuntu3.1_amd64.deb  404  Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
---- End output of apt-get -q -y install vim=2:7.3.429-2ubuntu2.1 ----
Ran apt-get -q -y install vim=2:7.3.429-2ubuntu2.1 returned 100
[2014-05-07T13:03:32+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process 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.

欢迎任何提示

4

1 回答 1

4

根据输出,错误很明显。APT 无法从美国镜像获取 Vim 包。

要解决此问题,apt-get update请在 VM 中运行并重试,如果问题仍然存在,请尝试通过编辑将其切换到不同的 Ubuntu 更新镜像/etc/apt/sources.list。例如切换到主(没有us.前缀)

尽量不要在 vim 食谱中指定 vim 版本,至少对于 Debian/Ubuntu 而言,这通常不是一个好主意。

package("vim") do
  action :install
  retries 0
  retry_delay 2
  guard_interpreter :default
  package_name "vim"
  cookbook_name :vim
  recipe_name "package"
end
于 2014-05-08T01:26:25.267 回答