This repository contains a collection of tools and scripts to build FreeBSD
images using Packer for a variety of target providers.
To use this set of Packer templates, the following prerequisites is required:
Install a recent version of
Vagrant(you're on your own for this one)Install a recent version of
Packer:make install-packer
Install a recent version of
cfgt(1):make install-cfgt
Install one or more providers:
Vagrant- VMware Fusion
8.5.7or newer - VirtualBox
Important
If you are using VMware Fusion, VMware Fusion Pro is required in order to have headless booting of FreeBSD images. With VMware Fusion Pro, a new setting will appear under
Preferences->Network-> Uncheck theRequire authentication to enter promiscuous modebox.
The alternative is to add the following to your
Vagrantfile:Vagrant.configure("2") do |config| # ... config.vm.provider "vmware_fusion" do |v| v.gui = true end # ... endInstall the
sudocommand aliases to enable NFS synced folders. OnmacOS:make install-nfs-mac
Patch
Vagrant:make patch-vagrant
Verify dependencies are correctly installed:
make verify
Optional:
reSTdoc tools. Assumesvirtualenv(1)andpip(1)have been installed and are available inPATH:make install-rst2pdf
See the
README.rstin one of the top-level directories for details (e.g. 11/README, 12/README)To see the latest snapshot from a given release, run
show-latest.shwith the version number you want (and optionally the architecture as the 2nd argument, defaults toamd64):$ sh show-latest.sh 12.0 arch: amd64 checksum_url: https://download.FreeBSD.org/ftp/snapshots/ISO-IMAGES/12.0/CHECKSUM.SHA512-FreeBSD-12.0-CURRENT-amd64-20170526-r318945 iso_checksum: 8c76c3b4b7daf75bbaa100b3062a336a3df3a44d53bdce3912394e7c3512a4b51209fa27e857cec35a868725ca27e4c5b176159ccfe81252f25679b9bc059d98 iso_filename: FreeBSD-12.0-CURRENT-amd64-20170526-r318945-disc1.iso iso_url: https://download.FreeBSD.org/ftp/snapshots/ISO-IMAGES/12.0/FreeBSD-12.0-CURRENT-amd64-20170526-r318945-disc1.iso iso_version: 12.0 $ sh show-latest.sh 11.1 arch: amd64 checksum_url: https://download.FreeBSD.org/ftp/snapshots/ISO-IMAGES/11.1/CHECKSUM.SHA512-FreeBSD-11.1-PRERELEASE-amd64-20170525-r318893 iso_checksum: fa0467019f4b899f08b0567767597bb72c328cdeea131d1cd3d3cfc9971c1451c946a581a13fb37e19aadbd6dda925015c84e94578d585d252646da0ff3e715a iso_filename: FreeBSD-11.1-PRERELEASE-amd64-20170525-r318893-disc1.iso iso_url: https://download.FreeBSD.org/ftp/snapshots/ISO-IMAGES/11.1/FreeBSD-11.1-PRERELEASE-amd64-20170525-r318893-disc1.iso iso_version: 11.1 $ sh show-latest.sh 11.0 arch: amd64 checksum_url: https://download.FreeBSD.org/ftp/snapshots/ISO-IMAGES/11.0/CHECKSUM.SHA512-FreeBSD-11.0-STABLE-amd64-20170510-r318134 iso_checksum: 257d4fa23d4b0d6f3dbe5e1ffce2f834eecee92d2102911993346a663bd377037a10ca451bb4048eed67a4ed4fe3328b106eda647c5fb3a28414b6e306eb4a64 iso_filename: FreeBSD-11.0-STABLE-amd64-20170510-r318134-disc1.iso iso_url: https://download.FreeBSD.org/ftp/snapshots/ISO-IMAGES/11.0/FreeBSD-11.0-STABLE-amd64-20170510-r318134-disc1.iso iso_version: 11.0
- The VM is set to have 1024MB of RAM and a 20GB drive
- Vagrant NFS synced folders are enabled by
default and exported to the guest as
/local. - EFI bootloader doesn't work
Install
sudo(8)command specs for NFS shared folders:make install-nfs-mac
Vagrant NFS Shared Folders: There is a bug in Vagrant that prevents NFS shared folders from working. To apply a patch to work around this bug:
make patch-vagrant
Initialize Vagrant using:
vagrant init --minimal <box name>
Initialize Vagrant boxes using a specific
providerand clean up if there's a failure:vagrant up --provider=vmware_fusion --destroy-on-error
Start the Vagrant VM:
vagrant up
Connect to the VM:
vagrant ssh
Hack away
Tip
cd /localassuming NFS synced folders is workingSuspend the Vagrant VM:
vagrant suspend
Destroy a suspended VM:
vagrant destroy
See all images:
vagrant global-status
Packerconfig files are written using JSON5 and translated to regular JSON usingcfgt(1).To change the provider used to build an image, pass PROVIDER=<MY_PROVIDER_NAME> Defaults to
vmware-isobutvirtualbox,parallels,triton, and others may work for a given template.Packermay fail because thebsdinstallmenus have changed when building a-CURRENTor-STABLEimage. To identify and fix this, pass in a populatedEXTRA_OPTSvariable to GNUmake(1):make 11.1-20170519-zfs TARGET=vmware-iso EXTRA_OPTS="-var headless=false -debug"
(and submit a patch fixing the menu change).
If
Packerfails to connect via SSH to the instance to do the post-install it is possible there are too many SSH keys loaded in your agent. Prefix your GNUmake(1)command with env SSH_AUTH_SOCK=/dev/null ... or look at the output fromssh-add -lto see if you have more than 3x keys loaded.Joyent maintains a branch of Packer that supports native JSON5 (
f-json5). It periodically lags behindmasterbut should be reasonably up to date.
Patches welcome! Specifically, as new snapshots or releases are made, please feel free to submit PRs.