terra-farm/terraform-provider-virtualbox

Error: failed to unpack image...: error unpacking golden image...

wBiOw opened this issue · 4 comments

wBiOw commented

cmd := exec.Command("tar", "-xv", "-C", toDir, "-f", image)

When run from Windows using gitBash instead of cmd gives the error "Error: failed to unpack image...: error unpacking golden image...: exit status 2". The problem is related to the key difference for "tar" when run from cmd or gitBash.

Hi!
I've just run the example provided in the repo using gitBash console and it works for me.
tar (GNU tar) 1.34 is installed in my gitBash.

Have you checked the image you are using?

wBiOw commented

Hi!
git version 2.37.0.windows.1
cmd tar --version bsdtar 3.5.2 - libarchive 3.5.2 zlib/1.2.5.f-ipp
github tar --version tar (GNU tar) 1.34

Before checking and running, you deleted the already unpacked %virtualbox .box file in a directory %virtualbox (by default it is located in "C:\Users\1.terraform\virtualbox\gold")? Because if it is already unpacked, then it is not unpacked again.

  • if run from github "./terraform apply": create directory %virtualbox in directory: "C:\Users\1.terraform\virtualbox\gold", but not Unpack %virtualbox .box
    and echo "Error: failed to unpack image %virtualbox : error unpacking golden image %virtualbox "
    if in directory: "C:\Users\1.terraform\virtualbox\gold" already an unpacked virtual machine, then everything works.

  • if run from cmd "terraform apply": creat directory %virtualbox in C:\Users\1.terraform\virtualbox\gold and Unpacking %virtualbox.box

This is a fairly common problem (appears for users on different computers).

Got it. I've reproduced the bug with the couple of different images.

It is failed in GitBash but it works for me if I run in PowerShell.
GitBash's tar version

tar (GNU tar) 1.34

PowerShell tar version

PS C:\Users\ess\.terraform\virtualbox\machine\asd> tar --version
bsdtar 3.3.2 - libarchive 3.3.2 zlib/1.2.5.f-ipp