KVM cannot access files located on an external HDD. (SOLVED)
Tofloor
poster avatar
savanweylyn
deepin
2017-02-21 10:31
Author
Edited by savanweylyn at 2017-2-25 15:36

I have a 30 GB sytem partition for Deepin (on a 120 GB SSD) and a 500 GB external HDD (the old HDD of my laptop). The HDD has an EXT4 file system, and is mounted under /media/weylyn1/data, with the options: rw,nosuid,nodev,relatime,data=ordered. Whenever i try to access a file on it with kvm, i get an error message like this:
  1. Cannot finish installation: 'internal error: process exited while connecting to monitor: 2017-02-20T18:21:45.968433Z qemu-system-x86_64: -drive file=/media/weylyn1/data/DOS71CD.ISO,format=raw,if=none,id=drive-ide0-0-1,readonly=on: Could not open '/media/weylyn1/data/DOS71CD.ISO': Permission denied'
Copy the Code
The result is the same if i chown the files on it as 119:128 (libvirt-qemu:libvirt-qemu), chown the whole drive, set permissions 777 on the specific file I need or 0777 for the whole drive. If i copy the images to /var/lib/libvirt or to /home/weylyn1, KVM can access them. I'd like to try out a few Linux distros (e.g. OpenSUSE or Fedora) that run really slow in other hypervisors like VirtualBox or VMware. Please help.
Reply Favorite View the author
All Replies
tc25898
deepin
2017-02-21 11:50
#1
你用sudo dde-file-manager开文件管理器后能打开该文件吗?
Reply View the author
laoguang
deepin
2017-02-21 18:23
#2
maybe if you reboot you would have to chown again?
Reply View the author
savanweylyn
deepin
2017-02-22 07:04
#3
https://bbs.deepin.org/post/135114
maybe if you reboot you would have to chown again?

I didn't need to chown anything after reboot. The owner and group remains qemu-kvm.
Reply View the author
savanweylyn
deepin
2017-02-22 07:05
#4
https://bbs.deepin.org/post/135114
你用sudo dde-file-manager开文件管理器后能打开该文件吗?

I don't know Chinese.
Reply View the author
tc25898
deepin
2017-02-22 15:20
#5

Sorry.
You may try "sudo dde-file-manager" and see if you can access the file in that mounted partition.
Reply View the author
savanweylyn
deepin
2017-02-23 01:49
#6
https://bbs.deepin.org/post/135114
Sorry.
You may try "sudo dde-file-manager" and see if you can access the file in that mounted par ...

I can access everything with this.
Reply View the author
laoguang
deepin
2017-02-24 19:51
#7
just sudo -s?
Reply View the author
savanweylyn
deepin
2017-02-26 06:18
#8

Yes, the directory is accessible with sudo -s.
In the meantime I've managed to find the solution: i had to launch virt-manager as root (via gksudo virt-manager) and choose a disk image from that directory. The program complained that it doesn't have permissions to access that directory and asked wether i want to fix it or not. I choose 'Yes' and it has created the VM. After making sure that the VM is working, I closed it, started it as a normal user and now it's working. I've used it before and it was always asked wether i want it to fix permission issues or not while running it as single user, so I didn't tried to run it as root earlier.
Reply View the author
laoguang
deepin
2017-03-02 15:46
#9
https://bbs.deepin.org/post/135114
Yes, the directory is accessible with sudo -s.
In the meantime I've managed to find the solution:  ...

Deepin seems to have this kind of issue, the last time I tried to access isos from my hard drive(using deepin on usb), I encounter a similar issue. Maybe you can manual chmod the entire drive or alter the vm process group(adding to root?). Not sure if will persist after reboot though.
Reply View the author
savanweylyn
deepin
2017-03-03 08:26
#10
https://bbs.deepin.org/post/135114
Deepin seems to have this kind of issue, the last time I tried to access isos from my hard drive(u ...

Were the files on the HDD owned by the same user and group on the USB as on the HDD?

Anyway, i managed to solve it as i wrote previously.
Reply View the author