I was able to install guest additions, share folders but packer hangs when 
I try to uninstall guest additions as the last step. 
Here is my packer template 

{
"variables": {
"guest_additions_mode": "attach",
"headless": "false",
"short_name": "Win10Enterprise_x64",
"software_packages_path": "software_packages"
},
"builders": [{
"type": "virtualbox-ovf",
"source_path": "output/updated/{{ user `short_name` }}_updated.ovf",
"output_directory": "output/with_software/",
"vm_name": "{{ user `short_name` }}_with_software",
"vboxmanage": [
["modifyvm", "{{.Name}}", "--memory", "4096"],
["modifyvm", "{{.Name}}", "--vram", "48"],
["modifyvm", "{{.Name}}", "--cpus", "1"],
["sharedfolder", "add", "{{.Name}}", "--name", "software_packages", 
"--hostpath", "{{ user `software_packages_path` }}"]
],
"guest_additions_mode": "{{ user `guest_additions_mode` }}",
"headless": "{{ user `headless` }}",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_password": "******",
"winrm_timeout": "12h",
"winrm_port": 5985,
"shutdown_command": "shutdown /s /t 10 /f /d p:4:1",
"post_shutdown_delay": "5m",
"floppy_dirs": ["scripts"]
}],
"provisioners": [{
"type": "powershell",
"script": "scripts/install_software_pkgs/install_oracle_guest_additions.ps1"
},
{
"type": "windows-restart",
"restart_timeout": "2h"
},
{
"type": "powershell",
"inline": "scripts/install_software_pkgs/uninstall_guest_additions.ps1"
},
{
"type": "windows-restart",
"restart_timeout": "2h"
}
]
}

here is the uninstall_guest_additions.ps1 script to uninstall guest 
additions. 


$path = $null

if (Test-Path "d:\VBoxWindowsAdditions.exe") {
  $path = "d:\VBoxWindowsAdditions.exe"
}
elseif (Test-Path "e:\VBoxWindowsAdditions.exe") {
  $path = "e:\VBoxWindowsAdditions.exe"
}
else{
 write-host "no guest additions drive found"
 exit
}

write-host "uninstalling guest additions"

& $path '/uninstall'

#Wait for 2 minutes to make sure that it is uninstalled successfully
write-host "wait for 2 minutes before exiting the script"
start-sleep -s 120


please help in understanding why it hangs and what is causing it to hang. 

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/b7ba5ba9-78a9-401a-ae39-c0fc49deb6bb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to