vagrant-cachierはvagrant-vbguestと競合するっぽい

WindowsVagrant 1.9.1にcachier, vbguestのプラグインを入れた状態で、

Vagrant.configure("2") do |config|
  config.vm.box = "centos/7"
  config.vm.synced_folder ".", "/vagrant", type: "virtualbox"

  config.vm.provision "shell", inline: "sudo yum update -y kernel"

  config.cache.scope = :box
end

みたいなVagrantfileを用意。vagrant upして、続いてvagrand reloadすると、

$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'centos/7' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
[default] No installation found.
Loaded plugins: fastestmirror


Error making cache directory: /var/cache/yum/x86_64/7/base error was: [Errno 2] No such file or directory: '/var/cache/yum/x86_64'

==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

yum install -y kernel-devel-`uname -r` gcc binutils make perl bzip2

Stdout from the command:

Loaded plugins: fastestmirror


Stderr from the command:



Error making cache directory: /var/cache/yum/x86_64/7/base error was: [Errno 2] No such file or directory: '/var/cache/yum/x86_64'

こんな感じのログを吐いて失敗する。

vagrant reloadでなく、vagrant haltしてからvagrant upだったり、あるいはcachierプラグインが入っていなかったりする場合は問題ない。

(なお、もう一つVMが立ち上がっているためポートが競合しているが、そこは本題とは関係ない)

かなり調べても原因が確定できなかったのだが、とにかくvagrant reloadの場合、GuestAdditionsインストールのためのyum update前にcachierのディレクトリが用意できないとか、その辺の理由で失敗しているようだ。

この問題自体もやっかいだが、この問題を調べている途中に気付いた以下の点がさらに酷いと感じている。Vagrantは正直、仕事で使いたいと思わない。

  1. 公式ドキュメントに書いてある"The equivalent of running a halt followed by an up."が思い切り嘘であること。
  2. プラグインを一時的に無効にすることなどが不可能なこと。
  3. 同じVagrantfileでもインストールされているプラグイン次第で挙動が変わること。

つらい。

追記。

追試しやすいようVagrantfileを最小限にしたからアレな感じになったけど、yum updateでぜんぶ更新、とかやると(カーネルを更新しないよう除外していなければ)同じようになる。

じっさい、Ansibleでyum: name='*' state=latestしてはまった。