Skip to content

Instantly share code, notes, and snippets.

@PatrickLang
Last active August 7, 2018 16:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PatrickLang/ed91d78b67143adfe5bb78644c314f3d to your computer and use it in GitHub Desktop.
Save PatrickLang/ed91d78b67143adfe5bb78644c314f3d to your computer and use it in GitHub Desktop.
Notes on building Vagrant in Windows

Attempt 1

Installed http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.3.1.exe

cd C:\Users\Patrick\Source\vagrant
gem install bundler --version 1.12.5
bundle --binstubs exec
Fetching https://github.com/mitchellh/vagrant-spec.git
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies...
Installing rake 11.2.2
Installing addressable 2.4.0
Installing builder 3.2.2
Using bundler 1.12.5
Installing ffi 1.9.14
Installing safe_yaml 1.0.4
Installing diff-lcs 1.2.5
Installing unf_ext 0.0.7.2
Installing erubis 2.7.0
Installing fake_ftp 0.1.1
Installing hashdiff 0.3.0
Installing hashicorp-checkpoint 0.1.4
Installing httpclient 2.8.2.2
Installing i18n 0.7.0
Installing rb-fsevent 0.9.7
Installing ruby_dep 1.4.0
Installing little-plugger 1.1.4
Installing log4r 1.1.10
Installing multi_json 1.12.1
Installing mime-types-data 3.2016.0521
Installing mini_portile2 2.0.0
Installing net-ssh 3.0.2
Installing netrc 0.11.0
Installing nori 2.6.0
Installing rspec-core 2.14.8
Installing rspec-mocks 2.14.6
Installing rubyntlm 0.6.0
Installing rubyzip 1.2.0
Installing thor 0.18.1
Installing wdm 0.1.1 with native extensions

Gem::InstallError: The 'wdm' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Installing gyoku 1.3.1
Installing childprocess 0.5.9
Installing gssapi 1.2.0
Installing rb-inotify 0.9.7
Installing rb-kqueue 0.2.4
Installing crack 0.4.3
Installing rspec-expectations 2.14.5
Installing unf 0.1.4
Installing logging 2.1.0
Installing mime-types 3.1
Installing nokogiri 1.6.7.1

Gem::InstallError: nokogiri requires Ruby version < 2.3, >= 1.9.2.
Installing net-scp 1.1.2
Installing net-sftp 2.1.2
An error occurred while installing wdm (0.1.1), and Bundler cannot continue.
Make sure that `gem install wdm -v '0.1.1'` succeeds before bundling.

Fail - incompatible Ruby version

Attempt 2

Install Ruby 2.2.5 x86 http://dl.bintray.com/oneclick/rubyinstaller/rubyinstaller-2.2.5.exe

cd C:\Users\Patrick\Source\vagrant\
$ENV:Path = $ENV:Path + ';' + 'C:\Ruby22\bin\'
gem install bundler --version 1.12.5
bundle --binstubs exec
PS C:\Users\Patrick\Source\vagrant> bundle --binstubs exec
Fetching https://github.com/mitchellh/vagrant-spec.git
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies...
Installing rake 11.2.2
Installing addressable 2.4.0
Installing builder 3.2.2
Using bundler 1.12.5
Installing ffi 1.9.14
Installing safe_yaml 1.0.4
Installing diff-lcs 1.2.5
Installing unf_ext 0.0.7.2
Installing erubis 2.7.0
Installing fake_ftp 0.1.1
Installing hashdiff 0.3.0
Installing hashicorp-checkpoint 0.1.4
Installing httpclient 2.8.2.2
Installing i18n 0.7.0
Installing rb-fsevent 0.9.7
Installing ruby_dep 1.4.0
Installing little-plugger 1.1.4
Installing log4r 1.1.10
Installing multi_json 1.12.1
Installing mime-types-data 3.2016.0521
Installing mini_portile2 2.0.0
Installing net-ssh 3.0.2
Installing netrc 0.11.0
Installing nori 2.6.0
Installing rspec-core 2.14.8
Installing rspec-mocks 2.14.6
Installing rubyntlm 0.6.0
Installing rubyzip 1.2.0
Installing thor 0.18.1
Installing wdm 0.1.1 with native extensions

Gem::InstallError: The 'wdm' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Installing gyoku 1.3.1
Installing childprocess 0.5.9
Installing gssapi 1.2.0
Installing rb-inotify 0.9.7
Installing rb-kqueue 0.2.4
Installing crack 0.4.3
Installing rspec-expectations 2.14.5
Installing unf 0.1.4
Installing logging 2.1.0
Installing mime-types 3.1
Installing nokogiri 1.6.7.1
Installing net-scp 1.1.2
Installing net-sftp 2.1.2
An error occurred while installing wdm (0.1.1), and Bundler cannot continue.
Make sure that `gem install wdm -v '0.1.1'` succeeds before bundling.
PS C:\Users\Patrick\Source\vagrant>

FAIL - missing native tools?

Continue - install DevKit http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe

SFX extract to c:\Ruby22

C:\Ruby22\devkitvars.ps1
gem install wdm -v '0.1.1'

SUCCESS!

Now try bundle again

...
Using vagrant 1.8.6.dev from source at `.`
Bundle complete! 6 Gemfile dependencies, 53 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

That works, so now dev/test process is: in source directory

bundle --binstubs exec

In elevated window

$ENV:Path = $ENV:Path + ';' + 'C:\Ruby22\bin\'
ruby C:\Users\Patrick\Source\vagrant\exec\vagrant up

Issue around curl

I don't know what changed, but I can't get a successful run using the steps above as of Sept 15 2016. Both of my machines are failing looking for curl. This same error is in hashicorp/vagrant#6788, but I'm not convinced it's the same root cause yet

PS C:\Users\Patrick.coffee\Source\Repos\packer-windows> ruby ..\vagrant\exec\vagrant box add --name .\windows_2016_docke
r .\windows_2016_docker_hyperv.box
Vagrant appears to be running in a Bundler environment. Your
existing Gemfile will be used. Vagrant will not auto-load any plugins
installed with `vagrant plugin`. Vagrant will autoload any plugins in
the 'plugins' group in your Gemfile. You can force Vagrant to take over
with VAGRANT_FORCE_BUNDLER.

You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box '.\windows_2016_docker' (v0) for provider:
    box: Unpacking necessary files from: file://C:/Users/Patrick.coffee/Source/Repos/packer-windows/windows_2016_docker_
hyperv.box
    box:
The executable 'curl' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.

I downloaded http://www.paehl.com/open_source/?download=curl_750_2.zip and extracted curl.exe to c:\ruby22\bin\curl.exe, tried again, and it got further but still failed. I suspect the best goal here is to get CURB working instead on my Win32 setup and hopefully it won't need curl.exe. hmm.

PS C:\Users\Patrick.coffee\Source\Repos\packer-windows> ruby ..\vagrant\exec\vagrant box add --name .\windows_2016_docke
r .\windows_2016_docker_hyperv.box
Vagrant appears to be running in a Bundler environment. Your
existing Gemfile will be used. Vagrant will not auto-load any plugins
installed with `vagrant plugin`. Vagrant will autoload any plugins in
the 'plugins' group in your Gemfile. You can force Vagrant to take over
with VAGRANT_FORCE_BUNDLER.

You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box '.\windows_2016_docker' (v0) for provider:
    box: Unpacking necessary files from: file://C:/Users/Patrick.coffee/Source/Repos/packer-windows/windows_2016_docker_
hyperv.box
    box: Progress: 100% (Rate: 113M/s, Estimated time remaining: --:--:--)
The box failed to unpackage properly. Please verify that the box
file you're trying to add is not corrupted and try again. The
output from attempting to unpackage (if any):

x Vagrantfile
x Virtual Hard Disks\\WindowsServer2016TP5Docker.vhdx: Write failed
x Virtual Machines\\530E190E-FFED-445A-AEBC-452DE5F2498B.VMRS
x Virtual Machines\\530E190E-FFED-445A-AEBC-452DE5F2498B.vmcx
x Virtual Machines\\box.xml
x metadata.json
bin/bsdtar.EXE: Error exit delayed from previous errors.

For comparison, Vagrant 1.8.5 includes this curl.exe binary which works:

PS C:\Users\Patrick.coffee\.vagrant.d> C:\HashiCorp\Vagrant\embedded\bin\curl.exe --version
curl 7.45.0 (i386-pc-win32) libcurl/7.45.0 OpenSSL/1.0.2a zlib/1.2.8 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment