The error occurs in an environment with:
- Host OS: Ubuntu 12.04
- VirtualBox 4.3
- Vagrant 1.5.1
- Box: centos-64-x64-vbox4210 (Puppet Labs)
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
default: Error: Connection timeout. Retrying...
First check if the VM is actually booting:
VBoxManage list runningvms
VBoxManage showvminfo [VM_UUID] --details
Modify your Vagrantfile to explicitly configure networking:
config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", host_ip: "127.0.0.1", auto_correct: true
config.vm.network "private_network", ip: "192.168.33.10"
Enable verbose SSH logging:
config.ssh.verbose = true
config.ssh.insert_key = false # Preserve default insecure key
Try manual SSH connection:
ssh -vvv -p 2222 -i ~/.vagrant.d/insecure_private_key vagrant@127.0.0.1
Connect to VM console to verify boot completion:
VBoxManage startvm [VM_UUID] --type emergencystop
VBoxManage startvm [VM_UUID] --type headless
For this particular CentOS box, try:
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
end
If SSH keys fail, try password authentication:
config.ssh.password = "vagrant"
config.ssh.username = "vagrant"
Increase timeout values:
config.vm.boot_timeout = 1200
config.ssh.timeout = 1200
When working with the CentOS 6.4 Vagrant box from Puppet Labs, many developers encounter SSH connection timeouts during vagrant up. The root cause typically lies in one of these areas:
1. Boot timeout too short (default 300s)
2. SSH key authentication configuration
3. NAT networking issues in VirtualBox
4. Box-specific initialization delays
First, try these quick fixes in your Vagrantfile:
config.vm.boot_timeout = 1200 # Double the default timeout
config.ssh.insert_key = false # For older boxes with pre-configured keys
config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
1. Verify Box Integrity
Before troubleshooting complex networking issues, ensure the box downloaded correctly:
$ vagrant box list
centos-64-x64-vbox4210 (virtualbox, 0)
$ vagrant box update
2. Manual SSH Inspection
Boot the VM and attempt manual SSH connection:
$ VBoxManage startvm "vm_name" --type headless
$ ssh -p 2222 -i ~/.vagrant.d/insecure_private_key vagrant@127.0.0.1
For CentOS 6.4 boxes specifically, these network tweaks often help:
Vagrant.configure("2") do |config|
config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh"
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
end
Check VirtualBox logs for startup issues:
$ VBoxManage showvminfo "vm_name" --machinereadable
$ tail -f ~/VirtualBox\ VMs/vm_name/Logs/VBox.log
Common findings might include:
00:00:05.361955 VMMDev: Guest Log: BIOS: Boot : bseqnr=1, bootseq=0231
00:00:05.362003 VMMDev: Guest Log: BIOS: Booting from Hard Disk...
If standard boot fails consistently, try this provisioning workaround:
config.vm.provision "shell", inline: <<-SHELL
sudo service network restart
sudo chkconfig sshd on
sudo service sshd start
SHELL
For Ubuntu 12.04 hosts specifically:
sudo apt-get install virtualbox-dkms
sudo /etc/init.d/vboxdrv setup
vagrant plugin install vagrant-vbguest