KVM permission issues during chapter 2 of Michael Jang's RHCSA/RHCE book
Linux - CertificationThis forum is for the discussion of all topics relating to Linux certification.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
KVM permission issues during chapter 2 of Michael Jang's RHCSA/RHCE book
This is my first post so please bare with me. But I am currently studying for the RHCSA (which is why I chose to post this in this sub-forum). Also I was told by the author he helps on here. Anyhow. Chapter two of his book he deletes the /var/lib/libvirt/images and replaces it with a link to /home/(myusername)/KVM. But during the creation of my VM it says permission denied for the server1.example.com.img I have gone through and made sure I gave rwx permissions to all users with chmod 777 and looked over permissions everywhere I can think of. Any ideas or suggestions would be greatly helpful. I will post some information to hopefully help here.
[root@localhost ~]# ls -l /var/lib/libvirt/images
lrwxrwxrwx. 1 root root 16 Aug 17 12:20 /var/lib/libvirt/images -> /home/smitty/KVM
[root@localhost ~]# ls -l /var/lib/libvirt/images/server1.example.com.img
-rwxrwxrwx. 1 root root 12884901888 Aug 17 13:13 /var/lib/libvirt/images/server1.example.com.img
This is my first post so please bare with me. But I am currently studying for the RHCSA (which is why I chose to post this in this sub-forum). Also I was told by the author he helps on here. Anyhow. Chapter two of his book he deletes the /var/lib/libvirt/images and replaces it with a link to /home/(myusername)/KVM. But during the creation of my VM it says permission denied for the server1.example.com.img I have gone through and made sure I gave rwx permissions to all users with chmod 777 and looked over permissions everywhere I can think of. Any ideas or suggestions would be greatly helpful. I will post some information to hopefully help here.
[root@localhost ~]# ls -l /var/lib/libvirt/images
lrwxrwxrwx. 1 root root 16 Aug 17 12:20 /var/lib/libvirt/images -> /home/smitty/KVM
[root@localhost ~]# ls -l /var/lib/libvirt/images/server1.example.com.img
-rwxrwxrwx. 1 root root 12884901888 Aug 17 13:13 /var/lib/libvirt/images/server1.example.com.img
SELinux is the problem. What is the Context of /home/smitty/KVM?
Code:
ls -lZ /home/smitty/KVM
NOTE: I think Jang just suggested that you move it...you don't have to (unless you have a space problem)
[root@localhost ~]# ls -lZ /home/smitty/KVM/
-rwxrwxrwx. root root system_ubject_r:virt_image_t:s0 server1.example.com.img
You are correct it was a suggestion, but my home directory had 100Gb so thought it was a good idea since that was my largest partition. Thank you for the help BTW.
[root@localhost ~]# ls -lZ /home/smitty/KVM/
-rwxrwxrwx. root root system_ubject_r:virt_image_t:s0 server1.example.com.img
You are correct it was a suggestion, but my home directory had 100Gb so thought it was a good idea since that was my largest partition. Thank you for the help BTW.
Those contexts look right (off the top of my head)...
Try this..
Code:
restorecon -F -R /home/smitty/KVM
ls -lZ /home/smitty/KVM/
---------- Post added 08-17-12 at 07:12 PM ----------
Here is the error I get from the KVM during the creation.
Unable to complete install: 'internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu-kvm: -drive file=/var/lib/libvirt/images/server1.example.com.img,if=none,id=drive-virtio-disk0,format=raw,cache=none: could not open disk image /var/lib/libvirt/images/server1.example.com.img: Permission denied
---------- Post added 08-17-12 at 07:12 PM ----------
Here is the error I get from the KVM during the creation.
Unable to complete install: 'internal error Process exited while reading console log output: char device redirected to /dev/pts/1
qemu-kvm: -drive file=/var/lib/libvirt/images/server1.example.com.img,if=none,id=drive-virtio-disk0,format=raw,cache=none: could not open disk image /var/lib/libvirt/images/server1.example.com.img: Permission denied
Okay now try setting the context...
Code:
cd /home/smitty
semanage fcontext -a -t virt_image_t KVM
restorecon -R -v KVM
If there is anything inside of /home/smitty/KVM you have to do the same commands on those files/directories as well.
Try installing "setroubleshoot-server" package, restart auditd and rsyslog services and watch /var/log/messages for SE Linux errors/violations. It should list errors in more readable form.
Other option is creating LVM based guests. You create LV ... say 10 gigs and call it lv_server1 (or whatever you want) and install guest on it (format: raw, cache: none). It should give you better performance then image based guest. Also, Virt-manager can manage your Volume Group as a storage pool (you must add it first) so you can create LVs for guests directly from Virt-manager.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.