Vagrant up on Windows 10 with Hyper-V
Warning: This is essentially a brain dump, so it is more like a set of notes than a tutorial as such. I’m planning to clean this up and develop it as I go along. It’s incomplete. I’m publishing this, because otherwise it will sit as a draft probably forever. This is mostly me talking myself through troubleshooting, I do that a lot.
PREFACE:
There are a lot of interesting things happening in the Microsoft camp at the moment, especially to do with the convergence and maturity of some products and solutions.
A few examples of these are Windows Server 2016, Windows 10 and also the Hyper-V virtualisation platform.
In particular there are a few recent developments to be aware of, such as the upcoming Windows 10 ‘Anniversary Update’, which in my opinion will add a few significant updates and capabilities to Windows 10, namely the Hyper-V server based on Windows Server 2016.
So, of course this begs the question of what is so important about Hyper-V on Windows Server 2016, and why is this capability within Windows 10 so important? One simple answer would be: Docker.
For the uninitiated, Docker containers allow further containerisation and optimised usage of server resources, in the same effect that virtualisation such as Hyper-V (Also VMWare, VirtualBox and Xen Hypervisor) has enabled a single server to be containerised into multiple effective servers.
With the recent rise of microservices, and Microsofts release of Windows Nano Server, the modularised micro-servers allow horizontal scalability through “more of less”, rather than the “less of more” process of vertically scaling a single server through stacking multiple services within a single installation.
Another useful technology that is becoming increasingly important in todays world is of course: Vagrant.
Vagrant provides a framework for orchestrating and provisioning systems, within virtualised environments, which can then be configured using one of the numerous configuration management tools readily available (Chef, Puppet, Ansible and Microsofts own ‘DSC’ to name a few examples).
THE BASIC PLAN/TOOLS:
Foundation:
Windows 10 Pro
=> Base OS of host (You could use Windows Server 2016, I’m quite sure that 2012R2 would be suitable also)
Hyper-V
=> Setup VM/Container platform (Containers are supported after the Windows 10 Anniversary Update)
Orchestration & Configuration:
Vagrant
=> Sets up CentOS7 Linux ‘VM’ (Virtual Machine)
Docker
=> Setup ‘Container’ instance of app on VM
Ansible
=> Configure VMs and Containers using ‘Playbooks’
Additionally:
OpenSSH
=> used for ssh authentication
Jenkins
=> Automated code deployment
Git
/GitLab
/GitHub
=> Version tracking and code management
INTRODUCTION:
With these building blocks in mind, I wanted to produce my own local desktop environment which would mirror a dev/test/production environment, allowing straightforward deployment of software and services. As the Windows 10 Anniversary Update is still yet to go gold (at the time of this writing) and be released to the general public, I thought I would provision my own Docker environment in Windows 10, using Vagrant, and prepare for the fun to come.
I know I could go ahead and use preview builds of Windows 10 to use the new Hyper-V features before they are publicly released, but I’m not particularly concerned with using the pre-release version. Also, it is entirely possible to set this up in OS X or Linux, using Virtualbox (I plan to do this soon), but at this precise moment I’m focusing on Windows 10. I could also use Virtualbox, VMWare, Parallels etc on Windows, but I’m focusing on the (free) platform-native solution.
I want to use Windows 10 and Hyper-V because everyone would have this available to them, so this should be reproducible, and useful for me to document and use again in future. Maybe someone on the interwebs might find it useful also. If you find it useful, maybe leave a comment.
My problem arose when I found limited straightforward advice online for setting up Windows 10 with Hyper-V and Vagrant, so I just jumped in and cobbled it together myself! At the bottom of this page I put details of my troubleshooting also, and solutions that I discovered. If you get an error, maybe try to do a CTRL+F and search for your vagrant error message.
ITEMS TO INSTALL
-Install Hyper-V
(At this time I’m using the Pre-Anniversary Win10 Hyper-V 10.0.10586.0, current latest)
If you want to do it manually:
Step-1 – Right click on the Windows button and select ‘Programs and Features’.
Step-2 – Select Turn Windows Features on or off.
Step-3 – Select Hyper-V and click OK.
Otherwise, using PowerShell:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
(reboot after)
More details:
https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/quick_start/walkthrough_install
-Install Vagrant
(At this time I’m using Vagrant 1.8.5, current latest)
https://www.vagrantup.com/downloads.html
(reboot after)
-Install Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
http://www.microsoft.com/en-us/download/details.aspx?id=8328
More details at:
http://superuser.com/questions/1017920/vagrant-cant-download-box
https://github.com/mitchellh/vagrant/issues/6754#issuecomment-168856576
-Install OpenSSH Client
(Required for ssh to work, or Authentication error)
Download OpenSSH for Windows from:
http://www.mls-software.com/opensshd.html
After installing OpenSSH, download Vagrant public key using PowerShell:
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub).Content "$env:USERPROFILE\.ssh/authorized_keys"
Setup a private key:
ssh-keygen
(Follow instructions, basically press enter a few times)
Force copy newly created private key over the Vagrant generated key:
Copy-Item $env:USERPROFILE\.ssh\id_rsa $env:USERPROFILE\.vagrant.d\insecure_private_key -Force
BASIC SETUP (Hyper-V)
-Setup Hyper-V Switch
(External works best, is simpler)
(Internal with External sharing also works fine)
More details at:
https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/quick_start/walkthrough_virtual_switch
-Hyper-V Switch setup script:
TBC
BASIC SETUP (vagrant)
-Setup and Enable 2FA on website
You’ll want to configure a Two-Factor-Authentication method on your Vagrant Atlas account.
You need to do this on the website. You can then generate a ‘Token’ that you can use for this system.
-This is important so that if your system is compromised or lost, you can disable its access via the site by deleting the token.
-It also means that you wont have actual credentials (Username+Password combination) stored on your system.
-Generate token (on Website), record for use, and setup locally
$Env:ATLAS_TOKEN = "YOURTOKENHERE"
and/or:
vagrant login --token YOURTOKENHERE
Or add manually to C:\Users\YOURUSERNAME\.vagrant.d\data\vagrant_login_token
vagrant login --check
(This didn’t work for me, always told me it was working)
-Set default provider as Hyper-V
$Env:VAGRANT_DEFAULT_PROVIDER = "hyperv"
Or set Vagrantfile default:
config.vm.provider "hyperv"
Order of providers:
https://www.vagrantup.com/docs/providers/basic_usage.html
Hyper-V provider docs:
https://www.vagrantup.com/docs/hyperv/
VAGRANT UP!
You should be ready to go at this point, to setup a new environment and ‘vagrant up’.
I created a custom vagrant box and uploaded it to ‘Atlas’, which streamlines a few issues I encountered related to smb support, so I’ll be using this box in my example.
-Download the required box to Vagrant for use (These are all hyperv boxes in Atlas)
vagrant box add KptnKMan/bluefhypervalphacentos7repack
-OPTIONAL: other CentOS7 Hyper-V boxes available that you could use
vagrant box add bluefedora/hyperv-alpha-centos7 vagrant box add serveit/centos-7
-Change dir to the root of where your vagrant systems will be stored
cd c:\programs\vagrant_stuff
-Make a new dir for your new vagrant machine
mkdir centos7 cd .\centos7\
-Initialise a new Vagrantfile, which can be customised later if needed
vagrant init KptnKMan/bluefhypervalphacentos7repack
A Vagrantfile
has been placed in this directory. You are now
ready to vagrant up
your first virtual environment! Please read
the comments in the Vagrantfile
as well as documentation on
vagrantup.com
for more information on using Vagrant.
-vagrant up your new environment!
vagrant up
-you should see:
Bringing machine 'default' up with 'hyperv' provider... default: Verifying Hyper-V is enabled... default: Importing a Hyper-V instance default: Cloning virtual hard drive... default: Creating and registering the VM... default: Successfully imported a VM with name: vagrantbox default: Starting the machine... default: Waiting for the machine to report its IP address... default: Timeout: 120 seconds default: IP: 192.168.137.107 default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 192.168.137.107:22 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... default: Machine booted and ready! default: Preparing SMB shared folders... default: You will be asked for the username and password to use for the SMB default: folders shortly. Please use the proper username/password of your default: Windows account. default: default: Username: kareem default: Password (will be hidden): default: Mounting SMB shared folders... default: C:/Programs/vagrant_stuff/centos7test => /vagrant
-Finally, delete the environment
vagrant destroy --force default: Stopping the machine... default: Deleting the machine...
-customise your new Vagrantfile?
If everything is configured correctly, you really shouldn’t need to modify your Vagrantfile.
Still, it would be a good idea to check it out and see if there is anything to configure.
The Vagrant docs have information on setting up your Vagrantfile to interact with the Hyper-V provider:
https://www.vagrantup.com/docs/hyperv/configuration.html
-Vagrant customisations
-TBC
TROUBLESHOOTING VAGRANT ERRORS:
I’ve lovingly collected all the issues and errors I ran into while setting up Vagrant, for the convenience of all who may need it.
I summarised everything quite roughly into a simple FAQ/Q&A format below of what error I encountered and how it should look afterward.
I put some reasoning explanation in some also.
ERROR 1:
PS C:\Programs\vagrant_stuff\centos7 vagrant up </pre> ==> Provider 'virtualbox' not found. We'll automatically install it now... The installation process will start below. Human interaction may be required at some points. If you're uncomfortable with automatically installing this provider, you can safely Ctrl-C this process and install it manually. ==> Downloading VirtualBox 5.0.10... This may not be the latest version of VirtualBox, but it is a version that is known to work well. Over time, we'll update the version that is installed. An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again.
SOLUTION 1:
You didn’t set the default provider specify “–provider hyperv” at the end eg:
vagrant up –provider hyperv
Otherwise check that the $Env:VAGRANT_DEFAULT_PROVIDER
variable is set correctly as described above
ERROR 2: Unable to download any boxes
</strong> PS C:\Programs\vagrant_stuff\centos7> vagrant box add serveit/centos-7 The box 'serveit/centos-7' could not be found or could not be accessed in the remote catalog. If this is a private box on HashiCorp's Atlas, please verify you're logged in via `vagrant login`. Also, please double-check the name. The expanded URL and error message are shown below: URL: [" https://atlas.hashicorp.com/serveit/centos-7 "] Error:
SOLUTION 2:
You didn’t install Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
Go install it!
Link: http://www.microsoft.com/en-us/download/details.aspx?id=8328
(I didn’t need to reboot)
More details here:
https://github.com/mitchellh/vagrant/issues/6754#issuecomment-168856576
WORKING 2:
</strong> PS C:\Programs\vagrant_stuff\centos7> vagrant box add serveit/centos-7 ==> box: Loading metadata for box 'serveit/centos-7' box: URL: https://atlas.hashicorp.com/serveit/centos-7 ==> box: Adding box 'serveit/centos-7' (v1.3.1) for provider: hyperv box: Downloading: https://atlas.hashicorp.com/serveit/boxes/centos-7/versions/1.3.1/providers/hyperv.box box: Progress: 100% (Rate: 2505k/s, Estimated time remaining: --:--:--) ==> box: Successfully added box 'serveit/centos-7' (v1.3.1) for 'hyperv'!
ERROR 3: Boot failure!
Boot failure. Reboot and Select proper Boot device
or Insert Boot Media in selected Boot device
SOLUTION 3:
You possibly installed the ‘vagrant-windows-hyperv’ plugin.
You don’t need this plugin, as ‘hyperv’ provider is included within vagrant since v1.5.
Details here: https://github.com/MSOpenTech/vagrant-windows-hyperv
You can verify by seeing if the file exists:
C:\Users\YOURUSERNAME\.vagrant.d\gems\gems\vagrant-windows-hyperv-1.0.3\lib\vagrant-windows-hyperv\monkey_patch\scripts\import_vm.ps1
The real file should be at:
C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.1\plugins\providers\hyperv\scripts\import_vm.ps1
You can remove by running:
PS> vagrant plugin uninstall vagrant-windows-hyperv
ERROR 4: guest system gets IPv6 address.
</strong> ==> default: Waiting for the machine to report its IP address... default: Timeout: 120 seconds default: IP: fe80::215:5dff:fe03:6f09 ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: :22 default: SSH username: vagrant default: SSH auth method: private key Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period.
SOLUTION 4:
Go to Ethernet properties and disable IPV6.
(NOTE: You will need to do this before you create your vSwitch. Delete switch first, disable, and recreate)
Untick IPV6 in properties.
It also helps to disable IPV6 for the vSwitch connection.
ERROR 5: Network IP timeout
</strong> PS C:\Programs\vagrant_stuff\centos7> vagrant up Bringing machine 'default' up with 'hyperv' provider... ==> default: Verifying Hyper-V is enabled... ==> default: Importing a Hyper-V instance default: Cloning virtual hard drive... default: Creating and registering the VM... default: Successfully imported a VM with name: CentOS 7 ==> default: Starting the machine... ==> default: Waiting for the machine to report its IP address... default: Timeout: 120 seconds Hyper-V failed to determine your machine's IP address within the configured timeout. Please verify the machine properly booted and the network works. To do this, open the Hyper-V manager, find your virtual machine, and connect to it. The most common cause for this error is that the running virtual machine doesn't have the latest Hyper-V integration drivers. Please research for your operating system how to install these in order for the VM to properly communicate its IP address to Hyper-V.
SOLUTION 5: Set a longer timeout in the VagrantFile
config.vm.provider 'hyperv' do |hv| hv.ip_address_timeout = 240 end
ERROR 6: token warning
Vagrant detected both the ATLAS_TOKEN environment variable and a Vagrant login token are present on this system. The ATLAS_TOKEN environment variable takes precedence over the locally stored token. To remove this error, either unset the ATLAS_TOKEN environment variable or remove the login token stored on disk: ~/.vagrant.d/data/vagrant_login_token In general, the ATLAS_TOKEN is more preferred because it is respected by all HashiCorp products.
SOLUTION 6:
As indicated , delete the file:
C:\Users\YOURUSERNAME\.vagrant.d\data\vagrant_login_token
It is better to use the Environment Variable ATLAS_TOKEN
(In PowerShell)
PS > Remove-Item $env:USERPROFILE\.vagrant.d\data\vagrant_login_token -Force
ERROR 7: smb fails to mount
</strong>PS C:\Programs\vagrant_stuff\centos7> vagrant up Bringing machine 'default' up with 'hyperv' provider... ==> default: Verifying Hyper-V is enabled... ==> default: Importing a Hyper-V instance default: Cloning virtual hard drive... default: Creating and registering the VM... default: Successfully imported a VM with name: vagrantbox ==> default: Starting the machine... ==> default: Waiting for the machine to report its IP address... default: Timeout: 240 seconds default: IP: fe80::215:5dff:fe03:6f26 ==> default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 192.168.137.53:22 default: SSH username: vagrant default: SSH auth method: private key default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Preparing SMB shared folders... default: You will be asked for the username and password to use for the SMB default: folders shortly. Please use the proper username/password of your default: Windows account. default: default: Username: kareem default: Password (will be hidden): ==> default: Mounting SMB shared folders... default: C:/Programs/vagrant_stuff/centos7 => /vagrant Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available. Please verify that the guest additions are properly installed in the guest and can work properly. The command attempted was: mount -t cifs -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3`,sec=ntlm,credentials=/etc/smb_creds_f04e15 3e4221d1587e72c76ac7d2aa23 //192.168.137.1/f04e153e4221d1587e72c76ac7d2aa23 /vagrant mount -t cifs -o uid=`id -u vagrant`,gid=`id -g vagrant`,sec=ntlm,credentials=/etc/smb_creds_f04e153e4221d1587e72c76ac7d 2aa23 //192.168.137.1/f04e153e4221d1587e72c76ac7d2aa23 /vagrant The error output from the last command was: mount: wrong fs type, bad option, bad superblock on //192.168.137.1/f04e153e4221d1587e72c76ac7d2aa23, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount. helper program) In some cases useful info is found in syslog - try dmesg | tail or so.
REASON7: cifs-utils needs to be parts of Vragrant box
In my experience, the vagrant box I downloaded did not have ‘cifs-utils’ installed, which is needed for smb share interaction.
I repackaged the "bluefedora/hyperv-alpha-centos7"
box to solve this, its available publicly as:
"KptnKMan/bluefhypervalphacentos7repack"
(May not work, totally pre-alpha!)
SOLUTION 7a: Workaround is to install cifs-utils
This workaround is a bit clunky, but works in the end.
Link:
https://github.com/puphpet/puphpet/issues/1930#issuecomment-166296966
(From within PowerShell)
PS C:\Programs\vagrant_stuff\centos7> vagrant ssh
(you will get the ssh credentials for connecting to your instance)
(If using putty, before connecting, you will need to use puttygen to convert the private_key file to a .ppk file)
(For convenience, save it in the same dir as private_key.ppk, then add that file to Pageant)
(If using the OpenSSH method above, you should be fine)
(connect to instance via putty/OpenSSH, username ‘vagrant’, password ‘vagrant’)
[vagrant@localhost ~]$ sudo yum install cifs-utils -y
(wait for install…)
[vagrant@localhost ~]$ exit
(Go back to PowerShell)
PS C:\Programs\vagrant_stuff\centos7> vagrant reload --provision
(This will now reload the VM configuration, and should then complete without issues.
SOLUTION 7b: Disable mounting of default /vagrant share
Add the following line to your vagrant file:
config.vm.synced_folder ".", "/vagrant", :disabled => true
Pro-tip: To enable a share, add following line (Will override disable line above):
config.vm.synced_folder “.”, “/vagrant”, create: true, group: “vagrant”, owner: “vagrant”
Another example:
config.vm.synced_folder “./website”, “/var/www”, create: true, group: “www-data”, owner: “www-data”
(This assumes there is a folder ‘website’ in the root of the VM directory, and will mount it, and set the permissions as specified)
ERROR8: Strange ruby error
</strong> PS C:\Programs\vagrant_stuff\centos7> vagrant up C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/util/platform.rb:85:in `block in windows_hyperv_admin? ': undefined method `include?' for # (NoMethodError) from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/util/platform.rb:89:in `call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/util/platform.rb:89:in `windows_hyperv_admin?' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/providers/hyperv/provider.rb:20:in `usable?' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/vagrantfile.rb:138:in `machine_config' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/vagrantfile.rb:45:in `machine' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/environment.rb:663:in `machine' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/plugin/v2/command.rb:177:in `block in with_target_vms' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/plugin/v2/command.rb:201:in `call' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/plugin/v2/command.rb:201:in `block in with_target_vms' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/plugin/v2/command.rb:183:in `each' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/plugin/v2/command.rb:183:in `with_target_vms' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/commands/up/command.rb:131:in `install_providers' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/plugins/commands/up/command.rb:85:in `execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/cli.rb:42:in `execute' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/lib/vagrant/environment.rb:302:in `cli' from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.8.4/bin/vagrant:174:in `'
SOLUTION8: Updated Vagrant 1.8.4 => 1.8.5
Need to investigate further
ERROR9: Authentication failures repeating
</strong>default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period. If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong. If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly, as well. If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value.
SOLUTION9: There is a known bug in Vagrant 1.8.5 (Will be fixed in 1.8.6)
Link:
https://github.com/mitchellh/vagrant/issues/7610
If you are using 1.8.5, you can download the updated version from PR #7611 using PowerShell:
PS> [IO.File]::WriteAllLines("C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.8.5\plugins\guests\linux\cap\public_key.rb", (Invoke-WebRequest -Uri https://raw.githubusercontent.com/Poohblah/vagrant/41063204ca540c44f9555bd11ba9e76c7307bec5/plugins/guests/linux/cap/public_key.rb).Content)
Alternatively, another workaround for the issue:
Install OpenSSH Client from:
http://www.mls-software.com/opensshd.html
Still error after installing OpenSSH?
Check %PATH% includes C:\Program Files\OpenSSH\bin
Lastly, add 2 lines to Vagrantfile:
config.ssh.private_key_path = “~/.vagrant.d/insecure_private_key”
config.ssh.insert_key = false
(This will prevent using system secure SSH key, but will only work well if Vagrant insecure private/public key is already added to authorized_keys file in system.)
WORKING9: It should look like this:
</strong> default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: default: Inserting generated public key within guest... default: Removing insecure key from the guest if it's present... default: Key inserted! Disconnecting and reconnecting using new SSH key... ==> default: Machine booted and ready! ==> default: Preparing SMB shared folders... default: You will be asked for the username and password to use for the SMB default: folders shortly. Please use the proper username/password of your default: Windows account. default: default: Username: kareem default: Password (will be hidden): ==> default: Mounting SMB shared folders... default: C:/Programs/vagrant_stuff/centos7 => /vagrant
Oct 16, 2016 at 9:42 pm
Thanks for all your work with the brain-dump. It has been invaluable in troubleshooting a number of windows/hyper-v issues. Esp. was having fun with Error 4 until I found this post.
LikeLike
Mar 31, 2017 at 9:34 am
Thanks, Kareem. Your notes prompted me to check for the DEFAULT_VAGRANT_PROVIDER environment param when ‘vagrant up –provider=hyperv’ couldn’t find the ‘hyperv’ provider for some reason. Its existence seems to be important for that integration.
I’ve put together a guided walkthrough for building a Windows Server 2016 box and launching it with Vagrant’s Hyper-V provider, if anybody is interested: https://anchorloop.com/2017/03/24/provisioning-windows-server-2016-with-vagrant-hyper-v-and-chef-part-1/
LikeLike
Mar 31, 2017 at 12:04 pm
Hey, thanks for responding and I’m glad it helped you. I’ll be sure to check out your article, its almost exactly something I’ve been looking to check out soon. 🙂
I’m planning on updating this, as its a bit of a mess, and adding a followup post on Docker and Kubernetes using Vagrant (As I’ve been doing this recently).
Watch this space.
LikeLike
Jul 20, 2017 at 7:30 am
This is amazing post Kareem!!! Thanks for sharing such a valuable information. Since early 2016 I must have tried getting started with vagrant and never managed to stay interested due to lack of Hyper-v related information. I tried some stuff with virtual box but I was interested in Hyper-v specifically. This is precise for someone who wants to start and also helpful for anyone who wants to get back on right track. I have started testing things. I will keep you posted if I find any new learning. Thanks again!!!
LikeLike
Jul 20, 2017 at 8:56 am
Hey thanks, I’m glad I was able to reach out to you and help you.
I’ve unfortunately been very busy and have not updated the blog with more Hyper-V developments I’ve been upto.
I’m going to make a better effort into it, as I find Hyper-V tutorials with current DevOps tools is very under represented.
Watch this space.
LikeLike
Sep 19, 2017 at 4:30 am
[…] was unsuccessful. I went to this blog and tried their advice from Solution 4, to disable the IPv6 settings on the virtual switch. No […]
LikeLike