edwinallenz
edwinallenz

Reputation: 453

vagrant up fails with sed error message

Hello my vagrant starts failing boot with this message

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.

The vagrant boots, but the puppet manifests are not applied.

any suggestions how to fix it

Update: The vagrant up command fails before starting applying puppet manifests.

INFO interface: info: Configuring and enabling network interfaces... [default] Configuring and enabling network interfaces... DEBUG ssh: Checking whether SSH is ready... DEBUG ssh: Re-using SSH connection. INFO ssh: SSH is ready! INFO guest: Detect guest for machine:

DEBUG guest: Trying: pld DEBUG ssh: Re-using SSH connection. INFO ssh: Execute: cat /etc/pld-release

(sudo=false) DEBUG ssh: stderr: cat: /etc/pld-release DEBUG ssh: stderr: : No such file or directory

DEBUG ssh: Exit status: 1 DEBUG guest: Trying: suse DEBUG ssh: Re-using SSH connection. INFO ssh: Execute: cat /etc/SuSE-release (sudo=false) DEBUG ssh: stderr: cat: /etc/SuSE-release DEBUG ssh: stderr: : No such file or directory

DEBUG ssh: Exit status: 1 DEBUG guest: Trying: fedora DEBUG ssh: Re-using SSH connection. INFO ssh: Execute: grep 'Fedora release 1[678]' /etc/redhat-release (sudo=false) DEBUG ssh: stderr: grep: /etc/redhat-release DEBUG ssh: stderr: : No such file or directory

DEBUG ssh: Exit status: 2 DEBUG guest: Trying: ubuntu DEBUG ssh: Re-using SSH connection. INFO ssh: Execute: cat /proc/version | grep 'Ubuntu' (sudo=false) DEBUG ssh: stdout: Linux version 3.2.0-32-generic (buildd@batsu) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) ) #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012

DEBUG ssh: Exit status: 0 INFO guest: Detected: ubuntu! INFO guest: Full guest chain: [[:ubuntu,

], [:debian, #], [:linux, #]] INFO guest: Execute capability: configure_networks (ubuntu) DEBUG guest: Searching for

cap: configure_networks DEBUG guest: Checking in: ubuntu DEBUG guest: Checking in: debian DEBUG guest: Found cap: configure_networks in debian DEBUG ssh: Re-using SSH connection. INFO ssh: Execute: sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces (sudo=true) DEBUG ssh: stderr: sudo: no tty present and no askpass program specified

DEBUG ssh: stderr: Sorry, try again.

DEBUG ssh: stderr: sudo: no tty present and no askpass program specified

DEBUG ssh: stderr: Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: 3 incorrect password attempts

DEBUG ssh: Exit status: 1 ERROR warden: Error occurred: 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

Upvotes: 1

Views: 3680

Answers (2)

bmcgavin
bmcgavin

Reputation: 203

For me this problem was caused by the vagrant user not being able to run sudo without a password.

Logging in to the guest (through gui mode) and making sure the vagrant user was set up like so in /etc/sudoers was the fix :

vagrant ALL=(ALL) NOPASSWD: ALL

Run 'visudo' as root in order to edit this file.

I actually had extra fun because the .box file was set up correctly, but my puppet manifests overwrote sudoers with other groups - so the initial vagrant up ran fine, but subsequent provisions failed.

Upvotes: 2

Terry Wang
Terry Wang

Reputation: 13920

vagrant up is trying to remove any existing blocks like below

#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

in /etc/network/interfaces and inject a new block to enable default NAT networking mode.

sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces

The command removes the block generated by vagrant and redirect the output to a new file, it is a part of the vagrant up process, I believe. No idea why vagrant complains about a non-zero exit code. Even if there is no such code block, sed should return 0. May be a bug.

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

HTH

Upvotes: 0

Related Questions