Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I tried to convert a VMDK image found in a OVA file to the QCOW2 format with the qemu-img command but it failed with the error message qemu-img: error while reading sector 131072: Invalid argument

user@ubuntu:/tmp$ wget ftp://ftp.sanger.ac.uk/pub/databases/Pfam/vm/PfamWeb_20120124.ova
user@ubuntu:/tmp$ tar xfv PfamWeb_20120124.ova
PfamWeb_20120124_2.ovf
PfamWeb_20120124_2.mf
PfamWeb_20120124_2-disk1.vmdk
user@ubuntu:/tmp$ qemu-img convert -O qcow2 PfamWeb_20120124_2-disk1.vmdk PfamWeb_20120124_2.qcow2
qemu-img: error while reading sector 131072: Invalid argument
user@ubuntu:/tmp$ qemu-img --version | grep "qemu-img version" 
qemu-img version 1.0, Copyright (c) 2004-2008 Fabrice Bellard
user@ubuntu:/tmp$ dpkg-query -f='${Version}\n' --show  qemu-utils
1.0+noroms-0ubuntu14.1
user@ubuntu:/tmp$ cat /etc/issue
Ubuntu 12.04.1 LTS \n \l

How do I avoid the error?

share|improve this question
    
Upgrading qemu-img from source WORKED, thanks Erik!!!!!! –  user157073 Feb 1 '13 at 4:40

2 Answers 2

up vote 3 down vote accepted

A bug related to this was fixed in qemu version 1.2.0. Ubuntu 12.04 has an older qemu version, but if you install qemu-img from source code

user@ubuntu:/tmp$ sudo apt-get install libglib2.0-dev
user@ubuntu:/tmp$ wget http://wiki.qemu.org/download/qemu-1.2.0.tar.bz2
user@ubuntu:/tmp$ tar xfj qemu-1.2.0.tar.bz2
user@ubuntu:/tmp$ cd qemu-1.2.0
user@ubuntu:/tmp/qemu-1.2.0$ ./configure && make qemu-img

the conversion runs without errors

user@ubuntu:/tmp/qemu-1.2.0$ cd /tmp
user@ubuntu:/tmp$ /tmp/qemu-1.2.0/qemu-img convert -O qcow2 PfamWeb_20120124_2-disk1.vmdk PfamWeb_20120124_2.qcow2
user@ubuntu:/tmp$
share|improve this answer
    
FWIW: it does not help. I have the same problem and 1.2 (and even the git version) output the same error message, just with different sector number –  fork0 Sep 28 '12 at 18:56
    
Using qemu-1.2 on Ubuntu-Quantal-12.10 also works without problems. –  webwurst Dec 4 '12 at 11:10

Even after compiling qemu from source (from the distributed package or from git), I still had this issue (albeit with a slightly different error; it complained 'image' uses a vmdk feature which is not supported by this qemu version: VMDK version 3). This was not an OVA created in 1871 by candlelight; it's actually GitHub Enterprise. So why this is not supported in any version of QEMU I could find is still confusing, and I'd welcome some additional insight if anyone has it.

At any rate, the solution I found was to grab Citrix XenConvert from http://www.citrix.com/downloads/xenserver/tools/conversion.html . Bafflingly, newer versions have dropped support for simple format conversions, but 2.3.1 allowed me to change the VMDK (extracted from the OVA via a simple "tar -xf") to a VHD, whereupon qemu-img could take it from there. It's possible that the VMWare Converter could also have handled the task; it's at http://www.vmware.com/go/getconverter .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.