简体   繁体   中英

precise64 vagrant box provisioning with Chef-solo fail

Installed on Mac OS X 1.9.2 Maverick

Initialized vagrant box

vagrant init .

Berksfile

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

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

Fetched cookbooks

$ berks vendor

Vagrantfile

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

Started the box

$ vagrant up

These errors appeared when I changed from chef/ubuntu-13.04 to hashicorp/precise64

The Errors

[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.

Any hint is welcome

Based on the output, the error is obvious. APT was not able to get the Vim package from the US mirror.

TO resolve the issue, run an apt-get update within the VM and try again, if issue persists, try to switch it to a different Ubuntu update mirror by editing /etc/apt/sources.list . eg switch to the main (with no us. prefix)

Try NOT to specify vim version in the vim cookbook, it is generally NOT a good idea at least for 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM