Here is how one can reproduce this behaviour. Make sure you are running Windows 10 or Windows Server 2016 with: - Virtualbox - Vmware Workstation - Windows Management Framework 5.1 - nssm
All commands are run from elevated powershell prompt. Run: mkdir c:\packertest cd c:\packertest git clone https://github.com/boxcutter/ubuntu.git cd ubuntu notepad ubuntu1604.json Change following line in ubuntu1604.json: "iso_checksum": "f3532991e031cae75bcf5e695afb844dd278fff9", "iso_name": "ubuntu-16.04.3-server-amd64.iso", "iso_url": "http://releases.ubuntu.com/16.04.3/ubuntu-16.04.3-server-amd64.iso", Run packer from command line and observe that it works: packer build -var-file="ubuntu1604.json" -only=virtualbox-iso -only=vmware-iso ubuntu.json Now install it as a service: nssm install aaaPackerTest packer build -var-file="c:\packertest\ubuntu\ubuntu1604.json" -only=virtualbox-iso -only=vmware-iso c:\packertest\ubuntu\ubuntu.json nssm set aaaPackerTest AppDirectory c:\packertest\ubuntu nssm set aaaPackerTest Start SERVICE_DEMAND_START $pwd = ConvertTo-SecureString "P@ssW0rD!" -AsPlainText -Force New-LocalUser "packerTest" -Password $pwd nssm set aaaPackerTest ObjectName .\packerTest "P@ssW0rD!" nssm set aaaPackerTest AppExit Default Exit nssm set aaaPackerTest AppStdout c:\packertest\log-out.txt nssm set aaaPackerTest AppStderr c:\packertest\log-err.txt nssm set aaaPackerTest AppStdoutCreationDisposition 2 nssm set aaaPackerTest AppStderrCreationDisposition 2 nssm set aaaPackerTest AppEnvironmentExtra PACKER_LOG=1 PACKER_LOG_PATH=c:\packertest\packer.log At this point Logs you can run the service with: Start-Service aaaPackerTest And observe the errors I described. The logs and output will be in c:\packertest\packer.log and c:\packertest\log-out.txt respectively. Cheers, Andrew On Wednesday, 9 August 2017 23:01:06 UTC+12, Alvaro Miranda Aguilera wrote: > > Hello > > So is there any Antivirus? can you disable it? > > It seems realted to the processes in this case virtualbox and vmware not > being able to create COM objects. > > I have TeamCity at home, and I use the agent to run under a normal user, > so I can login, open VMWARE/Virtualbox and ofcourse packer runs fine. > > is anything that impedes you to run into a nomal user, or directly from TC > agent run packer? > > > Alvaro. > > > > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> > Virusvrij. > www.avast.com > <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> > > <#CAHqq0ew8cNCS5qiDqZpgaLZD0nxom8mLdm4p4n80E1GnpUPrUw@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> > > On Wed, Aug 9, 2017 at 12:29 PM, <andr...@gmail.com <javascript:>> wrote: > >> Here is the verbose log >> https://gist.github.com/AndrewSav/670622133d5b24e00b6d85308254fd34 >> >> I used this https://nssm.cc/ to create a windows service that points to >> a command file that starts packer (with the same command line that works >> interactively, and also as runas). The logs produced are at the link above. >> >> Any insight how to make that work will be greatly appreciated. >> >> Cheers, >> Andrew >> >> On Wednesday, 9 August 2017 21:15:49 UTC+12, Alvaro Miranda Aguilera >> wrote: >>> >>> Hello >>> >>> is this windows? >>> >>> you can use runas to manually run the tools and see where it fails. >>> perhaps to a user without admin first. >>> >>> >>> you can set a variable PACKER_LOG=1 to get more verbose messages. >>> >>> >>> >>> >>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >>> Virusvrij. >>> www.avast.com >>> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> >>> >>> <#CAHqq0ew8cNCS5qiDqZpgaLZD0nxom8mLdm4p4n80E1GnpUPrUw@mail.gmail.com_m_-996011677510133160_CAHqq0ex8tKQH2P3rUuP7=gtG+4G83Y8xHmTdVcEqogSv0x-Pvw@mail.gmail.com_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >>> >>> On Wed, Aug 9, 2017 at 10:20 AM, <andr...@gmail.com> wrote: >>> >>>> I'm trying to run packer from a Teamcity agent, which means that the >>>> packer is spawned under unprivileged service account. >>>> >>>> If I log in to that service account interactively and run packer build >>>> it works. >>>> >>>> This is the build I'm running: https://github.com/boxcutter/ubuntu >>>> >>>> It also works from the service account, if I give the service account >>>> admin rights on the box. But if it's not admin, and it's from service I'm >>>> getting errors. >>>> >>>> Here are errors I'm getting with headless: false: >>>> >>>> ==> virtualbox-iso: Error configuring VirtualBox to suppress messages: >>>> VBoxManage error: VBoxManage.exe: error: Failed to create the VirtualBox >>>> object! >>>> ==> virtualbox-iso: VBoxManage.exe: error: The object is not ready >>>> ==> virtualbox-iso: VBoxManage.exe: error: Details: code E_ACCESSDENIED >>>> (0x80070005), component VirtualBoxClientWrap, interface IVirtualBoxClient >>>> ==> virtualbox-iso: Deleting output directory... >>>> Build 'virtualbox-iso' errored: Error configuring VirtualBox to >>>> suppress messages: VBoxManage error: VBoxManage.exe: error: Failed to >>>> create the VirtualBox object! >>>> VBoxManage.exe: error: The object is not ready >>>> VBoxManage.exe: error: Details: code E_ACCESSDENIED (0x80070005), >>>> component VirtualBoxClientWrap, interface IVirtualBoxClient >>>> ==> vmware-iso: Error starting VM: VMware error: Error: There was an >>>> error in communication >>>> ==> vmware-iso: Deleting output directory... >>>> Build 'vmware-iso' errored: Error starting VM: VMware error: Error: >>>> There was an error in communication >>>> >>>> ==> Some builds didn't complete successfully and had errors: >>>> --> virtualbox-iso: Error configuring VirtualBox to suppress messages: >>>> VBoxManage error: VBoxManage.exe: error: Failed to create the VirtualBox >>>> object! >>>> VBoxManage.exe: error: The object is not ready >>>> VBoxManage.exe: error: Details: code E_ACCESSDENIED (0x80070005), >>>> component VirtualBoxClientWrap, interface IVirtualBoxClient >>>> --> vmware-iso: Error starting VM: VMware error: Error: There was an >>>> error in communication >>>> >>>> Here are errors I'm getting with headless true: >>>> >>>> ==> virtualbox-iso: Error configuring VirtualBox to suppress messages: >>>> VBoxManage error: VBoxManage.exe: error: Failed to create the VirtualBox >>>> object! >>>> ==> virtualbox-iso: VBoxManage.exe: error: The object is not ready >>>> ==> virtualbox-iso: VBoxManage.exe: error: Details: code E_ACCESSDENIED >>>> (0x80070005), component VirtualBoxClientWrap, interface IVirtualBoxClient >>>> ==> virtualbox-iso: Deleting output directory... >>>> Build 'virtualbox-iso' errored: Error configuring VirtualBox to >>>> suppress messages: VBoxManage error: VBoxManage.exe: error: Failed to >>>> create the VirtualBox object! >>>> VBoxManage.exe: error: The object is not ready >>>> VBoxManage.exe: error: Details: code E_ACCESSDENIED (0x80070005), >>>> component VirtualBoxClientWrap, interface IVirtualBoxClient >>>> ==> vmware-iso: Error starting VM: VMware error: Error: Unknown error >>>> ==> vmware-iso: >>>> ==> vmware-iso: Packer detected a VMware 'Unknown Error'. Unfortunately >>>> VMware >>>> ==> vmware-iso: often has extremely vague error messages such as this >>>> and Packer >>>> ==> vmware-iso: itself can't do much about that. Please check the >>>> vmware.log files >>>> ==> vmware-iso: created by VMware when a VM is started (in the >>>> directory of the >>>> ==> vmware-iso: vmx file), which often contains more detailed error >>>> information. >>>> ==> vmware-iso: Deleting output directory... >>>> Build 'vmware-iso' errored: Error starting VM: VMware error: Error: >>>> Unknown error >>>> >>>> Packer detected a VMware 'Unknown Error'. Unfortunately VMware >>>> often has extremely vague error messages such as this and Packer >>>> itself can't do much about that. Please check the vmware.log files >>>> created by VMware when a VM is started (in the directory of the >>>> vmx file), which often contains more detailed error information. >>>> >>>> ==> Some builds didn't complete successfully and had errors: >>>> --> virtualbox-iso: Error configuring VirtualBox to suppress messages: >>>> VBoxManage error: VBoxManage.exe: error: Failed to create the VirtualBox >>>> object! >>>> VBoxManage.exe: error: The object is not ready >>>> VBoxManage.exe: error: Details: code E_ACCESSDENIED (0x80070005), >>>> component VirtualBoxClientWrap, interface IVirtualBoxClient >>>> --> vmware-iso: Error starting VM: VMware error: Error: Unknown error >>>> >>>> Packer detected a VMware 'Unknown Error'. Unfortunately VMware >>>> often has extremely vague error messages such as this and Packer >>>> itself can't do much about that. Please check the vmware.log files >>>> created by VMware when a VM is started (in the directory of the >>>> vmx file), which often contains more detailed error information. >>>> >>>> >>>> How can I configure the service account to run, so that the build does >>>> not fail, without giving full admin rights? >>>> >>>> Thank you in advance, >>>> Andrew >>>> >>>> >>>> -- >>>> 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...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/packer-tool/0ab765e5-b65a-4a4d-9516-bef9fa5293c9%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/packer-tool/0ab765e5-b65a-4a4d-9516-bef9fa5293c9%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> >>> >>> -- >>> Alvaro >>> >>> -- >> 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...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/packer-tool/17e86fd0-f110-4447-9a2a-20735ee72c85%40googlegroups.com >> >> <https://groups.google.com/d/msgid/packer-tool/17e86fd0-f110-4447-9a2a-20735ee72c85%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > Alvaro > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/7a55e00c-64be-458a-bcd2-0ff35d7c045a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.