Installing Vagrant in non-supported environments

Get sources:

$ git clone git@github.com:mitchellh/vagrant.git
$ cd vagrant
$ git checkout tags/v1.6.5

Install dependencies:

$ gem install bundler -v '< 1.7.0'
$ bundle install

Patch Vagrant[1][2][3]:

diff --git a/bin/vagrant b/bin/vagrant
index 21630e1..5e24279 100755
--- a/bin/vagrant
+++ b/bin/vagrant
@@ -66,6 +66,8 @@ end

# Setup our dependencies by initializing Bundler. If we're using plugins,
# then also initialize the paths to the plugins.
+load_path = []
+$LOAD_PATH.each { |path| load_path << path }
require "bundler"
begin
Bundler.setup(:default, :plugins)
@@ -94,6 +96,7 @@ rescue Bundler::VersionConflict => e
$stderr.puts e.message
exit 1
end
+load_path.each { |path| $LOAD_PATH.push(path) unless $LOAD_PATH.include?(path) }

# Stdout/stderr should not buffer output
$stdout.sync = true
@@ -164,11 +167,6 @@ begin
logger.debug("Creating Vagrant environment")
env = Vagrant::Environment.new(opts)

- if !Vagrant.in_installer? && !Vagrant.very_quiet?
- # If we're not in the installer, warn.
- env.ui.warn(I18n.t("vagrant.general.not_in_installer") + "\n", prefix: false)
- end
-
begin
# Execute the CLI interface, and exit with the proper error code
exit_status = env.cli(argv)
diff --git a/lib/vagrant/bundler.rb b/lib/vagrant/bundler.rb
index 05867da..54f9fb8 100644
--- a/lib/vagrant/bundler.rb
+++ b/lib/vagrant/bundler.rb
@@ -18,8 +18,7 @@ module Vagrant
end

def initialize
- @enabled = true if ENV["VAGRANT_INSTALLER_ENV"] ||
- ENV["VAGRANT_FORCE_BUNDLER"]
+ @enabled = true
@enabled = !::Bundler::SharedHelpers.in_bundle? if !@enabled
@monitor = Monitor.new

---

Test and install:

$ rake test:unit
$ rake install

[1]: Without this patch Vagrant will give the following warning:

$ vagrant status

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.

[2]: Without this patch Vagrant will give the following error:

$ vagrant plugin install vagrant-aws

Installing the 'vagrant-aws' plugin. This can take a few minutes...
Vagrant's built-in bundler management mechanism is disabled because
Vagrant is running in an external bundler environment. In these
cases, plugin management does not work with Vagrant. To install
plugins, use your own Gemfile. To load plugins, either put the
plugins in the `plugins` group in your Gemfile or manually require
them in a Vagrantfile.

[3]: Without this patch Vagrant will give an error when running in a directory containing a Gemfile.

VMware ESXi MEMORY_SIZE_ERROR

VMware’s ESXi 5.5 increases the recommend memory requirement from 4GB to 8GB, their own System Requirements document stating that:

“You have 4GB RAM. This is the minimum required to install ESXi 5.5. Provide at least 8GB of RAM to take full advantage of ESXi features and run virtual machines in typical production environments.”

However when installing ESXi on a system with 4GB of RAM you will receive an error along the lines of:

<MEMORY_SIZE ERROR: This host has 3.71 GiB of RAM. 3.97 GiB are needed>

You’ll notice that the people writing the System Requirements document are using the SI unit of gigabyte (GB) while those writing the ESXi installer are using the binary unit of gibibyte (GiB). As such ESXi does not require 4,000,000,000 bytes of RAM but 4,294,967,296.

Luckily the fix is easy, we can modify the amount minimum amount of RAM the installer checks for and it will install without issue.

Switch to the virtual terminal by hitting Alt+F1 and login as ‘root’ with the password field blank.

After logging in you need to tweak the permissions on upgrade_precheck.py:

$ cd /usr/lib/vmware/weasel/util/
$ rm upgrade_precheck.pyc
$ cp upgrade_precheck.py upgrade_precheck.py.tmp
$ cp upgrade_precheck.py.tmp upgrade_precheck.py
$ chmod 777 upgrade_precheck.py

Open up upgrade_precheck.py in vi and replace:

MEM_MIN_SIZE = (4 * 1024 - 32) * SIZE_MiB

With:

MEM_MIN_SIZE = (2 * 1024 - 32) * SIZE_MiB

Then restart the ESXi installer by killing the weasel process.

$ ps -c | grep weasel
$ kill 12345

You will automatically get switched away from the virtual terminal and can continue the installation.