"unable to connect to libvirt" in Virtual Machine Manager

17,464

Solution 1

First, make sure your hardware supports virtualization:

egrep '(vmx|svm)' /proc/cpuinfo

If this doesn't spit out some data, your hardware doesn't support virtualization, and you can't use KVM. (Note: hardware virtualization must also be enabled in BIOS/UEFI for the machine. It typically is not already enabled by default. You need to check for it.)

sudo apt-get update && sudo apt-get install kvm libvirt-bin virtinst bridge-utils

This gets you the requisite packages.

sudo adduser `id -un` libvirtd

This puts you in the requisite group to play with virtualization. Note: if you are running in a GUI, and expect to run virt-manager, you will have to log out and back in again in order to make this take effect!

sudo virsh -c qemu:///system list

This should get you a (currently empty) list of VMs on the system:

 Id Name                 State
----------------------------------

You are now ready to use virt-manager to manage VMs from the GUI, or virsh to manage them from the command-line. If you need help using virsh to create and manage guests, please ask that as a separate question - it gets pretty chewy. :)

If you want to use virt-manager running on a remote workstation, be aware that you will need working SSH access to the server from that workstation. As long as you have that, and as long as the user you're SSHing in as has been added to the libvirt-bin group as shown above, it will 'just work' from there - you'll set up the connection in virt-manager on the remote machine as "type SSH" and specify username and ip address from there, and it will prompt you for a password on connection (unless you've set up passwordless public-key auth, in which case it'll use that).

Solution 2

I have run into the same issue.

To get past it, open up the terminal and enter:

sudo virt-manager

Then enter your password and the GUI should open right up.

I hope this helps!

Share:
17,464

Related videos on Youtube

urtihu
Author by

urtihu

Updated on September 18, 2022

Comments

  • urtihu
    urtihu over 1 year

    Is there a manual available that covers the proper setup of a Virtual Machine Server with no GUI with an Ubuntu workstation with a GUI and Virtual Machine Manager installed? Both are 12.04 version.

    I get the following error message:

    unable to connect to libvirt
    Verify that
    -The libvirt-bin package is installed
    -The libvirt daemon has been started
    -you are a member of the libvirtd group
    
    the package is installed
    for some reason starting the daemon seems to crash
    
    libvirtd start
    info:  libvirt version 0.9.8
    error: virExecWithHook:328 : cannot find 'pm-is-supported' in path: No such file or directory
    also
    qemucapsInit:856: Failed to get host power management capabilities
    

    So I guess I did not set the server up correctly. All manuals I found do not mention "Virtual Machine Manager". I only chose the packages to connect with SSH remotely and the "Virtual Machine Server" for the server installation.

    So I would like to find a manual that covers this combo or then covered only GUI machines that have both on the same machine, which will not really help with system performance as a hypervisor.

    • qbi
      qbi over 11 years
      This might be a problem with AppArmor. Please have a look into /var/log/kern.log. Do you find DENIED entries mentioning libvirt-bin?