qemu-img: Could not open $FILE

by HTTP500   Last Updated October 10, 2019 18:00 PM

I received a single-file VMDK from a vendor that has a virtual appliance for a particular product I'm interested in evaluating.

We run a KVM solution (Proxmox) so I tried converting the file but on that system qemu-img blows up. (I was able to convert (multipart) VMDK files from bitnami without error.)

So I figured I'll just yum install qemu-img on a RHEL 6.3 VM and do it there. But despite the fact that I can file the file just fine when I run qemu-img on it I get this error that it can't open the file:

[[email protected] dir]# file 1.vmdk 
1.vmdk: VMware4 disk image
[[email protected] dir]# qemu-img info 1.vmdk 
qemu-img: Could not open 'vmdk'

I've seen some other people post on the interwebs that they've had this problem but none of them seem to have a resolution.

Does anyone have any ideas? I have checked the MD5SUM already.

EDIT1:

[[email protected] dir]# qemu-img info -f vmdk 1.vmdk 
qemu-img: Could not open '1.vmdk'

EDIT2:

Ran strace per suggestion. Not sure what to look for...

Here is a possible:

ioctl(3, CDROM_DRIVE_STATUS, 0x7fffffff) = -1 ENOTTY (Inappropriate ioctl for device)


Answers 3


I know this thread is a little old but I ran into a similar issue and wanted to share my solution in case it could help someone else. I just received an OVA file from a partner but we were using KVM as well so I couldn't use the file directly. People online said that an OVA file is pretty much a tar with the vmdk in it, but when I extracted the vmdk file from the OVA and tried to convert it, I got the following error:

[[email protected] ~]# qemu-img convert -f vmdk vm.vmdk -O raw vm.raw
qemu-img: Could not open 'vm.vmdk'
qemu-img: Could not open 'vm.vmdk'

To resolve the issue, I imported the OVA into VM Player (which is free) and then converted the vmdk file that was extracted from there (during the import into VM Player, it said the VM didn't pass compliance checks, so I clicked "Retry" and it imported successfully; which is why I'm assuming it didn't work initially when converting from the OVA vmdk to raw). So try importing your vmdk file into VM Player and see if that will "convert" the vmdk file into a format that qemu-img can read. Hopefully this helps!

Douglas
Douglas
May 15, 2013 14:09 PM

I had a similar problem with a file which was given to me. I was said that the file was in qcow format. Here is what I tried first :

% qemu-img convert -f qcow2 box.img -O vdi box.vdi                                                        
qemu-img: Could not open 'box.img': Invalid argument
qemu-img: Could not open 'box.img'
% qemu-img convert -f qcow box.img -O vdi box.vdi                                                         
qemu-img: Could not open 'box.img': Operation not permitted
qemu-img: Could not open 'box.img'

Omiting the file input format finaly worked fine :

% qemu-img convert -O vdi box.img box.vdi
psychoslave
psychoslave
April 01, 2014 08:23 AM

Similar problem converting vmdk to qcow2 qemu-img: Could not open 'image.vmdk': Could not open backing file: Unknown protocol

I used export to ova/ovf in vmware which made a different vmdk output which qemu-img accepted and converted just fine.

Kevin Higgins
Kevin Higgins
October 10, 2019 17:25 PM

Related Questions


Updated July 06, 2017 16:00 PM

Updated February 07, 2019 12:00 PM

Updated November 03, 2018 09:00 AM

Updated May 19, 2017 18:00 PM

Updated November 11, 2015 10:00 AM