packer hangs when uninstalling virtualbox guest additions

57 views
Skip to first unread message

Ramesh Janjyam

unread,
Jul 5, 2017, 10:57:18 AM7/5/17
to Packer
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. 

Alvaro Miranda Aguilera

unread,
Jul 6, 2017, 3:30:29 AM7/6/17
to packe...@googlegroups.com
why you need to uninstall?

and if you know this script fails. can you run the script manually?



--
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 packer-tool+unsubscribe@googlegroups.com.
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.



--
Alvaro

Message has been deleted

Ramesh Janjyam

unread,
Jul 6, 2017, 11:31:09 PM7/6/17
to Packer
I am basically converting the final image to qcow2 format to put it on openstack. I can run manually but I want to automate this process and setup a ci/cd pipeline for generating the image. since this is going to be on openstack there is no need to leave the guest additions on the image. so wanted to delete it before preparing the image for openstack
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.



--
Alvaro

Rickard von Essen

unread,
Jul 7, 2017, 2:27:04 AM7/7/17
to packe...@googlegroups.com
Just skip installing guest additions since you don't need it.

To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/6ad9c8fb-5e8c-4bd6-b3f5-04b60660ab85%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages