LoginSignup
5
6

More than 5 years have passed since last update.

vagrantをバージョンアップをしたら動かなくなったのを修正する。

Last updated at Posted at 2015-11-25

概要

もともと、test kitchen を回していたのだが、昨日から
いくつもテストが壊れていて、ログを見ると
かなり早い段階で、とまっていた。

昨日システムの更新をしていろいろパケージのバージョンが上がったためだと考えられた。
その中に vagrant があり、1.7.4 になった。

解決方法

最終的に、以下の方法にした。
実行前に、vagrantのpluginのリストを取得しておくこと。
また、以下のコマンドを実行したら、いままでとってきていたboxの元のイメージとか、vagrant-cachierのデータとかもなくなるので、
キャッシュに期待して、早く終了することが期待されるテストは失敗するときがある。

rm -rf ~/.vagrant.d

でてきたエラーログなど

gem の更新などもおこなったがどうもうまくいかなかった。
以下は特徴的なエラーにおもったので、メモ。

cannot load such file -- hitimes/hitimes

以下のログがでてきて、hitimes/hitimesに関して調べたところ
似たような問題の人はいたようだ。

kitchen converge default-ubuntu-1404
-----> Starting Kitchen (v1.4.1)
/home/hoge/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/webagent-cookie.rb:458: warning: already initialized constant HTTPClient::CookieManager
/home/hoge/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/httpclient-2.6.0.1/lib/httpclient/cookie.rb:8: warning: previous definition of CookieManager was here
-----> Creating <default-ubuntu-1404>...
      Vagrant failed to initialize at a very early stage:

      The plugins failed to load properly. The error message given is
      shown below.

      cannot load such file -- hitimes/hitimes
>>>>>> ------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 virtualbox ----
STDOUT:
STDERR: Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

cannot load such file -- hitimes/hitimes
---- End output of vagrant up --no-provision --provider virtualbox ----
Ran vagrant up --no-provision --provider virtualbox returned 1]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

一度削除して再インストールしてみた

gem uninstall hitimes
gem install hitimes

エラーが変わったくらいだった(と、おもう)

incopatible library version

その後、適当なディレクトリで、vagrant initできるか試してみた時のログ

$ vagrant init
Vagrant failed to initialize at a very early stage:

The plugins failed to load properly. The error message given is
shown below.

incompatible library version - /home/hoge/.vagrant.d/gems/gems/nio4r-1.1.0/lib/nio4r_ext.so

このあたりで、なにか大きな間違いをしているのかもしれないとおもい、
最終的にいたる。

rm -rf ~/.vagrant.d/

vagrant plugin も整理できたのでよしとする。

2017-11-14 vagrant-chef-zero

今回は、vagrantではなく VirtualBox を更新したところ、
また、同じような症状になり、.vagrant.d を mv してもう1度いれてみたところ、どうも vagrant-chef-zero をインストールするときにこけることがわかった

$ vagrant plugin install vagrant-chef-zero
Installing the 'vagrant-chef-zero' plugin. This can take a few minutes...
Fetching: mixlib-log-1.7.1.gem (100%)
Fetching: hashie-2.1.2.gem (100%)
Fetching: libyajl2-1.2.0.gem (100%)
Building native extensions.  This could take a while...
Fetching: ffi-yajl-1.4.0.gem (100%)
Building native extensions.  This could take a while...
Bundler, the underlying system Vagrant uses to install plugins,
reported an error. The error is shown below. These errors are usually
caused by misconfigured plugin installations or transient network
issues. The error from Bundler is:

ERROR: Failed to build gem native extension.

    current directory: /home/hogehoge/.vagrant.d/gems/2.4.2/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
/opt/vagrant/embedded/bin/ruby -r ./siteconf20171114-22122-150gr.rb extconf.rb
 -I/home/hogehoge/.vagrant.d/gems/2.4.2/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include -I/opt/vagrant/embedded/include -I/vagrant-substrate/cache/ruby-2.4.2/include -O3 -fPIC
 -L/home/hogehoge/.vagrant.d/gems/2.4.2/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib -L. -L/opt/vagrant/embedded/lib -Wl,-rpath=XORIGIN/../lib:/opt/vagrant/embedded/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/opt/vagrant/embedded/lib  -Wl,-rpath,/opt/vagrant/embedded/lib
checking for yajl/yajl_tree.h... yes
creating Makefile

current directory: /home/hogehoge/.vagrant.d/gems/2.4.2/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR=" clean

current directory: /home/hogehoge/.vagrant.d/gems/2.4.2/gems/ffi-yajl-1.4.0/ext/ffi_yajl/ext/encoder
make "DESTDIR="
compiling encoder.c
encoder.c: In function ‘Init_encoder’:
encoder.c:382:20: error: ‘rb_cFixnum’ undeclared (first use in this function)
   rb_define_method(rb_cFixnum, "ffi_yajl", rb_cFixnum_ffi_yajl, 2);
                    ^~~~~~~~~~
encoder.c:382:20: note: each undeclared identifier is reported only once for each function it appears in
encoder.c:383:20: error: ‘rb_cBignum’ undeclared (first use in this function)
   rb_define_method(rb_cBignum, "ffi_yajl", rb_cBignum_ffi_yajl, 2);
                    ^~~~~~~~~~
Makefile:241: recipe for target 'encoder.o' failed
make: *** [encoder.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/hogehoge/.vagrant.d/gems/2.4.2/gems/ffi-yajl-1.4.0 for inspection.
Results logged to /home/hogehoge/.vagrant.d/gems/2.4.2/extensions/x86_64-linux/2.4.0/ffi-yajl-1.4.0/gem_make.out
5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6