Please Fix This Error and Try Again Couldn t Open File Base Homestead
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Learning to Employ Vagrant on Windows ten
A few months ago, I went to DockerCon as a Microsoft representative. While I was there, I had the take a chance to enquire developers almost their favorite tools. The most common tool mentioned (outside of Docker itself) was Vagrant. This was interesting -- I was familiar with Vagrant, but I'd never actually used information technology. I decided that needed to change. Over the past week or two, I took some time to try information technology out. I got everything working eventually, but I definitely ran into some issues on the way. My pain is your gain -- here are my tips and tricks for getting started with Vagrant on Windows 10 and Hyper-Five. Notation: This is a supplement for Vagrant's "Getting Started" guide, non a replacement.
Tip 0: Install Hyper-5
For those new to Hyper-Five, make certain you've got Hyper-5 running on your auto. Our official docs listing the verbal steps and requirements.
Tip one: Ready Networking Correctly
Vagrant doesn't know how to prepare networking on Hyper-Five right at present (unlike other providers), and then information technology's up to you to become things working the way you like them. There are a few NAT networks already created on Windows 10 (depending on your specific build). Layered_ICS should work (merely is under active development), while Layered_NAT doesn't take DHCP. If y'all're a Windows Insider, yous tin effort Layered_ICS. If that doesn't work, the safest selection is to create an external switch via Hyper-V Director. This is the approach I took. If you go this route, a friendly reminder that the external switch is tied to a specific network adapter. Then if you make it for WiFi, it won't work when you hook up the Ethernet, and vice versa. [caption id="attachment_10175" align="aligncenter" width="879"] Instructions for adding an external switch in Hyper-V managing director[/caption].
Tip 2: Use the Hyper-V Provider
Unfortunately, the Getting Started guide uses VirtualBox, and you lot can't run other virtualization solutions alongside Hyper-V. You demand to change the "provider" Vagrant uses at a few dissimilar points. When you lot install your get-go box, add --provider:
vagrant box add together hashicorp/bionic64 --provider hyperv
And when yous kicking your first Vagrant environs, again, add --provider. Annotation: you might run into the mistake mentioned in Trick 4, then skip to there if you see something like "mount mistake(112): Host is down".
vagrant up --provider hyperv
Tip 3: Add together the basics to your Vagrantfile
Calculation the provider flag is a hurting to practise every single time yous run vagrant upwardly
. Fortunately, you tin ready upwardly your Vagrantfile to automate things for you. Subsequently running vagrant init
, modify your vagrant file with the post-obit:
Vagrant.configure(2) do |config| config.vm.box = "hashicorp/bionic64" config.vm.provider "hyperv" config.vm.network "public_network" end
One boosted trick hither: vagrant init
volition create a file that will appear to be full of commented out items. However, there is ane line not commented out: [explanation id="attachment_10185" marshal="aligncenter" width="879"] ](https://msdnshared.blob.core.windows.net/media/2017/07/VagrantFile_Blog.png) There is ane line not commented.[/caption] Brand sure you lot delete that line! Otherwise, you'll end upwards with an error like this:
Bringing machine 'default' upward with 'hyperv' provider... ==> default: Verifying Hyper-Five is enabled... ==> default: Box 'base' could non be found. Attempting to find and install... default: Box Provider: hyperv default: Box Version: >= 0 ==> default: Box file was non detected as metadata. Calculation it directly... ==> default: Calculation box 'base of operations' (v0) for provider: hyperv default: Downloading: base default: An error occurred while downloading the remote file. The mistake message, if any, is reproduced below. Delight prepare this mistake and try again.
For the image used in the "Getting Started" guide (hashicorp/bionic64), Vagrant tries to use SMBv1 for shared folders. Still, if you're like me and have SMBv1 disabled, this volition fail:
Failed to mount folders in Linux guest. This is unremarkably because the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the invitee and tin can work properly. The command attempted was: mount -t cifs -o uid=chiliad,gid=1000,sec=ntlm,credentials=/etc/smb_creds_e70609f244a9ad09df0e760d1859e431 //10.124.157.30/e70609f244a9ad09df0e760d1859e431 /vagrant The fault output from the last command was: mount error(112): Host is downward Refer to the mount.cifs(8) manual page (east.g. man mount.cifs)
Yous tin can check if SMBv1 is enabled with this PowerShell Cmdlet:
Get-SmbServerConfiguration
If you can live without synced folders, here's the line to add to the vagrantfile to disable the default synced binder.
config.vm.synced_folder ".", "/vagrant", disabled: true
If you lot can't, yous tin can endeavour installing cifs-utils in the VM and re-provision. You could also try another synced folder method. For example, rsync works with Cygwin or MinGW. Disclaimer: I personally didn't try either of these methods.
Tip five: Enable Dandy Hyper-V Features
Hyper-V has some useful features that improve the Vagrant experience. For example, a pretty substantial portion of the time spent running vagrant upwards
is spent cloning the virtual hard bulldoze. A faster style is to use differencing disks with Hyper-5. Yous can as well turn on virtualization extensions, which allow nested virtualization within the VM (i.e. Docker with Hyper-V containers). Here are the lines to add together to your Vagrantfile to add these features:
config.vm.provider "hyperv" do |h| h.enable_virtualization_extensions = true h.linked_clone = true finish
There are a many more customization options that can exist added here (i.e. VMName, CPU/Memory settings, integration services). Y'all can observe the details in the Hyper-V provider documentation.
Tip 6: Filter for Hyper-V uniform boxes on Vagrant Cloud
Yous tin find more boxes to apply in the Vagrant Cloud (formally called Atlas). They let yous filter by provider, and so it'due south easy to find all of the Hyper-5 compatible boxes.
Tip 7: Default to the Hyper-Five Provider
While calculation the default provider to your Vagrantfile is useful, information technology means you need to remember to do it with each new Vagrantfile you create. If you don't, Vagrant will trying to download VirtualBox when yous vagrant up
the first time for your new box. Over again, VirtualBox doesn't work alongside Hyper-V, so this is a problem.
PS C:\vagrant> vagrant up ==> Provider 'virtualbox' not found. Nosotros'll automatically install information technology now... The installation process will start below. Human being interaction may exist required at some points. If you're uncomfortable with automatically installing this provider, you can safely Ctrl-C this procedure and install it manually. ==> Downloading VirtualBox v.0.10... This may not be the latest version of VirtualBox, just it is a version that is known to piece of work well. Over time, we'll update the version that is installed.
You can set your default provider on a user level past using the VAGRANT_DEFAULT_PROVIDER environmental variable. For more options (and details), this is the relevant page of Vagrant's documentation. Here's how I prepare the user-level environment variable in PowerShell:
[Environment]::SetEnvironmentVariable("VAGRANT_DEFAULT_PROVIDER", "hyperv", "User")
Again, you can also set the default provider in the Vagrant file (see Trick 3), which volition prevent this issue on a per project basis. You can also just add --provider hyperv
when running vagrant up
. The choice is yours.
Wrapping Upwards
Those are my tips and tricks for getting started with Vagrant on Hyper-Five. If there are any you think I missed, or annihilation you remember I got wrong, let me know in the comments. Here's the consummate version of my simple starting Vagrantfile:
# -*- mode: ruby -*- # 6: gear up ft=ruby : # All Vagrant configuration is done below. The "2" in Vagrant.configure # configures the configuration version (we support older styles for # backwards compatibility). Delight don't alter it unless yous know what # yous're doing. Vagrant.configure("2") practice |config| config.vm.box = "hashicorp/bionic64" config.vm.provider "hyperv" config.vm.network "public_network" config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.provider "hyperv" practise |h| h.enable_virtualization_extensions = true h.linked_clone = true end end
Feedback
Submit and view feedback for
Source: https://docs.microsoft.com/en-us/virtualization/community/team-blog/2017/20170706-vagrant-and-hyper-v-tips-and-tricks
0 Response to "Please Fix This Error and Try Again Couldn t Open File Base Homestead"
Post a Comment