libvirt qemu cannot access image inside my home directory, even as root?












1















I have problem getting my VM running via libvirt. Here is my setup:




  • I put my qcow2 image and domain XML (named win7.xml) under $HOME/vm,
    with all files and directories using my user, my group, and permission bits 0644.


  • I uncommented user = "root", group = "root" and dynamic_ownership = 1
    lines in /etc/libvirt/qemu.conf, expecting qemu-system-x86_64 will run
    as root, therefore having full access to the dirs and files under $HOME/vm.



However, invocation of virsh create win7.xml as root was failed:



error: Failed to create domain from win7.xml
error: internal error: early end of file from monitor, possible problem: 2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied


The following error was logged in /var/log/libvirt/qemu/win7.log:



2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied
2016-10-01 03:36:02.080+0000: shutting down


It looks like qemu failed to access my VM disk file. But why? Didn't qemu-system-x86_64
run as root? What should be done to make sure libvirt-qemu able to access the disk image
residing in $HOME directory?



Additional version informations:




  • libvirt, virsh version: 1.3.3.2

  • QEMU version: QEMU emulator version 2.6.1 (qemu-2.6.1-1.fc24)

  • distro: Fedora 24

  • kernel: 4.7.4-200.fc24.x86_64










share|improve this question
















bumped to the homepage by Community 13 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    1















    I have problem getting my VM running via libvirt. Here is my setup:




    • I put my qcow2 image and domain XML (named win7.xml) under $HOME/vm,
      with all files and directories using my user, my group, and permission bits 0644.


    • I uncommented user = "root", group = "root" and dynamic_ownership = 1
      lines in /etc/libvirt/qemu.conf, expecting qemu-system-x86_64 will run
      as root, therefore having full access to the dirs and files under $HOME/vm.



    However, invocation of virsh create win7.xml as root was failed:



    error: Failed to create domain from win7.xml
    error: internal error: early end of file from monitor, possible problem: 2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied


    The following error was logged in /var/log/libvirt/qemu/win7.log:



    2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied
    2016-10-01 03:36:02.080+0000: shutting down


    It looks like qemu failed to access my VM disk file. But why? Didn't qemu-system-x86_64
    run as root? What should be done to make sure libvirt-qemu able to access the disk image
    residing in $HOME directory?



    Additional version informations:




    • libvirt, virsh version: 1.3.3.2

    • QEMU version: QEMU emulator version 2.6.1 (qemu-2.6.1-1.fc24)

    • distro: Fedora 24

    • kernel: 4.7.4-200.fc24.x86_64










    share|improve this question
















    bumped to the homepage by Community 13 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      1












      1








      1








      I have problem getting my VM running via libvirt. Here is my setup:




      • I put my qcow2 image and domain XML (named win7.xml) under $HOME/vm,
        with all files and directories using my user, my group, and permission bits 0644.


      • I uncommented user = "root", group = "root" and dynamic_ownership = 1
        lines in /etc/libvirt/qemu.conf, expecting qemu-system-x86_64 will run
        as root, therefore having full access to the dirs and files under $HOME/vm.



      However, invocation of virsh create win7.xml as root was failed:



      error: Failed to create domain from win7.xml
      error: internal error: early end of file from monitor, possible problem: 2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied


      The following error was logged in /var/log/libvirt/qemu/win7.log:



      2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied
      2016-10-01 03:36:02.080+0000: shutting down


      It looks like qemu failed to access my VM disk file. But why? Didn't qemu-system-x86_64
      run as root? What should be done to make sure libvirt-qemu able to access the disk image
      residing in $HOME directory?



      Additional version informations:




      • libvirt, virsh version: 1.3.3.2

      • QEMU version: QEMU emulator version 2.6.1 (qemu-2.6.1-1.fc24)

      • distro: Fedora 24

      • kernel: 4.7.4-200.fc24.x86_64










      share|improve this question
















      I have problem getting my VM running via libvirt. Here is my setup:




      • I put my qcow2 image and domain XML (named win7.xml) under $HOME/vm,
        with all files and directories using my user, my group, and permission bits 0644.


      • I uncommented user = "root", group = "root" and dynamic_ownership = 1
        lines in /etc/libvirt/qemu.conf, expecting qemu-system-x86_64 will run
        as root, therefore having full access to the dirs and files under $HOME/vm.



      However, invocation of virsh create win7.xml as root was failed:



      error: Failed to create domain from win7.xml
      error: internal error: early end of file from monitor, possible problem: 2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied


      The following error was logged in /var/log/libvirt/qemu/win7.log:



      2016-10-01T03:36:02.049418Z qemu-system-x86_64: -drive file=/home/naitree/vm/win7/win7.qcow2,format=qcow2,if=none,id=drive-virtio-disk0: Could not open '/home/naitree/vm/win7/win7.qcow2': Permission denied
      2016-10-01 03:36:02.080+0000: shutting down


      It looks like qemu failed to access my VM disk file. But why? Didn't qemu-system-x86_64
      run as root? What should be done to make sure libvirt-qemu able to access the disk image
      residing in $HOME directory?



      Additional version informations:




      • libvirt, virsh version: 1.3.3.2

      • QEMU version: QEMU emulator version 2.6.1 (qemu-2.6.1-1.fc24)

      • distro: Fedora 24

      • kernel: 4.7.4-200.fc24.x86_64







      kvm qemu libvirtd






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 2 '16 at 6:15







      Naitree

















      asked Oct 1 '16 at 3:44









      NaitreeNaitree

      3171212




      3171212





      bumped to the homepage by Community 13 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 13 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You are most likely being blocked by Selinux, check your /var/log/audit.log






          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "106"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f313568%2flibvirt-qemu-cannot-access-image-inside-my-home-directory-even-as-root%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You are most likely being blocked by Selinux, check your /var/log/audit.log






            share|improve this answer




























              0














              You are most likely being blocked by Selinux, check your /var/log/audit.log






              share|improve this answer


























                0












                0








                0







                You are most likely being blocked by Selinux, check your /var/log/audit.log






                share|improve this answer













                You are most likely being blocked by Selinux, check your /var/log/audit.log







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 23 '17 at 7:45









                Aaron WalersteinAaron Walerstein

                1615




                1615






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f313568%2flibvirt-qemu-cannot-access-image-inside-my-home-directory-even-as-root%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Loup dans la culture

                    How to solve the problem of ntp “Unable to contact time server” from KDE?

                    ASUS Zenbook UX433/UX333 — Configure Touchpad-embedded numpad on Linux