Virt-manager: Difference between revisions

From NixOS Wiki
imported>The-furry-hubofeverything
Module upstreamed and available for unstable
imported>Skylark
m Typo 'decoratively'
Line 17: Line 17:




You will get a warning when you open it for the first time
You will get a warning when you open it for the first time:


<code>Could not detect a default hypervisor. Make sure the appropriate QEMU/KVM virtualization packages are installed to manage virtualization on this host.
<code>Could not detect a default hypervisor. Make sure the appropriate QEMU/KVM virtualization packages are installed to manage virtualization on this host.
Line 23: Line 23:
A virtualization connection can be manually added via File->Add Connection</code>
A virtualization connection can be manually added via File->Add Connection</code>


To resolve
To resolve:


<pre>
<pre>
Line 34: Line 34:
</pre>
</pre>


The same can also be achieved decoratively by setting the corresponding dconf settings with home-manager. If you want to do this instead of the imperative configuration described above, add the following snippet to your home-manager configuration:
The same can also be achieved declaratively by setting the corresponding dconf settings with home-manager. If you want to do this instead of the imperative configuration described above, add the following snippet to your home-manager configuration:
<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
dconf.settings = {
dconf.settings = {
Line 42: Line 42:
   };
   };
};
};
</syntaxhighlight>
</syntaxhighlight>


You can get the following error :  
You may get the following error:


<code>authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'</code>
<code>authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'</code>


To resolve, add the user to the <code>libvirtd</code> group.
To resolve, add the user to the <code>libvirtd</code> group:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">

Revision as of 14:48, 26 October 2023

Installation

NixOS

Before 23.11:

virtualisation.libvirtd.enable = true;
programs.dconf.enable = true; # virt-manager requires dconf to remember settings
environment.systemPackages = with pkgs; [ virt-manager ];

After 23.11:

virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;

See relevant merge request


You will get a warning when you open it for the first time:

Could not detect a default hypervisor. Make sure the appropriate QEMU/KVM virtualization packages are installed to manage virtualization on this host.

A virtualization connection can be manually added via File->Add Connection

To resolve:

File (in the menu bar) -> Add connection

HyperVisor = QEMU/KVM
Autoconnect = checkmark

Connect

The same can also be achieved declaratively by setting the corresponding dconf settings with home-manager. If you want to do this instead of the imperative configuration described above, add the following snippet to your home-manager configuration:

dconf.settings = {
  "org/virt-manager/virt-manager/connections" = {
    autoconnect = ["qemu:///system"];
    uris = ["qemu:///system"];
  };
};

You may get the following error:

authentication unavailable: no polkit agent available to authenticate action 'org.libvirt.unix.manage'

To resolve, add the user to the libvirtd group:

{
  users.users.<myuser>.extraGroups = [ "libvirtd" ];
}