tianon / docker-qemu

Dockerization of supported QEMU releases
https://qemu.org
133 stars 34 forks source link

Permission denied when creating qemu-img #45

Closed RodBelaFarin closed 1 year ago

RodBelaFarin commented 1 year ago

I created the hda.qcow2 file as described using touch in my directory. But from the container log I get a permission denied error inside the container.

qemu-img create -f qcow2 -o preallocation=off /tmp/hda.qcow2 50G qemu-img: /tmp/hda.qcow2: Could not create '/tmp/hda.qcow2': Permission denied

adelmosilva commented 1 year ago

Hi, guys. I have the same issue. Can someone help us, pls?

tianon commented 1 year ago

Are you mounting your directory on top of /tmp inside the container? Does the user you are running the container as have permission to write to the file?

(Honestly, you'd probably get better help from a dedicated support forum, such as the Docker Community Slack, Server Fault, Unix & Linux, or Stack Overflow.)

RodBelaFarin commented 1 year ago

Didn't work out for me. The file did have all permissions.

My solution was now to create the virtual disk on my host system using

qemu-img create hda.img 50G

instead of using touch to create an empty file.

Also I am using .img instead of the older .qcow2