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.
Overview of the Issue
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".
Reproduction Steps
Build out VM's with packer build . on a macOS 12.3 with Parallels 17.1.2 and Packer 1.8.0.
Packer version
1.8.0
Simplified Packer Template
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"
}
}
}
Operating system and Environment details
macOS M1 Max, Parallels 17.1.2, and Packer 1.8.0
Log Fragments and crash.log files
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