Mac, Virtualization

OSX 10.10 Yosemite Virtualization – ESXi installation from ISO

Download Yosemite. To Applications “Install OSX Yosemite.app”

Things changed since Mavericks so you can’t just convert the internal DMG to an ISO anymore.

#!/bin/bash
#
# This executable converts a Yosemite .app (which allows to upgrade a machine
# from Mac OS 10.6.7+ to Yosemite) into a Yosemite .dmg (which allows to
# install Yosemite from scratch on a machine).
#

set -x
set -e

# The first argument is the path to the .app bundle (the input of the
# executable).
inputApp="$1"
# The second argument is the path to the .dmg file (the output of the
# executable), which must end with ".dmg".
outputDmg="$2"
[ "${outputDmg: -4}" = .dmg ]

#
# The problem: /System/Installation/Packages inside /BaseSystem.dmg inside
# "$inputApp"/Contents/SharedSupport/InstallESD.dmg is a dangling symlink,
# which prevents installing Yosemite from scratch.
# The solution: Replace the symlink with the /Packages directory inside
# "$inputApp"/Contents/SharedSupport/InstallESD.dmg.
#

tmpDir=`mktemp -d -t 'Create Yosemite Installer'`
installMnt="$tmpDir"/install
installPkg="$installMnt"/Packages
outputMnt="$tmpDir"/output
outputPkg="$outputMnt"/System/Installation/Packages

cleanup() {
   if [ -d "$outputMnt" ]; then
      hdiutil detach "$outputMnt"
   fi

   if [ -d "$installMnt" ]; then
      hdiutil detach "$installMnt"
   fi

   rmdir -- "$tmpDir"
}

# Cleanup on failure.
trap cleanup ERR

# Mount InstallESD.dmg so we can access /BaseSystem.dmg and /Packages inside.
hdiutil attach "$inputApp"/Contents/SharedSupport/InstallESD.dmg \
   -mountpoint "$installMnt" -noverify -nobrowse

# Create "$outputDmg", a read/write copy of the read-only BaseSystem.dmg.
hdiutil convert "$installMnt"/BaseSystem.dmg -format UDRW -o "$outputDmg"

# Enlarge "$outputDmg" to accommodate for our modifications. The UDRW image
# format is not sparse, so we must precisely compute the new size.
curSectors=`hdiutil resize "$outputDmg" -limits | tail -1 | awk '{ print $2 }'`
extraSectors=`BLOCKSIZE=512 du -s -- "$installMnt" | awk '{ print $1 }'`
hdiutil resize "$outputDmg" -sectors $((curSectors + extraSectors))

# Mount "$outputDmg".
hdiutil attach "$outputDmg" -mountpoint "$outputMnt" -noverify -nobrowse

# Modify "$outputDmg".
rm -- "$outputPkg"
cp -r -- "$installPkg" "$outputPkg"

# It is the solution for the common error - The operation couldn't be completed. Undefined error: 0
cp "$installMnt"/BaseSystem.chunklist "$outputMnt"/BaseSystem.chunklist
cp "$installMnt"/BaseSystem.dmg "$outputMnt"/BaseSystem.dmg

# Cleanup on success.
trap ERR; cleanup

ls -alh -- "$outputDmg"

Make the above shell script executable and pass in the parameter of the downloaded .app and the output dmg.

Once you’ve done this use Disk Utility – Convert Image to DVD/CDR Master (it will have a .cdr extension but it’s an ISO) then rename the cdr to iso

Mount it in vmware and boot. It’ll boot properly now.

It didn’t see my vmware disk.. but you can launch Disk Utility within the OSX installer. From here, you can partition the virtual disk with a Journaled Mac OS filesystem. The installer will be able to continue.

Once finally into OSX, install vmware tools as normal and update OSX.

FYI, I’m doing this on a Mac Mini – for licensing compliance reasons. I haven’t tried it on regular ESXi hypervisor.

Screen Shot 2014-11-16 at 12.47.17 PM

Virtualization

Managing free ESXi 5.5 on a Mac

Found out the hard way that you can’t use the web interface of VMware 5.5 on the free ESXi server. You need the vCenter appliance, which needs a license.

If you don’t have a PC available, you can download VirtualBox and an appliance / pre-configured VM from Microsoft (of all places).

https://www.modern.ie/en-us/virtualization-tools#downloads

You’ll then be able to install the vSphere client to manage your ESXi instance.
By the way, you can use VMware Workstation 10 to connect to the ESXi instance if you need to use the new features of 5.5.

Not exactly a fantastic solution. A valid workaround, at least. One step closer to justifying the move to KVM…

HomeLab, Virtualization

Install ESXi 5.5 on 4GB machine (and a Mac Mini..)

Let’s say you’re waiting for more RAM to come in the post and you want to get your ESXi instance up, but you’ve only got 4GB RAM (Think Mac Mini). Well, there is a solution.

By the way, if you’re installing ESXi on a Mac Mini, you NEED to look at this blog:

Running ESXi 5.5/5.5u1 on Apple Mac Mini + Thunderbolt Ethernet Adapter Caveat

Let’s begin:

Boot the system from USB Stick with ESXi installer on it.
Once the installer welcome screen shows up, press alt+F1 to go to the first console (login prompt)
Login as root, no password.

# cd /usr/lib/vmware/weasel/util
::upgrade_precheck.py is where the magic happens.
# rm upgrade_precheck.pyc // (the compiled version)
# mv upgrade_precheck.py upgrade_precheck.py.old // because the file can not be edited due to some immortal flags and lack of tools to remove these flags
# cp upgrade_precheck.py.old upgrade_precheck.py
# vi upgrader_precheck.py // then search for line that has ((1024 * 2 ) – 32)
Replace the 32 with 64 and save (:w! in vi)
# ps -c | grep weas // find the PID
# kill -9 #### // where #### is the python PID

Return to the second console with installer (alt+F2)
Voila.