qemu-img: Could not open $FILE

12,116

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
Share:
12,116

Related videos on Youtube

HTTP500
Author by

HTTP500

Updated on September 18, 2022

Comments

  • HTTP500
    HTTP500 almost 2 years

    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:

    [root@host dir]# file 1.vmdk 
    1.vmdk: VMware4 disk image
    [root@host 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:

    [root@host 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)
    
    • mgorven
      mgorven over 11 years
      Try qemu-img info -f vmdk 1.vmdk.
    • mgorven
      mgorven over 11 years
      Try run it under strace to see what's happening: strace -vvvs4096 qemu-img ....
    • Michael Hampton
      Michael Hampton about 11 years
      In my experience, qemu-img has only been able to handle thick-provisioned "flat" VMDK files, i.e. the entire disk image in a single file. I recommend converting the disk image to raw before trying to use it.
  • David Corsalini
    David Corsalini over 10 years
    vmware keep changing their vmdk format to make it harder to run these VMs on any other solution, the common practice is to quickly set up a free ESXi machine, import the appliance and then convert it to your KVM system using virt-v2v