Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

QEMU/KVM permission problem

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
Udaba
Posts: 80
Joined: 2019-03-18 00:35
Has thanked: 4 times

QEMU/KVM permission problem

#1 Post by Udaba »

Im facing a problem with QEMU/KVM. When i create a file on my secondary ssd with .qcow2 and set it as a custome storage space im getting :"The emulator may not have search permissions for the path '/media/blah/blah/blah.qcow2." and then im asked to correct his now . What im doing wrong?

Im using debian testing and the secondary ssh is set autostart at fstab.Someone recommend me to run this : sudo -u libvirt-qemu touch /path/to/image but i got this : : touch: cannot touch '/media/blah/blah': Permission denied
Any ideas? thanks in advance.

CwF
Global Moderator
Global Moderator
Posts: 2683
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: QEMU/KVM permission problem

#2 Post by CwF »

Note the #, so 'as root' or sudo

Code: Select all

# ln -s --target-directory=/var/lib/libvirt/images /media/blah/blah/blah.qcow2
I'd recommend not ever specifying any foreign directory, link instead to default storage pool.
Depending, you may need to add libvirt group rights to the source directory if it is in user space.

Udaba
Posts: 80
Joined: 2019-03-18 00:35
Has thanked: 4 times

Re: QEMU/KVM permission problem

#3 Post by Udaba »

CwF wrote: 2022-08-20 00:47 Note the #, so 'as root' or sudo

Code: Select all

# ln -s --target-directory=/var/lib/libvirt/images /media/blah/blah/blah.qcow2
I'd recommend not ever specifying any foreign directory, link instead to default storage pool.
Depending, you may need to add libvirt group rights to the source directory if it is in user space.
Thanks for your answer.Did that and after trying again to use .qcow2 storage i got permission denied. How i can add libvirt to group rights?

CwF
Global Moderator
Global Moderator
Posts: 2683
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: QEMU/KVM permission problem

#4 Post by CwF »

Udaba wrote: 2022-08-20 01:19 Did that and after trying again to use .qcow2 storage i got permission denied
Do you have root?
If /media is on the same disk as /var/lib/libvirt/images then there is no reason not to put the qcow in /var/lib/libvirt/images.

The VM definition should use /var/lib/libvirt/images/blah.qcow2 as it's storage - regardless of where the file actually resides. Hence, using links.

When you have extra devices to offload qcow storage, the easy simple link works fine, as is does with /dev/disk or tmpfs.

Are you using a user /media/user/ directory? Why?
Check the permissions, add others r/w or libvirt r/w. How you do this depends on to many choices, I do all the above including linking disk in Thunar with right click custom actions. I suppose you could give permissions to the file, or the directory - or move the file to a new root storage like /pool/cows and give it others read/write.

CwF
Global Moderator
Global Moderator
Posts: 2683
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: QEMU/KVM permission problem

#5 Post by CwF »

Udaba wrote: 2022-08-20 01:19 How i can add libvirt to group rights?
I use Thunar, a separate conversation.

Udaba
Posts: 80
Joined: 2019-03-18 00:35
Has thanked: 4 times

Re: QEMU/KVM permission problem

#6 Post by Udaba »

CwF wrote: 2022-08-20 01:41
Udaba wrote: 2022-08-20 01:19 Did that and after trying again to use .qcow2 storage i got permission denied
Do you have root?
If /media is on the same disk as /var/lib/libvirt/images then there is no reason not to put the qcow in /var/lib/libvirt/images.

The VM definition should use /var/lib/libvirt/images/blah.qcow2 as it's storage - regardless of where the file actually resides. Hence, using links.

When you have extra devices to offload qcow storage, the easy simple link works fine, as is does with /dev/disk or tmpfs.

Are you using a user /media/user/ directory? Why?
Check the permissions, add others r/w or libvirt r/w. How you do this depends on to many choices, I do all the above including linking disk in Thunar with right click custom actions. I suppose you could give permissions to the file, or the directory - or move the file to a new root storage like /pool/cows and give it others read/write.
I tried sudo . Im not very experienced user. What and how i should change?

CwF
Global Moderator
Global Moderator
Posts: 2683
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: QEMU/KVM permission problem

#7 Post by CwF »

Udaba wrote: 2022-08-21 14:31 What and how i should change?
First step, move the qcow2 file.
CwF wrote: 2022-08-20 01:41 The VM definition should use /var/lib/libvirt/images/blah.qcow2 as it's storage
Since you didn't absorb even though you quoted...
If you can't move or copy the cow from /media AND redefine the VM to use /var, tell me why.
-Ok scratch - I reread. Your cow is in media because it is on a user mounted device, I did cover that... That disk needs mounted with the permissions I've mentioned.

So perhaps fill in what environment your in! I use XFCE, these procedures are all possible within the GUI (with tweaks). My prior quote does cover it.

I like easy, I don't pretend to pay attention to anything but Virtual Machine Manager under XFCE.

Make sure the VM is set to the proper storage location in /var/lib/libvirt/images/
use sudo to mount the ssd in ROOT space, not shared /media, I mentioned /pool/
then use sudo to link as stated..
Use code tags to quote your errors.

Udaba
Posts: 80
Joined: 2019-03-18 00:35
Has thanked: 4 times

Re: QEMU/KVM permission problem

#8 Post by Udaba »

CwF wrote: 2022-08-21 15:29
Udaba wrote: 2022-08-21 14:31 What and how i should change?
First step, move the qcow2 file.
CwF wrote: 2022-08-20 01:41 The VM definition should use /var/lib/libvirt/images/blah.qcow2 as it's storage
Since you didn't absorb even though you quoted...
If you can't move or copy the cow from /media AND redefine the VM to use /var, tell me why.
-Ok scratch - I reread. Your cow is in media because it is on a user mounted device, I did cover that... That disk needs mounted with the permissions I've mentioned.

So perhaps fill in what environment your in! I use XFCE, these procedures are all possible within the GUI (with tweaks). My prior quote does cover it.

I like easy, I don't pretend to pay attention to anything but Virtual Machine Manager under XFCE.

Make sure the VM is set to the proper storage location in /var/lib/libvirt/images/
use sudo to mount the ssd in ROOT space, not shared /media, I mentioned /pool/
then use sudo to link as stated..
Use code tags to quote your errors.
I have 2 ssd's in my PC . If i move qcow2 file to main ssd i dont have enough space , Thats why i want it on my secondary SSD . Maybe thats why i dont have permissions?
How i can set the mounted device with permissions?

CwF
Global Moderator
Global Moderator
Posts: 2683
Joined: 2018-06-20 15:16
Location: Colorado
Has thanked: 41 times
Been thanked: 196 times

Re: QEMU/KVM permission problem

#9 Post by CwF »

Udaba wrote: 2022-08-22 12:43 If i move qcow2 file to main ssd i dont have enough space
Ya, I got that on my reread...
CwF wrote: 2022-08-21 15:29 So perhaps fill in what environment your in!
I it would

Make a directory with root /pool/cows on primary ssd
Mount with sudo mount /dev/disk/by-label/wheteversecondaryssdiscalled /pool/cows/
link with sudo ln -s --target-directory=/var/lib/libvirt/images /pool/cows/blah.qcow2
Create vm with /var/lib/libvirt/images/blah.qcow2

I'm assuming your user has permission to use vm's

Udaba
Posts: 80
Joined: 2019-03-18 00:35
Has thanked: 4 times

Re: QEMU/KVM permission problem

#10 Post by Udaba »

Sorry but i didnt understand that. I cant complete this. Im a beginner. Just wanted to set up a VM. Using oracle (which is s**t) is much easier sadly :(
Thanks for your effort though.
edit: The machine im trying to set up the VM runs testing LXQT(unofficial 1.1.1). Im a beginner so i havent changed anything else.

trinidad
Posts: 299
Joined: 2016-08-04 14:58
Been thanked: 16 times

Re: QEMU/KVM permission problem

#11 Post by trinidad »

You can't believe your eyes if your imagination is out of focus.

Post Reply