Skip to content

Instantly share code, notes, and snippets.

@jimmynotjim
Created November 18, 2013 16:17
Show Gist options
  • Save jimmynotjim/7530603 to your computer and use it in GitHub Desktop.
Save jimmynotjim/7530603 to your computer and use it in GitHub Desktop.
Fixing a hung Vagrant Box
I've run into this issue a few times and I finally found a solution that didn't involve blowing the box away and starting over. Here's the issue I kept having.
Vagrant would hang forever while booting, even though VirtualBox said the machine was running. When I tried ctrl+C it would say it's shutting down but still continue to hang. If I manually shut it down in VirtualBox it would shut down fine, but on restart have the same issue. Finally I found this and it essentially worked https://github.com/mitchellh/vagrant/wiki/%60vagrant-up%60-hangs-at-%22Waiting-for-VM-to-boot.-This-can-take-a-few-minutes%22
I don't have VBoxManage, but I do have the VirtualBox gui, so here's what I did:
1. Shut down the machine in VirtualBox gui w/ "Power Off"
2. Open the machine's settings and turn off both Adapter 1 and Adapter 2 under the Network tab.
3. Start the machine from the gui
4. It'll hang looking for network connections and eventually open to a prompt, enter `vagrant/vagrant`
5. Enter `sudo rm -Rf /var/lib/dhcp/*` to remove the dhcp leases
6. Power down the machine from the gui
7. Open the machine's settings and turn the two Adapters back on
8. Run `vagrant up` and then `vagrant reload` (I found the local. url wouldn't resolve until vagrant reloaded)
That's it, easy-peasy right…Glad I found this and it's better than rebuilding the machine by syncing down from one of the remotes, but yeah, it's still a giant pain. Good luck if it happens to you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment