2023-11-27 10:05:22 -06:00
2023-08-13 00:15:23 -05:00
2023-08-25 11:51:45 -05:00
2023-08-23 16:26:13 -05:00
2023-08-25 11:51:45 -05:00
2023-08-23 16:26:13 -05:00
2023-08-13 00:15:23 -05:00
2023-08-11 21:46:51 -05:00
2022-05-04 08:58:41 -05:00
2022-06-08 01:39:37 -05:00
2023-08-03 14:44:02 -05:00
2023-08-17 09:26:35 -05:00
2023-08-10 14:10:58 -05:00

Building on Windows

  1. Be sure that Hyper-V is installed and enabled on your system
  2. Download and install packer.exe to your system, and add the folder it is in to your user's PATH environment variable
  3. Download the Windows ADK being sure to select at the least "Deployment Tools" from the feature set.
  4. To see more details, including a walkthrough, check this web page
  5. Be sure to add the install path for the Oscdimg tool to your Windows PATH.
  6. On my system, that path is "C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg"
  7. Open PowerShell (on my system I had to run as administrator), and ensure that you have access to python
  8. If you type "python" at the prompt and do not have it installed, it should prompt you to install from the Store
  9. Do not install the version downloaded from the Internet unless you know what you're doing
  10. Create a venv python -m venv .venv
  11. Activate it .\.venv\scripts\Activate.ps1
  12. Install the packages in requirements-windows.txt
  13. Try a build
  14. You can execute directly with the packer executable, if you want
  15. If you want to wrap up standard options, or build multiple versions/distros at once, use the build.xsh file
  16. xonsh build.xsh -d <distro> -b hyperv-iso.amd64 -v
  17. You can substitute out any of the options with -a to 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:

  1. From the Windows Start/Search type "Firewall"
  2. Click "Allow and App Through The Firewall"
  3. Click "Change Settings"
  4. Scroll all the way down to where you find the entries for the packer-hyperv plugin
  5. Ensure that all such plugin versions have the box on the left and BOTH boxes on the right checked
  6. Click "Ok"
  7. 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.

  1. Open Hyper-V Manager
  2. In the right hand side, click "Virtual Switch Manager..."
  3. Select the packer-x86_64 switch
  4. Set connection type to 'External'
  5. In your DHCP server, assign a static IP address to MAC address "00:00:de:ad:be:ef"
  6. 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
  7. 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
S
Description
No description provided
Readme
549 KiB
Languages
Shell 47%
HCL 26.7%
Nix 19.9%
Jsonnet 3.9%
Ruby 2.5%