-
Notifications
You must be signed in to change notification settings - Fork 778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qemu-kvm: could not open disk image ' ': Permission denied #996
Comments
SOLVED: found a way. # The user for QEMU processes run by the system instance. It can be
# specified as a user name or as a user id. The qemu driver will try to
# parse this value first as a name and then, if the name doesn't exist,
# as a user id.
#
# Since a sequence of digits is a valid user name, a leading plus sign
# can be used to ensure that a user id will not be interpreted as a user
# name.
#
# Some examples of valid values are:
#
# user = "qemu" # A user named "qemu"
# user = "+0" # Super user (uid=0)
# user = "100" # A user named "100" or a user with uid=100
#
user = "root"
# The group for QEMU processes run by the system instance. It can be
# specified in a similar way to user.
group = "root"
# Whether libvirt should dynamically change file ownership
# to match the configured user/group above. Defaults to 1.
# Set to 0 to disable file ownership changes.
#dynamic_ownership = 1
[root@dev1 ~]# service libvirtd restart
Stopping libvirtd daemon: [ OK ]
Starting libvirtd daemon: [ OK ] |
I don't think it is wise to make such edits letting qemu running as root. You should put the ISO file in a directory that is readable by qemu user, for example |
The qemu user needs search permissions all the way up the path, that means You can tell if that's your problem when unix permissions are correct but you can't |
Encountered same issue, after digging ACL issue, I have to grant supplementary right on my HOME
|
Murlock's suggestions fixed the same issue for me as well. Only difference was the user was named "qemu" instead of "libvirt-qemo" |
@murlock |
If you copy your ISO image to |
@murlock |
If none above worked for you (not even having qemu run as E.g., instead of this: Edit: turns out it was AppArmour, denying accessing the volume through the libvirt pool interface as stated here #996 (comment) |
@lacksfish's solution seems to be the easiest one. Worked for me. |
I have my images in a drive mounted in /media/user/Data |
@murlock |
Using Terraform with the libvirt Provider, I got the same error. But the problem was Apparmour: dmacvicar/terraform-provider-libvirt#97 For testing purpose, I simply set |
If you are using libvirt backup disks on openstack, you need to modify the permissions of users such as nova, glance, and cinder to the backup directory |
then,reboot |
This is what worked for me. Thanks. |
Simply add your username to libvirt group and then instead of root replace with your username and group in
No need to mess with acl or run it as root. After making necessary changes simply execute |
I followed this and did something like: cd $(mktemp -d)
cp ~/my-installer.iso .
chmod 777 .
sudo virt-install ... --cdrom my-installer.iso This is to bypass all the ACLs. Please tell me if there's something wrong with this. |
Tnx @codingenesis . Exactly what i needed! :) sudo groupadd --system libvirt
sudo usermod -a -G libvirt $(whoami)
newgrp libvirt
id $(whoami)
sudo vim /etc/libvirt/libvirtd.conf
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
sudo vim /etc/libvirt/qemu.conf
user = "howdy"
group = "rowdy"
sudo systemctl restart libvirtd.service |
After trying almost all of the above, a very simple "chmod all" fix appeared when someone over at StackExchange explain what kind of perms Qemu needs.
Explanation given:
|
Exactly. If admins are storing their ISOs in nontraditional directories, this should be implemented. |
Thx. |
it just may be permissions + chmod+x and permissions of folder and home. It helped me to boot os x vm. Now trying to realise GPU passthrough... |
ERROR internal error: qemu unexpectedly closed the monitor: 2020-05-14T17:31:41.184108Z qemu-system-x86_64: -drive file=/home/travis/build/williamcroberts/selinux/Fedora-Cloud-Base-32-1.6.x86_64.raw,format=raw,if=none,id=drive-ide0-0-0: Could not open '/home/travis/build/williamcroberts/selinux/Fedora-Cloud-Base-32-1.6.x86_64.raw': Permission denied Domain installation does not appear to have been successful. If it was, you can restart your domain by running: virsh --connect qemu:///system start demo otherwise, please restart your installation. I found this: - jedi4ever/veewee#996 Maybe we don't need these sudo's Signed-off-by: William Roberts <william.c.roberts@intel.com>
This was such an effing thing !!!! |
@vap0rtranz
Indeed solved it But ... Why the hell it needs it ? |
none of the solutions you proposed worked.
OUTPUT
I modified /etc/libvirt/qemu.conf by uncommenting user / group. |
I'm sorry my solutions didn't work for you. Unfortunately I am no longer working with this project and therefore cannot adapt the code further.
Best of luck to you!
Donna Perygin
…________________________________
From: tiziano-pedrazzoli ***@***.***>
Sent: Friday, July 30, 2021 7:29 AM
To: jedi4ever/veewee ***@***.***>
Cc: Donna Perygin ***@***.***>; Comment ***@***.***>
Subject: Re: [jedi4ever/veewee] qemu-kvm: could not open disk image ' ': Permission denied (#996)
none of the solutions you proposed worked.
command:
virsh qemu-monitor-command --pretty ubuntu20.04 '
{"execute": "transaction",
"arguments": {
"actions": [
{"type": "block-dirty-bitmap-add",
"data": {"node": "libvirt-1-format", "name": "bitmap0"}},
{"type": "drive-backup",
"data": {"device": "libvirt-1-format", "target": "/home/user/vm/backup.qcow2",
"sync": "full", "format": "qcow2"}}
]
}
} '
OUTPUT
{
"id": "libvirt-14",
"error": {
"class": "GenericError",
"desc": "Could not create file: No such file or directory"
}
}
I modified /etc/libvirt/qemu.conf by uncommenting user / group.
i chmod on the folder putting the permissions to 777 and a + x.
i disabled apparmour in /etc/libvirt/qemu.conf with security_driver = "none".
i also tried sudo setfacl -m u: libvirt-qemu: rx / home / user / vm.
I don't know what to do anymore
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fjedi4ever%2Fveewee%2Fissues%2F996%23issuecomment-889860398&data=04%7C01%7Cdperygin%40jsu.edu%7C531a2321a2c24a6df76208d95355ad7b%7C32f44c14cd0e4539b7633c860a76727a%7C0%7C0%7C637632449719424885%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=MuWh2JSsvRxxA2fGz3ACsKw%2FUbwGgL4SF7YZvnjrl2U%3D&reserved=0>, or unsubscribe<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.luolix.top%2Fnotifications%2Funsubscribe-auth%2FADZJ5PN3VLXFM6XFJMQQCGDT2KLKTANCNFSM4AV3ITTQ&data=04%7C01%7Cdperygin%40jsu.edu%7C531a2321a2c24a6df76208d95355ad7b%7C32f44c14cd0e4539b7633c860a76727a%7C0%7C0%7C637632449719434878%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=uLO2v2QwNioCuutHwMOo4eUnIdM4phPYCFG%2FIE9RCaQ%3D&reserved=0>.
|
@tiziano-pedrazzoli |
Sorry. I am no longer maintaining this. I used it a couple of years ago and don't need it anymore. |
In the case I run the VM through the terminal (in my case from OSX-KVM). I do
|
Keep it simple sudo usermod -a -G disk $(whoami) working on debian11 |
|
@murlock Thanks! Solution worked. Effective, simple. |
If anybody is still looking to fix this and it's neither acl, perms or apparmor, Ubuntu 22.04 now has selinux. So disabling security_driver here is mandatory |
mrcloudhacker had the best an easiest solution. |
how do I resolve this? virsh attach-disk debian125 /home/debian/kvm/disks_kvm/disk1.qcow2 --target vdb --persistent |
Hi, Check my comments above for the rough instructions. 3 things can go wrong, User and group filesystem permissions (libvirt and KVM runs as it's own user) Apparmor or SELunix permissions. Some ACL. Since you are placing the disk inside your home, it's probably security. Try placing it in the same directory as the first disk or |
Thanks friend, I managed to solve it by changing the user and group to root in the |
I also believe that I managed to solve why I changed the |
I'm using Archlinux and it appears You can either You could also just use ACL to allow libvirt-qemu access without changing user/group/permissions, but I prefer this. |
This worked for me as well; but seriously, why is this needed? |
A bit counterintuitively, but execute rights and not read rights are needed for directory traversal in POSIX based systems. It's been a thing so long it's almost impossible to change now. |
谢谢,这对我很有用 |
Following the KVM documentation I stumbled across this permissions error.
Running as root on Centos 6.5
The text was updated successfully, but these errors were encountered: