Vagrant1.7.2でCentOS7.1 (chef/centos-7.1
) を使ったらエラーが出まくるという現象に遭遇しました。
症状
- vagrant upしたときに、多種多用なエラーが出る
- エラーは出たり出なかったりする。70%くらいの確率で発生する(感覚値)。
- vagrant reloadすると直る
どんなエラーか?
主に下記2点に絡むものです。
- プライベートネットワークでのIPアドレス割り当て
- vboxsfのマウント失敗
ネットワーク絡みのエラー
その1
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/sysconfig/network-scripts/ifcfg-enp0s8
その2
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
/sbin/ifdown
Stdout from the command:
Stderr from the command:
usage: ifdown <configuration>
その3
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
cat /tmp/vagrant-ifcfg- > /etc/sysconfig/network-scripts/ifcfg-
Stdout from the command:
Stderr from the command:
cat: /tmp/vagrant-ifcfg-: No such file or directory
vboxsfがらみ
/vagrantのマウント失敗
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
chown `id -u vagrant`:`id -g vagrant` /vagrant
Stdout from the command:
Stderr from the command:
chown: cannot access ‘/vagrant’: No such file or directory
"vboxsf" file system is not available
localapp: /tmp/vagrant-cache => /Users/DQNEO/.vagrant.d/cache/chef/centos-7.1
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant-cache /tmp/vagrant-cache
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant-cache /tmp/vagrant-cache
The error output from the last command was:
/sbin/mount.vboxsf: mounting failed with the error: No such file or directory
CentOS7.0を使えばエラー出なくなった。
どうやら、CentOS7.0 -> CentOS7.1 でNetworkManagerに関して大きな仕様変更があったようです。
ネットワークエラーはそれが原因っぽい。
(vboxsfのエラーと関係あるかは不明)
chef/centos-7.0
を使うようにしてみたら、嘘のように挙動が安定しました。
しばらくこれで運用してみようと思います。
関連Issue
https://github.com/mitchellh/vagrant/issues/5661
https://github.com/mitchellh/vagrant/pull/5709
上記(#5709) のパッチを手動であててみても解決しませんでした。