Giter Club home page Giter Club logo

Comments (23)

polynomialspace avatar polynomialspace commented on May 18, 2024 12

If you're using SELinux or Apparmor it may be blocking access.
Spent an hour trying to figure out why I was getting permission errors on the firmware files before realizing this.

from macos-simple-kvm.

adrianlshaw avatar adrianlshaw commented on May 18, 2024 10

Another possible option is to modify the make script so that the disk image(s) get copied to Libvirt's default location (e.g. /var/lib/libvirt/images/). This might save a lot of time messing with the system policy or doing something bad (like disabling SELinux).

from macos-simple-kvm.

mrweiner avatar mrweiner commented on May 18, 2024 8

This fixed the issue for me on a mounted drive jedi4ever/veewee#996 (comment). Basically, libvert needs access to the mounted disk (or the local directory) containing the qcow file.

sudo setfacl -m u:libvirt-qemu:rx /path/to/parent/dir -- in my case sudo setfacl -m u:libvirt-qemu:rx /mnt/8507e619-7551-4395-9332-7f39f93147f2

from macos-simple-kvm.

aspicer avatar aspicer commented on May 18, 2024 1

Try ugo+rx. Test that the qemu user can access the file with:
sudo -u qemu file /path/to/file

from macos-simple-kvm.

PierrickV avatar PierrickV commented on May 18, 2024 1

Hello,

I had the same issue that I managed to solve.

My notes on this (Ubuntu 19.10) :

  • BaseSystem.img and disk.qcow2 should be placed in /var/lib/libvirt/images/ with appropriate rights.
sudo chown libvirt-qemu: /var/lib/libvirt/images/BaseSystem.img
sudo chown libvirt-qemu: /var/lib/libvirt/images/macosdisk.qcow2
  • use make.sh to create template.xml and modify it to reflect your environment
sudo ls -lah /var/lib/libvirt/images/
total 49G
drwx--x--x 2 root         root 4,0K déc.   7 15:02 .
drwxr-xr-x 7 root         root 4,0K déc.   9 14:09 ..
-rw-r--r-- 1 libvirt-qemu kvm  2,0G déc.   9 14:26 BaseSystem.img
-rw------- 1 libvirt-qemu kvm   47G déc.   9 14:43 macosdisk.qcow2
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/opt/macOS-Simple-KVM/ESP.qcow2'/>
      <target dev='sda' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/macosdisk.qcow2'/>
      <target dev='sdb' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
        <source file='/var/lib/libvirt/images/BaseSystem.img'/>
      <target dev='sdc' bus='sata'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    </disk>
  • Always verify that firmware/OVMF_CODE.fd and firmware/OVMF_VARS-1024x768.fd exist because they might have been deleted (I had to wget https://github.com/foxlet/macOS-Simple-KVM/raw/master/firmware/OVMF_VARS-1024x768.fd few times)

  • To verify that libvirt can access your files (correct rights + file exist)

sudo -u libvirt-qemu file /var/lib/libvirt/images/macosdisk.qcow2 \
 /var/lib/libvirt/images/BaseSystem.img \
 /opt/macOS-Simple-KVM/firmware/OVMF_CODE.fd  \
/opt/macOS-Simple-KVM/firmware/OVMF_VARS-1024x768.fd

/var/lib/libvirt/images/macosdisk.qcow2:              QEMU QCOW2 Image (v3), 68719476736 bytes
/var/lib/libvirt/images/BaseSystem.img:               DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 1, 4187063 sectors, extended partition table (last)
/opt/macOS-Simple-KVM/firmware/OVMF_CODE.fd:          data
/opt/macOS-Simple-KVM/firmware/OVMF_VARS-1024x768.fd: data
  • Once every thing is ready create the VM in Virt-manager with virsh define --file template-custom.xml

Thanks for this project @foxlet

from macos-simple-kvm.

mikekenyon99 avatar mikekenyon99 commented on May 18, 2024 1

doh! sorry.

Mike

from macos-simple-kvm.

aspicer avatar aspicer commented on May 18, 2024

Yes this was a little bit of a pain.

You need to make sure the file is accessible to your qemu user (might have a different name based on your setup) from the root of your filesystem.

Lots of ways to do this - easiest is to move it out of your home directory to something higher up and set permissions.

from macos-simple-kvm.

badmark avatar badmark commented on May 18, 2024

What permissions do I give it? I chmod 755/777 and chown'd to myself but still get this error.

from macos-simple-kvm.

jessechahal avatar jessechahal commented on May 18, 2024

@badmark ever git this resolved? Can you post what solution you used?
I have heard of one possible solution of adding your own user to a virtmanager group of some sort although I'm still investigating. It wasn't a solution to this specific problem but supposedly helped reduce permission issues

from macos-simple-kvm.

GiorgioGhisotti avatar GiorgioGhisotti commented on May 18, 2024

@jessechahal I had the same problem and solved it by copying the folder over to /var/lib/libvirt/images like @adrianlshaw suggested.

It may have something to do with ownership but simply changing ownership to root just gave me permission problems for other files. Copying it to the images folder is the easiest solution as far as I can tell.

from macos-simple-kvm.

badmark avatar badmark commented on May 18, 2024

The entire folder? I moved the image then got firmware errors.

from macos-simple-kvm.

GiorgioGhisotti avatar GiorgioGhisotti commented on May 18, 2024

Yes, the entire folder. Also you need to checkout the correct firmware, there's another issue that describes that #15

from macos-simple-kvm.

mikekenyon99 avatar mikekenyon99 commented on May 18, 2024

I'm getting the error:

cannot open '/opt/macOS-Simple-KVM/firmware/OVMF_CODE.fd'
cannot open 'cannot open `/opt/macOS-Simple-KVM/firmware/OVMF_VARS-1024x768.fd' 

when I use the sudo -u command as described in your last post?? Permissions are:
Screenshot from 2020-03-05 22-18-06

from macos-simple-kvm.

PierrickV avatar PierrickV commented on May 18, 2024

@mikekenyon99
In the first command sudo -u : you are looking at a file in /opt/ but in the second one ls -lt you are in /home/.

I don't think that libvirt-qemu is allowed to access /home/, that's why I recommend you to use /opt/.

Try:

mv ~/Documents/Linux/MacOS-Simple-KVM-master/ /opt/macOS-Simple-KVM

Then verify again with:

sudo -u libvirt-qemu file /var/lib/libvirt/images/macosdisk.qcow2 \
 /var/lib/libvirt/images/BaseSystem.img \
 /opt/macOS-Simple-KVM/firmware/OVMF_CODE.fd  \
/opt/macOS-Simple-KVM/firmware/OVMF_VARS-1024x768.fd

from macos-simple-kvm.

gtomadness avatar gtomadness commented on May 18, 2024

Hey guys I have figured it out, whether it is security sound or not but what i did was add 65543 to ownership of my file path were it said it could not get past.
My file path was /run/media/marvin/macOS/macOS-kvm so it was denied after media so I did a chown 65543 marvin and then it worked again. Since i have it on an external drive i didnt want to put the file in my var/lib/libvirt/images path.

from macos-simple-kvm.

chaseadam avatar chaseadam commented on May 18, 2024

My file path was /run/media/marvin/macOS/macOS-kvm so it was denied after media so I did a chown 65543 marvin and then it worked again.

I ran into this error when attempting to use a mount managed by Gnome, which puts it under /run/media/<username>. On Fedora 33 this directory has an ACL mask on it which I believe is problematic. I moved the mount to /mnt via fstab file and it is working for me now. (I had previously set root ownership and SELinux contexts)

sudo semanage fcontext -a -t virt_image_t <directory>
sudo restorecon -Rv <directory>

from macos-simple-kvm.

cgvirus avatar cgvirus commented on May 18, 2024

I did this:

sudo adduser `id -un` libvirtd
sudo adduser `id -un` kvm
sudo adduser `id -un` libvirt-qemu
sudo adduser `id -un` libvirt-dnsmasq

Then in terminal (only once):
sudo virt-manager

now add storage:
MyDisk.qcow2

It will ask to fix permission. Say yes.

Now close virt-manager.
And start as user without sudo.

from macos-simple-kvm.

DoniiYT avatar DoniiYT commented on May 18, 2024

hi there! i have the same problem and i actually dont know how to fix it... i am a noob in Linux and maybe i made something wrong and its easy to fix, could pls someone help me?

Discord DONIIyt #6941

from macos-simple-kvm.

hockeymikey avatar hockeymikey commented on May 18, 2024

I fixed this by running virt manager as root too, then importing the disk in question into a new VM where is offered to fixed the permisions, then I said yes and then I cancelled the new vm creation. Not sure what it modified, there is a "+" next to those directories in question but it's fixed.

from macos-simple-kvm.

Wotan6891 avatar Wotan6891 commented on May 18, 2024

hello. change the macOS-Simple-KVM folder to my personal folder. but I'm still having problems. now I have this error:
Error starting domain: operation failed: unable to find any master var store for loader: /root/macOS-Simple-KVM/firmware/OVMF_CODE.fd

from macos-simple-kvm.

Wotan6891 avatar Wotan6891 commented on May 18, 2024

already solved. change the paths of the files using xml in the virtual machine manager.

but now it runs and i see the macos installer again

from macos-simple-kvm.

kdevg0 avatar kdevg0 commented on May 18, 2024

already solved. change the paths of the files using xml in the virtual machine manager.

but now it runs and i see the macos installer again

Ah, thank you. Your post here solved my issue.

from macos-simple-kvm.

lepras avatar lepras commented on May 18, 2024

SE linux / App Armour issues.

move OVMF_CODE.fd to /var/lib/libvirt

and change in xml.

from macos-simple-kvm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.