Vagrant does not start correctly and not mount sha

2019-09-18 15:13发布

问题:

when I do vagrant up I get this:

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/network/interfaces > /tmp/vagrant-network-interfaces

And synced folders are not available. How to fix this? I use

Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

回答1:

When you run vagrant up, it'll inject the configuration like below into /etc/network/interfaces file to enable default NAT networking mode.

#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
auto eth1
iface eth1 inet dhcp
    post-up route del default dev $IFACE
#VAGRANT-END

This command sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces removes the block generated by vagrant and redirect the output to a new file. No idea why vagrant complains about a non-zero exit code. Even if there is no such code block, sed should return 0.

Try to enable debug output VAGRANT_LOG=debug vagrant up and see if it gives more information.

NOTE: Vagrant 1.3.0 has just been released. Try to upgrade your vagrant + virtualbox combo to latest versions.