概要
vagrant upしたときに、ネットワークエラーが出ることがあったので、その対処方法のメモ。根本原因は別途要調査。
エラー内容
$ vagrant up
**snip**
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth1'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-eth1-1489021809-0' '/etc/sysconfig/network-scripts/ifcfg-eth1'
# attempt to force network manager to reload configurations
nmcli c reload || true
# Restart network
service network restart
Stdout from the command:
Restarting network (via systemctl): [FAILED]
Stderr from the command:
usage: ifdown <configuration>
Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.
変な名前のnetwork-scriptsを削除する
vagranにsshで入る。(上記のエラーが出ててもログインできます。)
ifcfg-enp0s3
こんな感じのやつを消す。
[vagrant]$ sudo rm -f /etc/sysconfig/network-scripts/ifcfg-xxxxxx
network restart
vagrant内で実行
[vagrant]$ sudo service network restart
vagrant reload
これで、vagrant up, reloadしてもエラーは出なくなった。
$ vagrant reload
以上