why packer stop for any error?

884 views
Skip to first unread message

Robert Wang

unread,
Jan 5, 2018, 11:34:24 PM1/5/18
to Packer
I used packer to build ubuntu 17 box, it stop and destroy vm for any error message,

    virtualbox-iso: VirtualBox Guest Additions: modprobe vboxsf failed
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 2

It never stop when build centos 7 for same error.

Is any way to prevent to stop and destroy vm when get error?

env:

win7 + msys64 

$ packer version
Packer v1.1.3



Thanks.

BR/
Robert

Rickard von Essen

unread,
Jan 6, 2018, 2:32:09 AM1/6/18
to packe...@googlegroups.com
Packer always stops when script exits with a non zero exit code. Try adding "set -x" at the top of your script (after the shebang) and se why it fails.

You can also run packer build with -on-error=ask to get time to ssh into the VM and research the state it is in when it fails.

--
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/f08246a0-8a43-4e53-ab89-ce357fcecea7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Wang

unread,
Jan 6, 2018, 8:12:41 AM1/6/18
to Packer
Thanks, I did try -on-error=ask, there are 3 options:
clean(default), abort (left vm), ask(retry) 

sometimes I know the error is not critical and cannot avoid it for some reason,  seems no way to ignore the error to continue build box?

BR/
Robert


On Saturday, January 6, 2018 at 2:32:09 AM UTC-5, Rickard von Essen wrote:
Packer always stops when script exits with a non zero exit code. Try adding "set -x" at the top of your script (after the shebang) and se why it fails.

You can also run packer build with -on-error=ask to get time to ssh into the VM and research the state it is in when it fails.
On 6 January 2018 at 05:34, Robert Wang <robert....@gmail.com> wrote:
I used packer to build ubuntu 17 box, it stop and destroy vm for any error message,

    virtualbox-iso: VirtualBox Guest Additions: modprobe vboxsf failed
==> virtualbox-iso: Deregistering and deleting VM...
==> virtualbox-iso: Deleting output directory...
Build 'virtualbox-iso' errored: Script exited with non-zero exit status: 2

It never stop when build centos 7 for same error.

Is any way to prevent to stop and destroy vm when get error?

env:

win7 + msys64 

$ packer version
Packer v1.1.3



Thanks.

BR/
Robert

--
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.

Rickard von Essen

unread,
Jan 6, 2018, 11:19:53 AM1/6/18
to packe...@googlegroups.com
Since it's an automation tool it kind of defeats the purpose of it. And also it could lead to inconsistent state so Packer would crash later on.

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/fa720c65-c7a7-4d71-b774-032f40f10ba8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages