terra-farm / terraform-provider-virtualbox

VirtualBox provider for Terraform
https://terra-farm.github.io/provider-virtualbox/
MIT License
322 stars 137 forks source link

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

Open wBiOw opened 1 year ago

wBiOw commented 1 year ago

https://github.com/terra-farm/terraform-provider-virtualbox/blob/c25ac4f1a3c41972656aff2c65d982fb7560321d/virtualbox/image.go#L60

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.

Kraktorist commented 1 year ago

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 1 year ago

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.

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

Kraktorist commented 1 year ago

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

essemenoff commented 1 year ago

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