634aae8d75bfd9231fa17e17246dc933f1d46d1a
* Do some better linting * Update names, Packer version, and more * Do not lint on push * More linting and scripting * Cleanup shellcheck lint * Add Packer format check * Fix Packer formatting * Limit to only one * Remove generated HCL files * Only lint checked files * Use pipes instead * Improve attempt to build Actually go back to attempting to build boxes on GitHub. Maybe it will work better with this structure * Change to using environment files * Initialize plugins, first * More verbose usage of the file * Do the output properly this time * PACKER_LOG set to 1 * No need for python3 anymore * Limit to only one result * Choose a specific CPU model * Init separately * Update actions version * Add version outputting * Correct actions version * Try to execute qemu properly * Fix CPU model name * Do not over-subscribe GitHub runners * Try type instead of command to guard runs * Do not write to non-existent folder * Cache packer plugins * Use ~ instead of /home/greg * Try the proper path * Move to intelligent matrix * Set global env path * Add lots of waits for VBoxManage on hosted runners * Add more waits * Add more waits
Building on Windows
- Be sure that Hyper-V is installed and enabled on your system
- Download and install packer.exe to your system, and add the folder it is in to your user's PATH environment variable
- Download the Windows ADK being sure to select at the least "Deployment Tools" from the feature set.
- To see more details, including a walkthrough, check this web page
- Be sure to add the install path for the Oscdimg tool to your Windows PATH.
- On my system, that path is "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg"
- Open PowerShell (on my system I had to run as administrator), and ensure that you have access to python
- If you type "python" at the prompt and do not have it installed, it should prompt you to install from the Store
- Do not install the version downloaded from the Internet unless you know what you're doing
- Create a venv
python -m venv .venv - Activate it
.\.venv\scripts\Activate.ps1 - Install the packages in requirements-windows.txt
- Try a build
- You can execute directly with the
packerexecutable, if you want - If you want to wrap up standard options, or build multiple versions/distros at once, use the
build.xshfile xonsh build.xsh -d <distro> -b hyperv-iso.amd64 -v- You can substitute out any of the options with
-ato build "all" targets that match
Troubleshooting
Personally, I had issues where the Hyper-V networks were untrusted by Windows. This can manifest itself as the VMs that need to download Shell files from the Packer http server (NixOS, Archlinux, and others) being unable to reach the HTTP server on the host. To rectify this:
- From the Windows Start/Search type "Firewall"
- Click "Allow and App Through The Firewall"
- Click "Change Settings"
- Scroll all the way down to where you find the entries for the packer-hyperv plugin
- Ensure that all such plugin versions have the box on the left and BOTH boxes on the right checked
- Click "Ok"
- Try running your install again.
I also had an issue with my VMs getting a different IP address each time they booted, which means that the IP detected during install is not the same one during provisioning. In order to address this issue I had to setup a static IP address for the MAC address "00:00:de:ad:be:ef" in my network DHCP server and tell my machines to use external networking to reach it.
- Open Hyper-V Manager
- In the right hand side, click "Virtual Switch Manager..."
- Select the
packer-x86_64switch - Set connection type to 'External'
- In your DHCP server, assign a static IP address to MAC address "00:00:de:ad:be:ef"
- Personally, I use dnsmasq and my subnet is 10.42.2.1/16 for DHCP, so the appropriate config line is
dhcp-host=00:00:de:ad:be:ef,10.42.2.254 - The actual IP address you assign is unimportant, and if you need to spoof a different Mac address, edit the file
sources/hyperv-iso.pkr.hcl
Languages
Shell
47%
HCL
26.7%
Nix
19.9%
Jsonnet
3.9%
Ruby
2.5%