Vagrant troubleshooting

×

Error message

Deprecated function: The each() function is deprecated. This message will be suppressed on further calls in _menu_load_objects() (line 569 of /homepages/46/d762693627/htdocs/dc/includes/menu.inc).
Vagrant troubleshooting

Contents

 

Restarting Virtualbox

Sometimes if VMs won't boot, this does the trick:

sudo /Library/Application\ Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh restart

If you are running the VirtualBox desktop app, close it and wait 30 seconds before running this command.

Problem: "The following SSH command responded with a non-zero exit status."

You see a message like this when (re)booting one of your VMs:

The following SSH command responded with a non-zero exit status.

Vagrant assumes that this means the command failed!


/sbin/ifdown eth1 2> /dev/null

Stdout from the command:

Solution:

SSH into the VM (this should work despite the above message) and do the following:

# 1. Backup /etc/network/interfaces file:
sudo cp /etc/network/interfaces ~/interfaces-bak
 
# 2. Edit /etc/network/interaces and delete all the sections beginning "#VAGRANT-BEGIN" and ending "#VAGRANT-END":
sudo vim /etc/network/interfaces

Come out of the VM and reload it with "vagrant reload".

Problem: Vagrant up hangs on "d6phx: Warning: Connection timeout. Retrying..."

Solution:

This is often because the machine has rebooted and is waiting for a keypress on the boot options screen. Sometimes you can see this by starting VritualBox and looking at the small visualisation of the VM's screen.

To solve this, send an "enter" keystroke to the VM like this:

# Find the id of the box that is hanging
> vboxmanage list runningvms
"multi_nginx_1412756128427_77437" {5886ab44-3faa-4170-b17f-1f31c7ffd48f}
"multi_varnish_1412756566156_94034" {a68650fc-8b9a-46b6-ac79-dcd33857f53a}
"multi_d7_1414064745239_6304" {005e6773-7477-414d-bbfe-23744b3468cc}
"multi_db_1425890895546_92575" {b6e0b3f0-92d5-42c8-a5d2-6ec65f126d60}
"multi_d6phx_1428485040860_27963" {afd2ae2d-927e-46a3-b294-0862d1723d68}

# Send the "enter" key to the hanging VM:
vboxmanage controlvm multi_d6phx_1428485040860_27963 keyboardputscancode 1c

Problem: "Can't remove kext org.virtualbox.kext.VBoxDrv" when restarting Vagrant

Sometimes when restarting Vagrant you may see a message like this:

sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart
Unloading VBoxNetFlt.kext
Unloading VBoxDrv.kext
(kernel) Can't remove kext org.virtualbox.kext.VBoxDrv; services failed to terminate - 0xe00002c7.
Failed to unload org.virtualbox.kext.VBoxDrv - (iokit/common) unsupported function.
Error: Failed to unload VBoxDrv.kext
Fatal error: VirtualBox

Solution

Instead of "restart", use "stop" and then "start":

sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" stop
sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" start

Solution 2

Force kill vbox processes and then run the restart command above.

# List vbox processes
ps aux | grep -i vbox
 
# Force-kill the "VBoxHeadless" process:
kill -9 123456
 
# Restart
sudo "/Library/Application Support/VirtualBox/LaunchDaemons/VirtualBoxStartup.sh" restart

Problem: "Vagrant cannot forward the specified ports on this VM..."

Solution

It often works to do a "vagrant reload" on all the suspended (and perhaps running) boxes.

Problem: "Vagrant execute the capability 'change_host_name' on the detect guest OS 'linux', but the guest doesn't support that capability."

Solution

This is https://github.com/mitchellh/vagrant/issues/7625. It will be fixed in the next release, until then if its blocking you, you can patch vagrant yourself by the following step:

http://stackoverflow.com/questions/38636023/vagrant-not-supported-the-capability-change-host-name

Problem: "Vagrant SSH Authentication failure..."

Solution

Vagrant changed the behaviour between 1.6 and 1.7 versions and now will insert auto generated insecure key instead of the default one.

You can cancel this behaviour by setting config.ssh.insert_key = false in your Vagrantfile.

http://stackoverflow.com/questions/28471542/cant-ssh-to-vagrant-vms-using-the-insecure-private-key-vagrant-1-7-2