KVM can't access qcow2 images storend on an external HDD
Solution 1
The problem I was having was that my system (Fedora 27) automatically mounts new drives (external HDDs, USB, SD) to
/run/media/(username)/(device name)
For whatever reason this causes the permissions issue. What I did to fix the issue was unmount the drive from that location as root, and then mount it to /mnt
. My USB thumb drive is /dev/sdc1
on my system so I did the following.
# su - (then enter root password)
# umount /run/media/yourusername/devicename
# mount /dev/sdc1 /mnt (mount usb to /mnt)
After that I just made sure to have symbolic links from the original location of the qcow2 drives to the new location (still as root)
# cd /var/lib/libvirt/images
# ln -s (new target) (link name)
so if your vm is named MyVM
# ln -s /mnt/Myvm.qcow2 MyVm.qcow2
Once I saw that my VMs were now working, I edited /etc/fstab
to automatically mount the drive at /mnt
. The folders and qcow2 drives were owned by my standard user account and group. I am sure there are better ways to do it, but this is what worked for me.
Solution 2
This is because the Qemu requires execution permission along the image file's path. If the image is in the mounted disk, it requires +x permission in the /media/$username
For me, I fixed this issue by this command:
sudo chmod a+x /media/houcheng/
For rest of the detail, please see this.
Solution 3
Solution: Run Virtmanager as root, choose create a new VM -> select 'Import existing disk image' and browse it. After clicking continue it will ask whether you want it to fix permission issues or not for that path. After choosing 'Yes', it fixes the permission issue and will work when it's running as a normal user too.
Solution 4
This a permission issue for qemu
accessing the folder where VMs are stored.
I had an issue who looks like this, I resolved it by giving qemu
access permissions to the folder (it was /home/mos
in my case):
$ sudo setfacl -m u:qemu:x /home/mos
Related videos on Youtube
![Mateusz](https://i.stack.imgur.com/gMfFN.jpg?s=256&g=1)
Mateusz
Updated on September 18, 2022Comments
-
Mateusz almost 2 years
What is a correct notation of these two instructions?
lw $t1, array($t2) la $t3, address
I think that it would be
Reg[t1] := Memory[array + t2] Reg[t3] := address
But I am not sure. Because if lw loads content of memory, then la will load only address, am I right?
lw $t1, address # Reg[t1] = Memory[address]
-
Peter Cordes over 2 yearsNote that
la
is only a pseudo-instruction, the machine never even sees it directly. Same forlw
with a label address, unless that label happens to be in the low 16 bits of address space so the assembler can use a singlelw imm16($zero)
instruction withoutlui
.
-
-
Mateusz over 8 yearsso can the la be written is notation similiar to this one I provided?
-
George Moralis over 8 yearsin special cases probably. Look here : cs.umd.edu/class/sum2003/cmsc311/Notes/Mips/pseudo.html
-
Weylyn Savan over 7 yearsvirsh pool-dumpxml default > new_pool.xml error: failed to get pool 'default' error: Storage pool not found: no storage pool with matching name 'default' Also virsh pool-list list shows no pools.
-
Weylyn Savan over 7 yearsOk, default pool created and is active. It points to the directory where i store the images. Permissions: mode: 0777, owner: 119, group: 128. Still access denied.
-
RobotJohnny over 7 yearsThe above has worked for me in the past. I'm not sure what the issue could be other than ownership without seeing your setup. an alternate method you could try, is a symlink on the additional storage directory to /var/lib/libvirt/images directory:
ln -sf /path/to/additional/storage /var/lib/libvirt/images
Permissions/ownership will need to be identical for that to work, but I can't vouch for that working definitely, as I haven't tested it myself -
Weylyn Savan over 7 yearsIt's still not working. There's a video link in the question so you can see this part of my setup. For some reason it won't play from Google Drive so you have to download it but don't worry, it's only 17,1 MB.
-
haidarvm almost 5 yearsno one seeing this ? it's works great on my RHEL 8 system just move any qcow2 & iso to /home folder. Thanks a lot :)
-
annahri over 3 yearsTurning off selinux is not an actual answer. It's like when you want to shutdown your machine by pulling off the power plug.
-
poleguy over 3 yearsWell, not quite "not an actual answer".... Running this command did allow me to access the images... so it is technically an answer. However, I agree you really should only do this to debug the issue and then put in an actual fix. I'll add a note to this affect.
-
Peter Cordes over 2 yearsGeorge (and @Mateusz):
lw $reg, address
is also a pseudo-instruction, usinglui
/lw
. (Unless you're using MARS or something configured with the data section starting at a low address, solw $t1, address
can assemble tolw $t1, address($zero)
, i.e. the full address fitting in the 16-bit-sign-extended displacement in the I-typelw
instruction.) So the question is correct about the firstlw
, but the secondlw
is the same as thela
, whether you consider that right or wrong. Note that$at
isn't needed here; you canlui
/ori
both into$t3