Difference in format between GNU tar and OVA

This is for discussing general topics about how to use VirtualBox.
Post Reply
machinist
Posts: 1
Joined: 11. Mar 2013, 22:38

Difference in format between GNU tar and OVA

Post by machinist »

I'm writing a tool that needs to wrap .ovf XML and disk images into a single .ova tarball. The .ovf files and disk images can be imported into Virtualbox with no problem, but importing the .ova files generated by `tar -cf example.ova example.ovf example.vm*` results in errors about invalid XML or disk images that can't be found. I see no significant difference between the untarred OVA files exported from Virtualbox and the files I'm trying to tar into an OVA. It's my understanding that this may be a result of a slight difference in the tar format between GNU tar and Virtualbox OVAs. Can anyone shed any light on how I might go about creating a valid OVA given the files it should contain?

edit: To be more specific, I've tried using tar from GNU, BSD and Sun systems, and I have tried all the format options (especially ustar and GNU, since the OVA spec says to use ustar and the `file` utility reports OVA files as being in GNU format. Sun's tar appears to be the closest in terms of binary format, but either way I get the following error (if I put the disk image before the OVF in the archive I get invalid XML errors). Again, all these files work just fine when they're not tarred, so I believe it's not a problem with the disk image or the XML but the way I'm archiving them. I get these errors regardless of whether example.vmdk is actually located under /path or whether it is only found inside the OVA tarball, but it's odd that the error implies it's looking for the disk image in /path in the first place:

Code: Select all

Failed to import appliance /path/example.ova
Could not open the medium storage unit '/path/example.vmdk'
VMDK: inconsistent references to grain directory in 'path/example.vmdk'
VD: error VERR_VD_VMDK_INVALID_HEADER opening image file 'path/example.vmdk'

Result Code: VBOX_E_FILE_ERROR (0x80BB0004)
Component: Appliance
Interface: IApplance {...}
edit:

I've been able to work around this issue by importing and exporting using VBoxManage, however it would be nice to not pull in the dependency on VBoxManage on this server for something that could be as simple as a specially formatted tarball.

Code: Select all

VBoxManage import example.ovf
VBoxManage export example --output example.ova
VBoxManage unregistervm example --delete
Post Reply