parallels / packer-plugin-parallels Goto Github PK
View Code? Open in Web Editor NEWPacker plugin for Parallels Builder
Home Page: https://www.packer.io/docs/builders/parallels
License: Mozilla Public License 2.0
Packer plugin for Parallels Builder
Home Page: https://www.packer.io/docs/builders/parallels
License: Mozilla Public License 2.0
When using the latest parallels plugin for packer and trying to create a vagrant box with a boot command option specified I get the following error:
2023-08-09T12:39:34-05:00: ==> parallels-iso.vm: Error running boot command: prlctl error: Unknown action: send-key-event
HCL template for vagrant box using parallels plugin, run build
Packer: 1.9.2
Packer-plugin-parallels: 1.1.1
Parallels: 18.3.2
Specifically trying to build this system https://github.com/chef/bento/blob/main/os_pkrvars/windows/windows-11-x86_64.pkrvars.hcl
MacOS: 13.5 Intel cpu
Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
When building an image with the parallels-pvm builder, packer seems to create a VM with a snapshot named "vagrant_linked_clone" and the resulting artifact with a snapshot included. I'm not sure if the builder explicitly chooses to use a linked clone or if it's the default, but it would be helpful to have some kind of control over this via a builder option. Despite the advantages of linked clones, having a VM without snapshots would be more convenient in some cases.
When chaining together multiple parallels-pvm builders, having standalone VMs without snapshots rather than linked clones can be more convenient for creating transportable vagrant boxes.
Maybe a new option in the builder config to provide control over snapshot/linked-clone options?
This issue was originally opened by @ladar in hashicorp/packer#11431 and has been migrated to this repository. The original issue description is below.
The Parallels DHCP is a bit temperamental. As such, a handful of things can cause it to assign guests new IP addresses during a reboot. What triggers the address changes varies, depending on the DHCP client configuration inside the guests, but for several of the distros I work with, applying operating system updates and/or changing the hostname before the reboot, both cause problems. Devuan 4.0 appears to be doing this consistently.
Install a basic Devuan 4.0 server environment. The IP address will sometimes change between when the installer finishes, and when the guest boots for the first time, but packer
seems to detect this change. Unfortunately if the IP changes after packer
has connected via SSH, it won't. Rather it will continue trying to connect to the previous IP address until the SSH timeout expires, and the build fails. Running these commands seemed to trigger the problem consistently for me.
# Update, and then install some stuff.
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get --assume-yes -o Dpkg::Options::="--force-confnew" update
apt-get --assume-yes -o Dpkg::Options::="--force-confnew" upgrade
apt-get --assume-yes -o Dpkg::Options::="--force-confnew" dist-upgrade
apt-get --assume-yes install vim net-tools mlocate psmisc
# Change the hostname.
printf "$(openssl rand -base64 12 | tr '[:upper:]' '[:lower:]' | tr -d '/' | tr -d '+' ).localdomain\n" > /etc/hostname
# Clear out the existing automatic ifup rules.
sed -i -e '/^auto/d' /etc/network/interfaces
sed -i -e '/^iface/d' /etc/network/interfaces
sed -i -e '/^allow-hotplug/d' /etc/network/interfaces
# Ensure the loopback, and default network interface are automatically enabled and then dhcp'ed.
printf "allow-hotplug eth0\n" >> /etc/network/interfaces
printf "auto lo\n" >> /etc/network/interfaces
printf "iface lo inet loopback\n" >> /etc/network/interfaces
printf "iface eth0 inet dhcp\n" >> /etc/network/interfaces
printf "dns-nameserver 4.2.2.1\n" >> /etc/network/interfaces
printf "dns-nameserver 4.2.2.2\n" >> /etc/network/interfaces
printf "dns-nameserver 208.67.220.220\n" >> /etc/network/interfaces
# Adding a delay so dhclient will work properly.
printf "pre-up sleep 2\n" >> /etc/network/interfaces
# Ensure a nameserver is being used that won't return an IP for non-existent domain names.
printf "nameserver 4.2.2.1\nnameserver 4.2.2.2\nnameserver 208.67.220.220\n" > /etc/resolv.conf
# Reboot onto the new kernel (if applicable).
sed -i -e '/gethostname/d' /etc/dhcp/dhclient.conf
# Schedule a reboot, and let the script exit normally.
(sleep 30 ; /sbin/reboot) &
echo "Rebooting in thirty seconds..."
Tested using version 1.7.7 and 1.7.8.
You can duplicate my process precisely, and try building the Devuan 4.0 image using the current commit (presumably by the time you look at this I'll have a workaround in HEAD):
git clone https://github.com/lavabit/robox.git && cd robox
git checkout -b packer-parallels-bug 50b8ac2e09a451df42e740a16af7f49a9265b8f2
./robox.sh box generic-devuan4-parallels
You can also skip the last command, and examine the packer
templates/bash
scripts manually. The configuration for the box in question is inside the generic-parallels.json
config file.
macOS High Sierra v10.13.6
Parallels Desktop v16.5.0
Packer v1.7.8
I'm including a small portion of the log, condensed to show the most important parts. Specifically when packer
first detects the IP. The log will then skip to when the guest reboots. I only included the first two connection errors, as the same error repeats until the timeout is reached, and the build aborts.
If you scroll down past the log, you'll see the guest IP changed from 10.211.55.216
to 10.211.55.217
... and that Parallels can provide the updated IP address information.
2021/12/03 14:35:10 packer-builder-parallels-iso plugin: [INFO] Waiting for SSH, up to timeout: 1h0m0s
2021/12/03 14:35:10 ui: ==> generic-devuan4-parallels: Waiting for SSH to become available...
2021/12/03 14:35:10 packer-builder-parallels-iso plugin: Found MAC address for NIC: net0 - 001C42CDF7A3
2021/12/03 14:35:10 packer-builder-parallels-iso plugin: [DEBUG] Error getting SSH address: IP lease not found for MAC address 001C42CDF7A3 in: /Library/Preferences/Parallels/parallels_dhcp_leases
2021/12/03 14:35:16 packer-builder-parallels-iso plugin: Found MAC address for NIC: net0 - 001C42CDF7A3
2021/12/03 14:35:16 packer-builder-parallels-iso plugin: [DEBUG] Error getting SSH address: IP lease not found for MAC address 001C42CDF7A3 in: /Library/Preferences/Parallels/parallels_dhcp_leases
2021/12/03 14:35:21 packer-builder-parallels-iso plugin: Found MAC address for NIC: net0 - 001C42CDF7A3
2021/12/03 14:35:21 packer-builder-parallels-iso plugin: [DEBUG] Error getting SSH address: IP lease not found for MAC address 001C42CDF7A3 in: /Library/Preferences/Parallels/parallels_dhcp_leases
2021/12/03 14:35:26 packer-builder-parallels-iso plugin: Found MAC address for NIC: net0 - 001C42CDF7A3
2021/12/03 14:35:26 packer-builder-parallels-iso plugin: [DEBUG] Error getting SSH address: IP lease not found for MAC address 001C42CDF7A3 in: /Library/Preferences/Parallels/parallels_dhcp_leases
2021/12/03 14:35:32 packer-builder-parallels-iso plugin: Found MAC address for NIC: net0 - 001C42CDF7A3
2021/12/03 14:35:32 packer-builder-parallels-iso plugin: Found lease: 10.211.55.215 for MAC: 001C42CDF7A3, expiring at 1638565529, leased for 1800 s.
<snipped>
2021/12/03 14:41:58 ui: generic-devuan4-parallels: Rebooting in thirty seconds...
2021/12/03 14:41:58 ui error: ==> generic-devuan4-parallels: + sleep 30
2021/12/03 14:42:28 ui error: ==> generic-devuan4-parallels: + /sbin/reboot
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [INFO] RPC endpoint: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] 31 bytes written for 'stdout'
2021/12/03 14:42:28 [INFO] 75 bytes written for 'stderr'
2021/12/03 14:42:28 [INFO] RPC client: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] RPC endpoint: Communicator ended with: 0
2021/12/03 14:42:28 packer-provisioner-shell plugin: [INFO] 31 bytes written for 'stdout'
2021/12/03 14:42:28 packer-provisioner-shell plugin: [INFO] 75 bytes written for 'stderr'
2021/12/03 14:42:28 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [DEBUG] Opening new ssh session
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [DEBUG] starting remote command: rm -f /tmp/script_8566.sh
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [INFO] RPC endpoint: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] RPC client: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] RPC endpoint: Communicator ended with: 0
2021/12/03 14:42:28 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [DEBUG] Opening new ssh session
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [DEBUG] starting remote command: rm -f
2021/12/03 14:42:28 packer-builder-parallels-iso plugin: [INFO] RPC endpoint: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] RPC client: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] RPC endpoint: Communicator ended with: 0
2021/12/03 14:42:28 packer-provisioner-shell plugin: [INFO] RPC client: Communicator ended with: 0
2021/12/03 14:42:28 [INFO] (telemetry) ending shell
2021/12/03 14:42:28 [INFO] (telemetry) Starting provisioner shell
2021/12/03 14:42:28 ui: ==> generic-devuan4-parallels: Pausing 2m0s before the next provisioner...
2021/12/03 14:44:28 ui: ==> generic-devuan4-parallels: Provisioning with shell script: scripts/devuan4/floppy.sh
2021/12/03 14:44:28 packer-provisioner-shell plugin: Opening scripts/devuan4/floppy.sh for reading
2021/12/03 14:44:28 packer-provisioner-shell plugin: [INFO] 162 bytes written for 'uploadData'
2021/12/03 14:44:28 [INFO] 162 bytes written for 'uploadData'
2021/12/03 14:44:28 packer-builder-parallels-iso plugin: [DEBUG] Opening new ssh session
2021/12/03 14:44:28 packer-builder-parallels-iso plugin: [ERROR] ssh session open error: 'EOF', attempting reconnect
2021/12/03 14:44:28 packer-builder-parallels-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/12/03 14:44:43 packer-builder-parallels-iso plugin: [ERROR] reconnection error: dial tcp 10.211.55.216:22: i/o timeout
2021/12/03 14:44:43 packer-provisioner-shell plugin: Retryable error: Error uploading script: dial tcp 10.211.55.216:22: i/o timeout
2021/12/03 14:44:45 packer-provisioner-shell plugin: [INFO] 162 bytes written for 'uploadData'
2021/12/03 14:44:45 [INFO] 162 bytes written for 'uploadData'
2021/12/03 14:44:45 packer-builder-parallels-iso plugin: [DEBUG] Opening new ssh session
2021/12/03 14:44:45 packer-builder-parallels-iso plugin: [ERROR] ssh session open error: 'client not available', attempting reconnect
2021/12/03 14:44:45 packer-builder-parallels-iso plugin: [DEBUG] reconnecting to TCP connection for SSH
2021/12/03 14:45:00 packer-builder-parallels-iso plugin: [ERROR] reconnection error: dial tcp 10.211.55.216:22: i/o timeout
2021/12/03 14:45:00 packer-provisioner-shell plugin: Retryable error: Error uploading script: dial tcp 10.211.55.216:22: i/o timeout
$ prlctl list -f
UUID STATUS IP_ADDR NAME
{69d061ca-4c35-4ed4-8eaf-45159a1247a0} running 10.211.55.217 generic-devuan4-parallels
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
Packer fails to detect the installed Parallels Virtualization SDK.
joe.gorse@Joes-MacBook-Pro bento % ls /Library/Frameworks/ParallelsVirtualizationSDK.framework
Headers Libraries ParallelsVirtualizationSDK Resources Versions
joe.gorse@Joes-MacBook-Pro bento % packer build -only=parallels-iso packer_templates/ubuntu/ubuntu-20.04-arm64.json
parallels-iso: output will be in this color.
Build 'parallels-iso' errored after 1 millisecond 777 microseconds: Failed creating Parallels driver: Parallels Virtualization SDK is not installed
==> Wait completed after 1 millisecond 817 microseconds
==> Some builds didn't complete successfully and had errors:
--> parallels-iso: Failed creating Parallels driver: Parallels Virtualization SDK is not installed
==> Builds finished but no artifacts were created.
brew install vagrant
vagrant plugin install vagrant-parallels
git clone https://github.com/chef/bento && cd bento
# sudo gem install mixlib-shellout
packer build -only=parallels-iso packer_templates/ubuntu/ubuntu-20.04-arm64.json
packer --version
1.8.0
https://github.com/chef/bento/blob/main/packer_templates/ubuntu/ubuntu-20.04-arm64.json
macOS Monterey
2022 Macbook Pro
m1 aarch64
2022/03/31 11:07:09 Build debug mode: true
2022/03/31 11:07:09 Force build: false
2022/03/31 11:07:09 On error: ask
2022/03/31 11:07:09 Debug enabled, so waiting for build to finish: parallels-iso
2022/03/31 11:07:09 Starting build run: parallels-iso
2022/03/31 11:07:09 Running builder: parallels-iso
2022/03/31 11:07:09 [INFO] (telemetry) Starting builder parallels-iso
2022/03/31 11:07:09 [INFO] (telemetry) ending parallels-iso
2022/03/31 11:07:09 ui error: Build 'parallels-iso' errored after 3 milliseconds 544 microseconds: Failed creating Parallels driver: Parallels Virtualization SDK is not installed
2022/03/31 11:07:09 Waiting on builds to complete...
2022/03/31 11:07:09 ui:
==> Wait completed after 3 milliseconds 985 microseconds
2022/03/31 11:07:09 machine readable: error-count []string{"1"}
2022/03/31 11:07:09 ui error:
==> Some builds didn't complete successfully and had errors:
2022/03/31 11:07:09 machine readable: parallels-iso,error []string{"Failed creating Parallels driver: Parallels Virtualization SDK is not installed"}
2022/03/31 11:07:09 ui error: --> parallels-iso: Failed creating Parallels driver: Parallels Virtualization SDK is not installed
2022/03/31 11:07:09 ui:
==> Builds finished but no artifacts were created.
2022/03/31 11:07:09 [INFO] (telemetry) Finalizing.
2022/03/31 11:07:09 waiting for all plugin processes to complete...
2022/03/31 11:07:09 /opt/homebrew/Cellar/packer/1.8.0/libexec/bin/packer: plugin process exited
2022/03/31 11:07:09 /opt/homebrew/Cellar/packer/1.8.0/libexec/bin/packer: plugin process exited
2022/03/31 11:07:09 /opt/homebrew/Cellar/packer/1.8.0/libexec/bin/packer: plugin process exited
If a backup operation is in progress (so the backup snapshot or backup disk are mounted), then packer build
for Parallels fails, as mdfind kMDItemCFBundleIdentifier '==' com.parallels.desktop.console
, which is used to find location of Parallels, returns more than one result. See the log in gist for the failure during SuperDuper!
backup.
Can be fixed by splitting mdfind
output by line and trying the locations until one succeeds in order of likelihood (e.g. starting with /Applications
, then /Volumes
, and filtering out /private
).
Packer 1.1.3, host MacOS 10.13
Log: https://gist.github.com/dottedmag/ab4f903f99e3fc3e065a084426c8f85e
A packer build with an existing PVM does not find the file if it is in a different folder and you use spaces or ~ (even though it is explictly stated it will work)
Create a packer file that points to a PVM, parallels-pvm type
packer build or packer validate
it won't be able to find the file
Steps to reproduce this issue
Packer v1.8.3
prlctl version 18.0.0 (53049)
packer-plugin-parallels_v1.0.3_x5.0_darwin_arm64
packer {
required_plugins {
parallels = {
version = ">= 1.0.0"
source = "github.com/hashicorp/parallels"
}
}
}
source "parallels-pvm" "base-fedora" {
source_path = "/Users/sergio/Parallels/Fedora_36_tools.pvm"
parallels_tools_flavor = "lin-arm"
ssh_private_key_file = "./keys/vagrant"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "90s"
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
boot_wait = "5s"
}
build {
sources = ["source.parallels-pvm.base-fedora"]
}
Mac OS Monterey on an M1 Max
Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the gist of the log or
use the Github detailed format instead of posting it directly in the issue.
Set the env var PACKER_LOG=1
for maximum log detail.
Failed to register the VM: "Fedora_36_tools" when creating a packer file using an existing VM
Create a working configuration file
packer build .
Packer v1.8.3
prlctl version 18.0.0 (53049)
packer-plugin-parallels_v1.0.3_x5.0_darwin_arm64
packer {
required_plugins {
parallels = {
version = ">= 1.0.0"
source = "github.com/hashicorp/parallels"
}
}
}
source "parallels-pvm" "base-fedora" {
source_path = "/Users/sergio/Parallels/Fedora_36_tools.pvm"
parallels_tools_flavor = "lin-arm"
ssh_private_key_file = "./keys/vagrant"
ssh_username = "vagrant"
ssh_password = "vagrant"
ssh_timeout = "90s"
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
boot_wait = "5s"
}
build {
sources = ["source.parallels-pvm.base-fedora"]
}
Mac OS Monterey on an M1 Max
parallels-pvm.base-fedora: output will be in this color.
==> parallels-pvm.base-fedora: Importing VM: /Users/sergio/Parallels/Fedora_36_tools.pvm
==> parallels-pvm.base-fedora: Error importing VM: prlctl error: Failed to register the VM: "Fedora_36_tools" is already registered. You cannot register a virtual machine more than once.
==> parallels-pvm.base-fedora: Deleting output directory...
Build 'parallels-pvm.base-fedora' errored after 436 milliseconds 894 microseconds: Error importing VM: prlctl error: Failed to register the VM: "Fedora_36_tools" is already registered. You cannot register a virtual machine more than once.
==> Wait completed after 436 milliseconds 937 microseconds
==> Some builds didn't complete successfully and had errors:
--> parallels-pvm.base-fedora: Error importing VM: prlctl error: Failed to register the VM: "Fedora_36_tools" is already registered. You cannot register a virtual machine more than once.
==> Builds finished but no artifacts were created.
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
When creating the packer macOS, we can either have it local as a macvm bundle or create a Vagrant box from it.
If we choose this option, the vagrant box is empty.
Use the Packer to create a new macOS build. You can use the packer-examples templates here
Choose to create a vagrant box in the post processor
Build it and check the box size
packer 1.9.4
packer-plugin-parallels 1.1.5
macOs 14.2
This issue was originally opened by @benlumia007 as hashicorp/packer#7885. It was migrated here as a result of the Packer plugin split. The original body of the issue is below.
First of all, the reason why I have created issue due to Packer and I want to verify if it is not Packer issue. I have tried different versions of Packer and I am always ending up with the same problem. I also have tested different packer templates from different repositories and still the same issue where the commands doesn't do anything.
What I have on my Mac.
MacOS Mojave 10.14.5
Vagrant 2.2.4
Packer 1.4.2
I created my own packer stuff and when i try to run it, the boot_command fails, i have tested version 1.3.5 - 1.4.2 and i get the same thing.
i have a log
can you guys verify what's wrong? is ti a bug or is it something else.
it should be straight forward,
"boot_command": [
"<esc><wait>",
"<esc><wait>",
"<enter><wait>",
"/install/vmlinuz<wait>",
" auto<wait>",
" console-setup/ask_detect=false<wait>",
" console-setup/layoutcode=us<wait>",
" console-setup/modelcode=pc105<wait>",
" debconf/frontend=noninteractive<wait>",
" debian-installer=en_US.UTF-8<wait>",
" fb=false<wait>",
" initrd=/install/initrd.gz<wait>",
" kbd-chooser/method=us<wait>",
" keyboard-configuration/layout=USA<wait>",
" keyboard-configuration/variant=USA<wait>",
" locale=en_US.UTF-8<wait>",
" netcfg/get_domain=vm<wait>",
" netcfg/get_hostname=sandbox<wait>",
" grub-installer/bootdev=/dev/sda<wait>",
" noapic<wait>",
" preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg<wait>",
" -- <wait>",
"<enter><wait>"
]
Update documentation for HCL files.
Currently PVM does not appear to be a straightforward translation from JSON.
When running packer build, system is waiting for SSH for a very long time.
To reproduce, just run packer build.
Latest version.
packer-examples, macOS script
Host : macOS ARM Sonoma, Guest, macOS 13
2024/02/08 13:21:31 packer-plugin-parallels_v1.1.5_x5.0_darwin_arm64 plugin: 2024/02/08 13:21:31 Found MAC address for NIC: net0 - 001C42EE35B5
2024/02/08 13:21:31 packer-plugin-parallels_v1.1.5_x5.0_darwin_arm64 plugin: 2024/02/08 13:21:31 [DEBUG] Error getting SSH address: open /Library/Preferences/Parallels/parallels_dhcp_leases: no such file or directory
This issue was originally opened by @rrus22 in hashicorp/packer#11688 and has been migrated to this repository. The original issue description is below.
When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.
I am trying to use the packer build command with Parallels on a Macbook Pro M1 Max, with Parallels version 17.1.2, and Packer version 1.8.0 . I get the following error, "Failed creating Parallels driver: Parallels Virtualization SDK is not installed". I cloned the latest plugin code, on a MacOS 12.3 and installed go-lang and built latest plugin. After adding the plugin code, and I run "packer init ." I receive an "invalid address or nil pointer dereference".
Build out VM's with packer build . on a macOS 12.3 with Parallels 17.1.2 and Packer 1.8.0.
1.8.0
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
source "parallels-iso" "lb" {
boot_command = ["", "linux /casper/vmlinuz"," quiet"," autoinstall"," ds='nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/'","","initrd /casper/initrd ","boot "]
boot_wait = "15s"
disk_size = 15000
parallels_tools_flavor = "lin"
guest_os_type = "ubuntu"
http_directory = "subiquity/http"
http_port_max = 9200
http_port_min = 9001
iso_checksum = "sha256:d6fea1f11b4d23b481a48198f51d9b08258a36f6024cb5cec447fe78379959ce"
iso_urls = ["https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso"]
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
ssh_wait_timeout = "1800s"
ssh_password = "${var.SSHPW}"
ssh_timeout = "20m"
ssh_username = "vagrant"
parallels_tools_mode = "upload"
prlctl = [["set", "{{.Name}}", "--memsize", "${var.memory_amount}"]]
prlctl_version_file = ".prlctl_version"
vm_name = "lb"
}
source "parallels-iso" "ws1" {
boot_command = ["", "linux /casper/vmlinuz"," quiet"," autoinstall"," ds='nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/'","","initrd /casper/initrd ","boot "]
boot_wait = "15s"
disk_size = 15000
parallels_tools_flavor = "lin"
guest_os_type = "ubuntu"
http_directory = "subiquity/http"
http_port_max = 9200
http_port_min = 9001
iso_checksum = "sha256:d6fea1f11b4d23b481a48198f51d9b08258a36f6024cb5cec447fe78379959ce"
iso_urls = ["https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso"]
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
ssh_wait_timeout = "1800s"
ssh_password = "${var.SSHPW}"
ssh_timeout = "20m"
ssh_username = "vagrant"
parallels_tools_mode = "upload"
prlctl = [["set", "{{.Name}}", "--memsize", "${var.memory_amount}"]]
prlctl_version_file = ".prlctl_version"
vm_name = "ws1"
}
source "parallels-iso" "ws2" {
boot_command = ["", "linux /casper/vmlinuz"," quiet"," autoinstall"," ds='nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/'","","initrd /casper/initrd ","boot "]
boot_wait = "15s"
disk_size = 15000
parallels_tools_flavor = "lin"
guest_os_type = "ubuntu"
http_directory = "subiquity/http"
http_port_max = 9200
http_port_min = 9001
iso_checksum = "sha256:d6fea1f11b4d23b481a48198f51d9b08258a36f6024cb5cec447fe78379959ce"
iso_urls = ["https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso"]
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
ssh_wait_timeout = "1800s"
ssh_password = "${var.SSHPW}"
ssh_timeout = "20m"
ssh_username = "vagrant"
parallels_tools_mode = "upload"
prlctl = [["set", "{{.Name}}", "--memsize", "${var.memory_amount}"]]
prlctl_version_file = ".prlctl_version"
vm_name = "ws2"
}
source "parallels-iso" "ws3" {
boot_command = ["", "linux /casper/vmlinuz"," quiet"," autoinstall"," ds='nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/'","","initrd /casper/initrd ","boot "]
boot_wait = "15s"
disk_size = 15000
parallels_tools_flavor = "lin"
guest_os_type = "ubuntu"
http_directory = "subiquity/http"
http_port_max = 9200
http_port_min = 9001
iso_checksum = "sha256:d6fea1f11b4d23b481a48198f51d9b08258a36f6024cb5cec447fe78379959ce"
iso_urls = ["https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso"]
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
ssh_wait_timeout = "1800s"
ssh_password = "${var.SSHPW}"
ssh_timeout = "20m"
ssh_username = "vagrant"
parallels_tools_mode = "upload"
prlctl = [["set", "{{.Name}}", "--memsize", "${var.memory_amount}"]]
prlctl_version_file = ".prlctl_version"
vm_name = "ws3"
}
source "parallels-iso" "db" {
boot_command = ["", "linux /casper/vmlinuz"," quiet"," autoinstall"," ds='nocloud-net;s=http://{{.HTTPIP}}:{{.HTTPPort}}/'","","initrd /casper/initrd ","boot "]
boot_wait = "15s"
disk_size = 15000
parallels_tools_flavor = "lin"
guest_os_type = "ubuntu"
http_directory = "subiquity/http"
http_port_max = 9200
http_port_min = 9001
iso_checksum = "sha256:d6fea1f11b4d23b481a48198f51d9b08258a36f6024cb5cec447fe78379959ce"
iso_urls = ["https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.3-live-server-arm64.iso"]
shutdown_command = "echo 'vagrant' | sudo -S shutdown -P now"
ssh_wait_timeout = "1800s"
ssh_password = "${var.SSHPW}"
ssh_timeout = "20m"
ssh_username = "vagrant"
parallels_tools_mode = "upload"
prlctl = [["set", "{{.Name}}", "--memsize", "${var.memory_amount}"]]
prlctl_version_file = ".prlctl_version"
vm_name = "db"
}
build {
sources = ["source.parallels-iso.lb","source.parallels-iso.ws1","source.parallels-iso.ws2","source.parallels-iso.ws3","source.parallels-iso.db"]
provisioner "file" {
source = "./id_ed25519_prof_test"
destination = "/home/vagrant/.ssh/"
}
provisioner "file" {
source = "./config"
destination = "/home/vagrant/.ssh/"
}
provisioner "shell" {
execute_command = "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'"
script = "../scripts/post_install_ubuntu_2004_vagrant-arm.sh"
}
provisioner "shell" {
execute_command = "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'"
script = "../scripts/post_install_ubuntu_lb.sh"
only = ["parallels-iso.lb"]
}
provisioner "shell" {
execute_command = "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'"
script = "../scripts/post_install_ubuntu_ws.sh"
only = ["parallels-iso.ws1","parallels-iso.ws2","parallels-iso.ws3"]
}
provisioner "shell" {
execute_command = "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'"
script = "../scripts/post_install_ubuntu_db.sh"
only = ["parallels-iso.db"]
}
post-processor "vagrant" {
keep_input_artifact = false
output = "${var.build_artifact_location}{{ .BuildName }}-arm.box"
}
}
packer {
required_plugins {
parallels = {
version = ">= 1.0.0"
source = "github.com/illinoistech-itm/parallels"
}
}
}
macOS M1 Max, Parallels 17.1.2, and Packer 1.8.0
2022/03/28 20:49:42 [INFO] Packer version: 1.8.0 [go1.17.8 darwin arm64]
2022/03/28 20:49:42 Old default config directory found: /Users/username/.packer.d
2022/03/28 20:49:42 [TRACE] discovering plugins in /opt/homebrew/Cellar/packer/1.8.0/libexec/bin
2022/03/28 20:49:42 Old default config directory found: /Users/username/.packer.d
2022/03/28 20:49:42 [TRACE] discovering plugins in /Users/username/.packer.d/plugins
2022/03/28 20:49:42 [TRACE] discovering plugins in .
2022/03/28 20:49:42 [TRACE] discovering plugins in
2022/03/28 20:49:42 [TRACE] discovering plugins in /opt/homebrew/bin
2022/03/28 20:49:42 [INFO] PACKER_CONFIG env var not set; checking the default config file path
2022/03/28 20:49:42 [INFO] PACKER_CONFIG env var set; attempting to open config file: /Users/username/.packerconfig
2022/03/28 20:49:42 [WARN] Config file doesn't exist: /Users/username/.packerconfig
2022/03/28 20:49:42 Old default config directory found: /Users/username/.packer.d
2022/03/28 20:49:42 [INFO] Setting cache directory: /Users/username/.cache/packer
2022/03/28 20:49:42 Old default config directory found: /Users/username/.packer.d
2022/03/28 20:49:42 [TRACE] init: plugingetter.ListInstallationsOptions{FromFolders:[]string{"/opt/homebrew/Cellar/packer/1.8.0/libexec/bin/packer", ".", "/Users/username/.packer.d/plugins", "", "/opt/homebrew/bin"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"arm64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0x140003fa000)}}}}
2022/03/28 20:49:42 [TRACE] listing potential installations for "github.com/illinoistech-itm/parallels" that match ">= 1.0.0". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/opt/homebrew/Cellar/packer/1.8.0/libexec/bin/packer", ".", "/Users/username/.packer.d/plugins", "", "/opt/homebrew/bin"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"darwin", ARCH:"arm64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0x140003fa000)}}}}
2022/03/28 20:49:42 [TRACE] for plugin github.com/illinoistech-itm/parallels found 0 matching installation(s)
2022/03/28 20:49:42 [TRACE] getting available versions for the github.com/illinoistech-itm/parallels plugin
2022/03/28 20:49:42 [WARNING] github-getter: no GitHub token set, if you intend to install plugins often, please set the PACKER_GITHUB_API_TOKEN env var
2022/03/28 20:49:42 [DEBUG] github-getter: getting "https://api.github.com/repos/illinoistech-itm/packer-plugin-parallels/git/matching-refs/tags"
2022/03/28 20:49:42 [DEBUG] will try to install: [1.0.0]
2022/03/28 20:49:42 [TRACE] fetching checksums file for the "1.0.0" version of the github.com/illinoistech-itm/parallels plugin in "/opt/homebrew/bin/github.com/illinoistech-itm/parallels"...
2022/03/28 20:49:42 [DEBUG] github-getter: getting "https://github.com/illinoistech-itm/packer-plugin-parallels/releases/download/v1.0.0/packer-plugin-parallels_v1.0.0_SHA256SUMS"
2022/03/28 20:49:43 waiting for all plugin processes to complete...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x103459200]
goroutine 1 [running]:
github.com/hashicorp/packer/packer/plugin-getter.(*Requirement).InstallLatest(0x14000de5a40, {{0x140003e4460, 0x1, 0x1}, {0x14000404480, 0x5, 0x8}, {{0x106452c38, 0x1}, {0x105e0bb84, ...}, ...}})
github.com/hashicorp/packer/packer/plugin-getter/plugins.go:736 +0x4b0
github.com/hashicorp/packer/command.(*InitCommand).RunContext(0x140000e0690, {0x107b78680, 0x140000fa100}, 0x1400054e000)
github.com/hashicorp/packer/command/init.go:118 +0x5bc
github.com/hashicorp/packer/command.(*InitCommand).Run(0x140000e0690, {0x1400011a1a0, 0x1, 0x1})
github.com/hashicorp/packer/command/init.go:32 +0xd0
github.com/mitchellh/cli.(*CLI).Run(0x1400031ea00)
github.com/mitchellh/[email protected]/cli.go:262 +0x5c4
main.wrappedMain()
github.com/hashicorp/packer/main.go:262 +0xbe0
main.realMain()
github.com/hashicorp/packer/main.go:49 +0xf4
main.main()
github.com/hashicorp/packer/main.go:35 +0x20
Please search the existing issues for relevant feature requests, and use the
reaction feature
(https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
to add upvotes to pre-existing requests.
Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
This plugin currently supports either pvm or iso. But parallels desktop now has *.macvm, which is ARM macOS in Apple Silicon Chip systems. Packer support for these VMs are required for users to automate creating macvms. Both "macvm" and "ipsw" builders need to be added to the system.
Automating macOS VM creation in Apple Silicon Chip systems
There is no support for fetching arm-based tools in ToolsISOPath
Please vote on this issue by adding a ๐ reaction to the original issue to help the community and maintainers prioritize this request.
Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Add cdrom-files similar to floppy-files for efi and secure boot systems like windows 11 on arm that doesn't recognize the floppy-disk for autounattended. This would also match other similar providers like virtualbox, vmware, and qemu iso builders.
windows autounattend.xml file for iso builders on modern efi and secure boot configurations
cd_files = ["vendor-data"]
cd_content = {
"meta-data" = jsonencode(local.instance_data)
"user-data" = templatefile("user-data", { packages = ["nginx"] })
}
cd_label = "cidata"
I was getting the following error;
Build 'parallels-iso.linux-ubuntu-server' errored after 472 milliseconds 110 microseconds: Couldn't find Parallels Tools for the 'lin-arm' flavor!...
Parallels SDK was installed and I could see the iso files there, so I dug further. Turns out I have two "Parallels Desktop" folders due to a "Carbon Copy Cloner" backup which is mounted on another volume. So the output of my mdfind
command is as follows;
~/Projects$ mdfind kMDItemCFBundleIdentifier == com.parallels.desktop.console
/Applications/Parallels Desktop.app
/Volumes/CarbonCopy Backup/Applications/Parallels Desktop.app
Since the getAppPath
function simply returns the command output, it puts the two paths in the same string and the build fails straight away because it can't find the tools iso. Unmounting the carbon copy volume fixes the issue.
Since it's so unlikely to happen (and if it does it's likely because of a duplicate/backup like in my case), I've played around with simply changing it to;
pathOutput := strings.TrimSpace(strings.Split(stdout.String(), "\n")[0])
However did not get to test it since Go is not my normal dev environment and I couldn't figure out how to install custom plugins (I got to compile it but couldn't install it).
Use Carbon Copy Cloner (can download a trial) to backup the Parallels Desktop folder to another volume. Run packer build
.
Packer v1.8.4
Not relevant
macOS, darwin_arm64
Not relevant
I am unable to create a Parallels machine using Packer when communicator is set to "none". The system fails when attempting to upload Parallels version info:
==> parallels-iso.fcos-bare-metal-qa: Uploading Parallels version info (17.1.0)
Build 'parallels-iso.fcos-bare-metal-qa' errored after 2 minutes 30 seconds: Error uploading Parallels version: Upload is not implemented when communicator = 'none'
I have tried to set prlctl_version_file = ""
in my build file (which works for other equivalent builders such as virtualbox
, but this has no effect. Investigating the code, I believe it's because:
communicator = "none"
and prlctl_version_file = ""
and attempt to build.Packer v1.7.5
source "parallels-iso" "fedora-coreos" {
boot_wait = "25s"
guest_os_type = "fedora-core"
iso_checksum = "sha256:b3378430176e587bbe11d429ddb5322e17a44a6e7145858d6d109a984f66c5cf"
iso_url = "https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/34.20211016.3.0/x86_64/fedora-coreos-34.20211016.3.0-live.x86_64.iso"
boot_command = ["sudo coreos-installer install /dev/sda<enter>", "<wait1m>", "sudo shutdown now<enter>", "<wait20s>"]
shutdown_command = "sudo shutdown -h now"
communicator = "none"
parallels_tools_mode = "disable"
prlctl_version_file = ""
cpus = "2"
memory = "2048"
disk_size = "40000"
}
build {
sources = ["parallels-iso.fedora-coreos"]
}
macOS Big Sur 11.6
Parallels Desktop 17.1.0
Because macOS relies heavily on keystrokes during automation of deployment this can be a hit-and-miss action. To avoid repeating the process a few times until we get a VM, we should allow the user to disable the communicator and exit the creation of the VM at the stage it is ready and no further communications are needed using a flag that we can pass in the provisioner.
Quick creation of a macOS VM and manual installation of the software for preparing a Vagrant box
disable_communicator = true // defaults to false
The {{timestamp}}
variable shows up in the VM list in Parallels.
See build notes below,
packer build
Packer v1.8.0
packer {
required_plugins {
parallels = {
version = ">= 1.0.0"
source = "github.com/hashicorp/parallels"
}
}
}
source "parallels-pvm" "macos-vm-builder" {
source_path = "macos-12-3-template.pvm"
[...]
}
build {
sources = [
"source.parallels-pvm.macos-vm-builder"
]
provisioner "ansible" {
playbook_file = "..."
}
macOS, Parallels 17.1.2, Intel x86
According to the documentation the sound device should default to false:
Specifies whether to enable the sound device when building the VM. Defaults to
false
.
However even though I have no sound key in my config, the VM has a sound device and complains about microphone access on every build:
Not sure if this is caused by Parallels itself, but if an audio device is added automatically the docs should be changed.
Build box from attached Buildfile
Packer v1.7.10
source "parallels-iso" "fedora-parallels-arm64" {
boot_command = ["<leftCtrlOn><leftAltOn>2<leftCtrlOff><leftAltOff>e<down><down><leftCtrlOn>e<leftCtrlOff> inst.text inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks_fedora_parallels.cfg vga=792<leftCtrlOn>x<leftCtrlOff><wait>"]
boot_wait = local.boot_wait
disk_size = local.disk_size
guest_os_type = "fedora-core"
hard_drive_interface = "sata"
http_directory = "packer/http"
iso_checksum = local.arm64_iso_checksum
iso_url = local.arm64_iso_url
shutdown_command = "echo 'dev' | sudo -S /sbin/halt -h -p"
ssh_password = "dev"
ssh_port = 22
ssh_pty = "true"
ssh_timeout = "10000s"
ssh_username = "dev"
memory = 4096
cpus = 4
parallels_tools_flavor = "lin-arm"
}
macOS 12.3.1 on Mac mini M1 2020 (arm64)
guest is Fedora 35
This is what prlctl does:
2022/05/10 14:39:57 Executing prlctl: []string{"create", "packer-fedora-parallels-arm64", "--distribution", "fedora-core", "--dst", "/Users/jenkins/workspace/workspace/rebuy-de_vagrant_PR-1600/output-fedora-parallels-arm64", "--no-hdd"}
2022/05/10 14:39:57 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--cpus", "4"}
2022/05/10 14:39:57 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--memsize", "4096"}
2022/05/10 14:39:57 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--startup-view", "headless"}
2022/05/10 14:39:58 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--on-shutdown", "close"}
2022/05/10 14:39:58 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--on-window-close", "keep-running"}
2022/05/10 14:39:58 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--auto-share-camera", "off"}
2022/05/10 14:39:58 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--smart-guard", "off"}
2022/05/10 14:39:59 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--shared-cloud", "off"}
2022/05/10 14:39:59 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--shared-profile", "off"}
2022/05/10 14:39:59 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--smart-mount", "off"}
2022/05/10 14:39:59 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--sh-app-guest-to-host", "off"}
2022/05/10 14:39:59 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--sh-app-host-to-guest", "off"}
2022/05/10 14:39:59 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--device-add", "hdd", "--type", "expand", "--size", "32212", "--iface", "sata"}
2022/05/10 14:40:00 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--device-bootorder", "hdd0 cdrom0 net0"}
2022/05/10 14:40:01 Executing prlctl: []string{"set", "packer-fedora-parallels-arm64", "--device-set", "cdrom0", "--image", "/Users/jenkins/.cache/packer_cache/4f225d2e01b2fd537a6643598fe65ff64b2d4a31.iso", "--enable", "--connect"}
2022/05/10 14:40:01 Executing prlctl: []string{"start", "packer-fedora-parallels-arm64"}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.