Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

libvirt.libvirtError: Cannot access storage file ... permission denied #22

Closed
ssbarnea opened this issue May 16, 2021 · 2 comments · Fixed by #25
Closed

libvirt.libvirtError: Cannot access storage file ... permission denied #22

ssbarnea opened this issue May 16, 2021 · 2 comments · Fixed by #25
Assignees
Labels
bug This issue/PR relates to a bug.

Comments

@ssbarnea
Copy link
Member

ssbarnea commented May 16, 2021

Another issue related to user permissions

TASK [Start molecule vm(s)] **********************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: libvirt.libvirtError: Cannot access storage file '/home/ssbarnea/.local/molecule/default/vms/instance.qcow2' (as uid:107, gid:107): Permission denied
failed: [localhost] (item=instance) => {"ansible_loop_var": "item", "changed": false, "item": {"name": "instance"}, "msg": "Cannot access storage file '/home/ssbarnea/.local/molecule/default/vms/instance.qcow2' (as uid:107, gid:107): Permission denied"}

This happened after running newgrp ssbarnea & molecule create on fresh scenario.

[ssbarnea@leno molecule-libvirt]$ ls -la /home/ssbarnea/.local/molecule/default/vms/
total 659684
drwxr-xr-x. 1 ssbarnea ssbarnea          74 May 16 11:09 .
drwxr-xr-x. 1 ssbarnea ssbarnea           6 May 15 17:43 ..
-rw-r--r--. 1 ssbarnea libvirt       374784 May 16 11:09 instance-cloud-init.iso
-rw-r--r--. 1 ssbarnea libvirt  16108814336 May 16 11:09 instance.qcow2

It seems that the qcow2 image was created with wrong permissions as the libvirt group does not have write access to it and it obviously need that.

umask reports 0022 for my current user which explains why the group did not had access but in out case we do want to use a mask 0002 at least for this file.

@ssbarnea ssbarnea added the bug This issue/PR relates to a bug. label May 16, 2021
@ssbarnea ssbarnea changed the title ux: libvirt.libvirtError: Cannot access storage file ... permission denied libvirt.libvirtError: Cannot access storage file ... permission denied May 16, 2021
ssbarnea added a commit that referenced this issue May 16, 2021
@ssbarnea ssbarnea assigned ssbarnea and unassigned jamesregis May 16, 2021
@jamesregis
Copy link
Collaborator

It seems, acl for qemu has to be set on $HOME/.local. With qemu acl on $HOME and $HOME/.local I have this

(venv) [james@r620 my-role]$ ls -l ~/.local/molecule/default/vms/
total 1218368
-rw-rw-r--. 1 qemu qemu 374784 May 16 10:09 instance-cloud-init.iso
-rw-r--r--. 1 qemu qemu 16108814336 May 16 10:16 instance.qcow2

@jamesregis
Copy link
Collaborator

I see the pull request.
umask should be sufficent.

ssbarnea added a commit that referenced this issue May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants