You are missing on pair of [ ] in your vboxmanage_post command, it should
be:
"vboxmanage_post": [
["modifyvm", "{{.Name}}", "--nic1", "bridged"]
],
On 25 January 2018 at 06:21, JerryWang <[email protected]> wrote:
>
> from the debug log info :
>
>
> 2018/01/25 10:25:32 ui: ask: ==> vboxOvfBuilder: Pausing after run of step
> 'StepProvision'. Press enter to continue.
> 2018/01/25 10:25:43 ui: ==> vboxOvfBuilder: Gracefully halting virtual
> machine...
> 2018/01/25 10:25:43 packer: 2018/01/25 10:25:43 Executing shutdown
> command: shutdown -P now
> 2018/01/25 10:25:43 packer: 2018/01/25 10:25:43 opening new ssh session
> 2018/01/25 10:25:43 packer: 2018/01/25 10:25:43 starting remote command:
> shutdown -P now
> 2018/01/25 10:25:44 packer: 2018/01/25 10:25:44 Remote command exited
> without exit status or exit signal.
> 2018/01/25 10:25:44 packer: 2018/01/25 10:25:44 Waiting max 5m0s for
> shutdown to complete
> 2018/01/25 10:25:54 packer: 2018/01/25 10:25:54 VM shut down.
> 2018/01/25 10:25:54 ui: ask: ==> vboxOvfBuilder: Pausing after run of step
> 'StepShutdown'. Press enter to continue.
> 2018/01/25 10:26:41 ui: ask: ==> vboxOvfBuilder: Pausing after run of step
> 'StepRemoveDevices'. Press enter to continue.
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> +++++++++++++++++++++++++++++++++++++
> 2018/01/25 10:26:44 ui: ==> vboxOvfBuilder: Executing custom VBoxManage
> commands...
> 2018/01/25 10:26:44 ui: vboxOvfBuilder: Executing: modifyvm
> 2018/01/25 10:26:44 packer: 2018/01/25 10:26:44 Executing VBoxManage:
> []string{"modifyvm"}
> 2018/01/25 10:26:44 packer: 2018/01/25 10:26:44 stdout: Usage:
> 2018/01/25 10:26:44 packer:
> 2018/01/25 10:26:44 packer: VBoxManage modifyvm <uuid|vmname>
> 2018/01/25 10:26:44 packer: [--name <name>]
> 2018/01/25 10:26:44 packer: [--groups <group>,
> ...]
> 2018/01/25 10:26:44 packer: [--description
> <desc>]
> 2018/01/25 10:26:44 packer: [--ostype <ostype>]
> 2018/01/25 10:26:44 packer: [--iconfile
> <filename>]
> 2018/01/25 10:26:44 packer: [--memory
> <memorysize in MB>]
> 2018/01/25 10:26:44 packer: [--pagefusion
> on|off]
> 2018/01/25 10:26:44 packer: [--vram <vramsize
> in MB>]
> 2018/01/25 10:26:44 packer: [--acpi on|off]
> 2018/01/25 10:26:44 packer: [--pciattach
> 03:04.0]
> 2018/01/25 10:26:44 packer: [--pciattach
> 03:04.0@02:01.0]
> 2018/01/25 10:26:44 packer: [--pcidetach
> 03:04.0]
> 2018/01/25 10:26:44 packer: [--ioapic on|off]
> 2018/01/25 10:26:44 packer: [--hpet on|off]
> 2018/01/25 10:26:44 packer:
> [--triplefaultreset on|off]
> 2018/01/25 10:26:44 packer: [--apic on|off]
> 2018/01/25 10:26:44 packer: [--x2apic on|off]
> ............................................................
> ..............................................................
>
>
>
>
> On Thursday, January 25, 2018 at 1:00:17 PM UTC+8, Rickard von Essen wrote:
>>
>> What's the error message?
>>
>> On Jan 25, 2018 04:30, "JerryWang" <[email protected]> wrote:
>>
>>> thanks for your reply.
>>> this json can be working successfully,
>>>
>>> "vboxmanage" : [
>>> [ "modifyvm", "{{.Name}}", "--memory", "{{user `memSize`}}"],
>>> [ "modifyvm", "{{.Name}}", "--cpus", "{{user `cpuCount`}}" ],
>>> [ "modifyvm", "{{.Name}}", "--nic1", "nat"]
>>> ],
>>>
>>> if i add vboxmanage_post
>>> <https://www.packer.io/docs/builders/virtualbox-iso.html#vboxmanage_post>
>>> like
>>> this,
>>> "vboxmanage_post": ["modifyvm", "{{.Name}}", "--nic1", "bridged"],
>>>
>>> but when running the json, vboxmanage run failed, can you help to tell
>>> me what's the problem with my json file ?
>>> my packer version is 1.1.3.
>>>
>>> from my point, after vm was poweroff, can {{.Name}} point to the new
>>> created vm ?
>>>
>>>
>>> the full json file is:
>>> {
>>> "description" : "import a existing ova and pull image and
>>> then export to as a ova image",
>>>
>>> "variables" : {
>>> "diskImg" : "/vmimage/OMSP.ova",
>>> "vmName" : "OracleLinux7u4_vbox",
>>> "memSize" : "2048",
>>> "cpuCount" : "1",
>>> "diskSize" : "36720",
>>> "diskFmt" : "ova",
>>> "chefCookbooks" : "cookbooks",
>>> "nicInterFace" : "eno1",
>>> "chefRunlist" : "recipe[httpd]"
>>> },
>>>
>>> "builders" : [{
>>> "type" : "virtualbox-ovf",
>>> "name" : "vboxOvfBuilder",
>>> "vboxmanage" : [
>>> [ "modifyvm", "{{.Name}}", "--memory", "{{user `memSize`}}"],
>>> [ "modifyvm", "{{.Name}}", "--cpus", "{{user `cpuCount`}}" ],
>>> [ "modifyvm", "{{.Name}}", "--nic1", "nat"]
>>> ],
>>> "vboxmanage_post": ["modifyvm", "{{.Name}}", "--nic1", "bridged"],
>>> "export_opts":
>>> [
>>> "--manifest",
>>> "--vsys", "0",
>>> "--description", "create vm with nat and then change to bridged",
>>> "--version", "2.0"
>>> ],
>>> "source_path" : "{{user `diskImg`}}",
>>> "format" : "{{user `diskFmt`}}",
>>> "headless" : true,
>>> "vrdp_bind_address" : "0.0.0.0",
>>> "ssh_host_port_min" : 2222,
>>> "ssh_host_port_max" : 2229,
>>> "output_directory" : "images-{{timestamp}}",
>>> "communicator" : "ssh",
>>> "ssh_port" : 22,
>>> "ssh_username" : "root",
>>> "ssh_password" : "welcome1",
>>> "ssh_wait_timeout" : "1500s",
>>> "vm_name" : "oraclelinux7u4-vbox_bridge_1n
>>> at-{{timestamp}}",
>>> "shutdown_command" : "shutdown -P now"
>>> }
>>> ],
>>> "provisioners": [{
>>> "type" : "shell",
>>> "script" : "scripts/getimage.sh"
>>> }
>>> ]
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Wednesday, January 24, 2018 at 10:03:36 PM UTC+8, Rickard von Essen
>>> wrote:
>>>>
>>>> See https://www.packer.io/docs/builders/virtualbox-iso.html#
>>>> vboxmanage_post
>>>>
>>>> On Jan 24, 2018 14:11, "JerryWang" <[email protected]> wrote:
>>>>
>>>>> this steps should be done after provioner ( and vm was poweroff ),
>>>>> where to put this operation ? builder ? or post-processor ?
>>>>> thanks.
>>>>>
>>>>> --
>>>>> 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/fc2eb65c-4b39-
>>>>> 4034-a48d-1abc99be9950%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/packer-tool/fc2eb65c-4b39-4034-a48d-1abc99be9950%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>> 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/ms
>>> gid/packer-tool/591c3fd9-c030-41bd-84e2-8d67e9c18dbf%40googlegroups.com
>>> <https://groups.google.com/d/msgid/packer-tool/591c3fd9-c030-41bd-84e2-8d67e9c18dbf%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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/b8ab4dfe-94c3-461e-8b93-2e08c2a769d7%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/b8ab4dfe-94c3-461e-8b93-2e08c2a769d7%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CALz9Rt_jw6mqLfH5a%3D7TZJLF2D8gr8oSrSbqmki%2BsaPeT2jkLg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.