I have installed Vagrant 2.2.16 on Windows 10 (Core i7 3.6 - 16GB memory). Regardless of a command, whatever I type takes too much time to execute. Even a simple vagrant version takes time. My Vagrantfile is as below.
Vagrant.configure('2') do |config|
config.vm.box = 'hashicorp/bionic64'
config.vm.provider 'hyperv'
end
Execution time
vagrant ssh takes more than 2 mins
vagrant destroy -f 3 mins
vagrant up 7-8 mins
I thought maybe memory is the issue so I allocated 2GB to test. It did not make any difference. Is there any way to speed things up? Has anyone experienced similar things on Windows with hyper-v?
Related
When I run vagrant up on Windows the first time, I expect it to download then cache the box. But if I run vagrant halt followed by vagrant up I end up having to wait 15 minutes for the machine to be downloaded and re-assembled; When I ran vagrant box list, it states that the base box for it is listed there, so what else do I have to do to use the cache?
default: Downloading: https://atlas.hashicorp.com/ubuntu/boxes/trusty64/vers
ions/20150902.0.0/providers/virtualbox.box
default: Progress: 94% (Rate: 301k/s, Estimated time remaining: 0:01:20))
I remember reading somewhere in the documentation that there's a config.vm.box_check_update that will cause it to check for updated versions of the current box on every vagrant up but I don't see it listed in the Vagrantfile for wordpress-vvv.
I have just studied Vagrant. My computer is Window 7 [32bit]. I have installed the latest version "vagrant_1.7.2" then I run commands to start visual machine but it has never completed. See picture below:
I try to search to resolve this problem, some one say that Vagrant using "default config" because my computer contain "Cygwin" program but when try to run Vagrant from new computer this bug still occur.
Here is content in my "Viagrantfile"
Vagrant.configure("2") do |config| config.vm.box =
"hashicorp/precise32" end
Please tell me how to solve this issue.
Thanks a lot!
I'm using Vagrant with the VMWare plugin. I've noticed that VMs upped using Vagrant are not displayed automatically in the VMWare Workstation GUI.
I can (manually) open them using File->Open... and selecting the .vagrant\machines\puppet\vmware_workstation\some-unique-id...vmx file. But that's a bit annoying. Using VirtualBox, vagrant VMs are automatically added and removed from the Virtualbox GUI.
Am I missing something or is that just not supported for VMWare boxes?
Reaons why I'm not just sticking with vagrant commands:
To quickly see which machines are running (I have multiple machine setups and yes, I know vagrant status does the same...)
To create and restore snapshots (I have a time consuming provisioning and sometimes it's nice to just restore to a snapshot while testing)
I didn't get #mmey's exact solution to work, but putting this in the Vagrantfile worked for me:
config.vm.provider "vmware_fusion" do |v|
v.gui = true
end
Documentation
I don't think there's much to do about #1, it looks like VMWare limitation.
However you can use this Vagrant plugin to add snapshot ability from the command line.
I found the (not so surprising) answer to my question: Just disable headless mode by setting config.vm.provider.gui=true in the Vagrantfile (as described at https://docs.vagrantup.com/v2/vmware/configuration.html).
I am on a Mac OS X Mavericks trying to run a Vagrant Windows 7 box (http://aka.ms/vagrant-win7-ie11).
Also I have installed the vagrant-windows plugin and have configured the Vagrantfile with the following properties:
PS: Don't consider the syntax below. It's just to represent what is configured in my file.
gui = true
memory = 2048
cpu = 2
So when I run the 'vagrant up' command I get this output:
gyo-macbook:Win7 gyo$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'win7'...
it takes forever and I don't see any progress nor any changes in the VirtualBox related vm folder.
Is there any steps I have forgotten?
Thank you,
Gyo
Vagrant downloads the box the first time you vagrant up. After downloading it unpacks the box and imports it into VirtualBox. Windows boxes are fairly large 5+ GB, so expect the first vagrant up to take time to complete.
If you open the VirtualBox GUI while vagrant is doing it's thing, you will see when the box gets added to VirtualBox. You can also see if the box is booting up in the little preview window in VirtualBox.
After learning for a couple of days I am happy to have successfully set-up my VM and run the Laravel start page. Very happy there :)
Can someone clarify "when" to use the vagrant functions. My questions:
If I'm planning to turn off my computer should you use halt or suspend? (I am guessing halt) What if I forgot to do any of these two, would it be a problem?
Right after I just turn on my computer should I use up or resume?
What if I am putting my computer to sleep mode by shutting the lid down, is it necessary to vagrant suspend?
In short
1. Shutting down
The "shutdown" methods differ in speed when you turn off/on the VM and in the amount of disk space the VM will take. From faster/more disk consumption to slower/less disk consumption, the comands are: vagrant suspend, vagrant halt and vagrant destroy.
2. Turning on
Just use vagrant up. The difference between the "startup" methods is that vagrant resume will just "wake up" the VM while vagrant up will make some config checks before this. For example, it will check if your vagrant box has a newer version and will notify you that you can update, by running vagrant box update.
Also you can use vagrant resume only on a VM that was previously suspended. Timewise, there is no noticeable difference between the two when used on a suspended machine.
For more details see the documentation references below.
3. Sleep/hibernation
Putting your computer to sleep or even hibernating it should cause no harm. The former is just a low power state while the latter saves the RAM to the storage drives and then restores it when you start your computer. This is OS level stuff, unless sleep failure or other problems occur it shouldn't influence anything.
Referencing the documentation
The Vagrant documentation has a section for what the different commands do:
Suspending the virtual machine by calling vagrant suspend will save the current running state of the machine and stop it. When you're ready to begin working again, just run vagrant up, and it will be resumed from where you left off. The main benefit of this method is that it is super fast, usually taking only 5 to 10 seconds to stop and start your work. The downside is that the virtual machine still eats up your disk space, and requires even more disk space to store all the state of the virtual machine RAM on disk.
Halting the virtual machine by calling vagrant halt will gracefully shut down the guest operating system and power down the guest machine. You can use vagrant up when you're ready to boot it again. The benefit of this method is that it will cleanly shut down your machine, preserving the contents of disk, and allowing it to be cleanly started again. The downside is that it'll take some extra time to start from a cold boot, and the guest machine still consumes disk space.
Destroying the virtual machine by calling vagrant destroy will remove all traces of the guest machine from your system. It'll stop the guest machine, power it down, and remove all of the guest hard disks. Again, when you're ready to work again, just issue a vagrant up. The benefit of this is that no cruft is left on your machine. The disk space and RAM consumed by the guest machine is reclaimed and your host machine is left clean. The downside is that vagrant up to get working again will take some extra time since it has to reimport the
Also regarding vagrant up and vagrant resume:
Command: vagrant up
This command creates and configures guest machines according to your Vagrantfile.
This is the single most important command in Vagrant, since it is how any Vagrant machine is created. Anyone using Vagrant must use this command on a day-to-day basis
Command: vagrant resume
This resumes a Vagrant managed machine that was previously suspended, perhaps with the suspend command.
Or just look at how the output of the two command differ in your terminal:
$ vagrant resume
==> default: Resuming suspended VM...
==> default: Booting VM...
...
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: Resuming suspended VM...
==> default: Booting VM...
...
During vagrant up you can see the the check in acton. If for example there is a newer version of your box, you will get a notification:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'laravel/homestead' is up to date...
==> default: A newer version of the box 'laravel/homestead' is available! You currently
==> default: have version '0.3.3'. The latest is version '0.5.0'. Run
==> default: `vagrant box update` to update.
==> default: Resuming suspended VM...
==> default: Booting VM...
I usually use halt when I shut down my computer. When you suspend, I believe it stores the current stage image on disk. If you don't care about storage problem then you could use suspend.
If you suspended your VM then you should use resume so that last state is restored. If you just starting the VM, use "up"
I don't think it's necessary to suspend VM whenever when you hibernate your computer.
in short, if you use
$ vagrant suspend
then use
$ vagrant resume
but if you use
$ vagrant halt
then use
$ vagrant up