With RHEL 6 virtualization, I ran into a problem with virt-manager, in that it refused access from a non-root account. If I logged in as myself, the app would start, but not allow connections, complaining:
Unable to open a connection to the libvirt management daemon.Further digging (clicking "Details") shows a couple Permission denied messages. Using sudo doesn't help, switching to root doesn't help, but SSH'ing in as root works. So, what's the fix?
Verify that:
- The 'libvirtd' daemon has been started
Turns out there is security group that allows the identification of trusted users. Edit the /etc/libvirt/libvirtd.conf file and uncomment three lines:
unix_sock_group = "libvirt"The third line bypasses the "polkit" security mechanism... since it doesn't work, anyway.
unix_sock_rw_perms = "0770"
auth_unix_rw = "none"
The natural reaction would now be to issue a service libvirtd reload command, but not so fast... that won't work. (But feel free to try it if you like-- I'll wait.)
List the /var/run/libvirt dir. You should see a libvirt-sock file owned by root.root with permissions of 700. Use service libvirtd stop, and file will disappear. Issue service libvirtd start and it should fail to start, claiming it can not load the configuration file, which is not true. The problem is that we told it to allow access to members of group "libvirt", which does not exist. Create it, add yourself:
groupadd -g 170 libvirt; usermod -a -G libvirt dougLogoff, login, and verify with the id command.
Issue the start command again, and the service should start. List the /var/run/libvirt dir. This time, the file is owned by root.libvirt with permissions of 770. We can now access and control the server as a non-root user.
Thanks for solution. It really helps.
ReplyDeleteThanks!
ReplyDeleteThanks for the great explanation.
ReplyDeleteWhy did you add libvirt to group id 170?
ReplyDeleteBeats me: Either that group was significant two years ago, or I got dyslexic and it should be group 107 (qemu).
DeleteFor me, it works for virt-manager, but not for virsh, i.e. virsh list.
ReplyDeleteWhat am I missing?