I'm problem with my Vagrant boxes. I had a number of boxes in operation, opened my Vagrantfile to add a new box config. Then when I ran vagrant up new_box, I was told that it could not boot and was subsequently placed in poweroff state. Now ALL my boxes are in poweroff state when I check vagrant status. The apps running on these boxes are still running though, but I can't ssh into them. I also cannot run vagrant halt, nothing seems to happen. When I run vagrant up port collisions occur.
In short, my Vagrant boxes are running (sort of), but they aren't really?
EDIT
I have tried destroying a box (rather than just halting) and then running vagrant up again, but the port is still occupied when I try to bring the box back up again... However, when I check netstat the host ports are not listed as in use by any application.
The problem was caused by an update of VirtualBox performed by the server admin (without me knowing). Also, a kernel update was being performed.
Related
I am pretty new to vagrant. I have installed an ubuntu 14.04 trusty box on my vagrant and will use it for my web development environment. I want to know which is the best way to disable/close/shutdown a vagrant box so that data in it remain safe in the next session? I mean when I want to shutdown my laptop (in windows 10, my host machine os is win10) there is a message telling me that virtualbox interface is open. so if I close the process then I cant access vagrant box anymore. I want a good way to close vagrant and run it in my next working session.
I read about vagrant halt before host shutdown and using vagrant up in next session but it takes too long to run a vagrant up.
**summary : I WANT A WAY TO DO THIS:
1- close a vagrant box without a data loss in it;
2- shutdown my laptop without seeing the message that tells virtualbox interface is open.
3- run vagrant box and access it with putty as fast as possible when I start working again.
is there a way to do this?**
thanks.
I want to know which is the best way to disable/close/shutdown a vagrant box so that data in it remain safe in the next session
I would not necessarily to recommend vagrant halt which will completely stop your VM and will need to start up after you restart your host.
You can run vagrant suspend which will hold your data and you will retrieve your instance in the same state as it was before on your next startup
You can read more about the differences between halt and suspend
Is it possible to configure the Vagrantfile, so vagrant box update run automatically when the box is starting via vagrant up?
No, it's not possible, as you can see in the Vagrant docs:
Using the Vagrantfile, you can also configure Vagrant to automatically check for updates during any vagrant up. This is enabled by default, but can easily be disabled with config.vm.box_check_update = false in your Vagrantfile.
When this is enabled, Vagrant will check for updates on every vagrant up, not just when the machine is being created from scratch, but also when it is resuming, starting after being halted, etc.
If an update is found, Vagrant will output a warning to the user letting them know an update is available. That user can choose to ignore the warning for now, or can update the box by running vagrant box update.
Vagrant can not and does not automatically download the updated box and update the machine because boxes can be relatively large and updating the machine requires destroying it and recreating it, which can cause important data to be lost. Therefore, this process is manual to the extent that the user has to manually enter a command to do it.
You can check more of the docs in this link
Hadoop & Vagrant: If I set up a new VM using these two packages, is the VM available for starting with VirtualBox or do I always have to use vagrant up?
When you first create the VM, you will need to use vagrant up since VirtualBox has no ability to read a Vagrantfile. Once your VM is up and running, you could stop and start it using VirtualBox. However, Vagrant can perform the same operations as VirtualBox and has a lot of advantages on top of that.
First let's discuss how Vagrant can do what VirtualBox can do. You can use vagrant suspend to put the VM in a saved state, vagrant resume to start it again, vagrant halt to power it off, and vagrant destroy to delete it. You can also use settings in Vagrant's VirtualBox provider to modify your VM's memory, CPUs, and more. You can also change the network settings and synced folders. And this gives you the advantage of defining all of these settings in code which can be checked into a revision control system such as Git.
On top of all this, Vagrant has support for provisioners. These range from something as simple as shell scripts to full blown configuration management tools such as Puppet, Chef, Ansible, and Salt. Just like you can define your VM's VirtualBox settings in code, you can define the entire creation process including installing packages, managing services, and customizing files. And you can make changes at any time and apply them using vagrant provision.
So getting back to your question... yes, you can control your VM directly with VirtualBox, but you'd be missing out on the rich feature set of Vagrant.
I'm new to vagrant, I'm using scotchbox.
I've configured a couple of vhosts in apache.
I guess the right way to do this would have been to change the provisionning of my box (as it's the aim of vaghrant right?) but i did the old school way by simpply editing my config files and so on...
Now my question is :
if i run vagrant destroy, do i loose all my configs?
is there any other command (vagrant halt, vagrant suspend?) that would allow me to reboot my host machine without loosing my config?
vagrant destroy will remove entire VM so any changes that were made manually will be lost. Vagrant halt only turns of the power so to speak so nothing is lost. If you run your machine again or reboot it all your data is save, just don't use --provision option that will recreate all initial configuration.
After following the vagrant tutorial everything seems to be going fine. However something new and slightly annoying has started happening when I run vagrant up: VirtualBox also starts up and I see a VM window which seems to correspond to the Vagrant VM open. I've used Vagrant many times in the past without this happening, and IIRC even for this current vm that I'm using VirtualBox wouldn't necessarily open just because I ran vagrant up.
What is causing this? Why does vagrant up cause the VirtualBox VM window to appear? (and steal focus from my Mac OS X Terminal window, which is quite annoying)
Note: The answer in my case is not that Vagrant uses VirtualBox. If this were the case then VirtualBox would have always been opening in the background and I'm quite sure this is a new behaviour.
I see three possibilities:
In your Vagrantfile, you configured gui = True (see GUI vs Headless)
The box you use with Vagrant comes with gui = True setting in its Vagrantfile (Box contains initial Vagrantfile which is being merged when you do vagrant up)
Possible bug in Vagrant and/or VirtualBox
It could be helpful if you specify your Vagrant & VirtualBox versions, and share with us your Vagrantfile.