Virt-manager: Difference between revisions

From NixOS Wiki
→‎Networking: Comment about documentation issue
 
(One intermediate revision by one other user not shown)
Line 27: Line 27:
=== Networking ===
=== Networking ===
The default network starts off as being inactive, you must enable it before it is accessible.
The default network starts off as being inactive, you must enable it before it is accessible.
This can be done by running the following command:  
This can be done by running the following command (may require sudo):  


<code>virsh net-start default</code>
<code>virsh net-start default</code>
Line 36: Line 36:


By default this will enable the <code>virbr0</code> virtual network bridge.
By default this will enable the <code>virbr0</code> virtual network bridge.
Sorry - this seems out of date. 2024 July 10<syntaxhighlight lang="bash">
[das@t14:~/nixos/t14]$ virsh net-autostart default
error: failed to get network 'default'
error: Network not found: no network with matching name 'default'
</syntaxhighlight>


===Display===
===Display===
Line 55: Line 49:
{
{
   services.qemuGuest.enable = true;
   services.qemuGuest.enable = true;
  services.spice-vdagentd.enable = true;  # enable copy and paste between host and guest
}
}
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 14:44, 10 November 2024

The virt-manager application is a GUI for managing local and remote virtual machines through libvirt. It primarily targets KVM VMs, but also manages Xen and LXC (linux containers).

Requisites

Even though Virt-manager (using the KVM hypervisor) is able to take advantage of virtualisation capabilities without any UEFI/BIOS configuration, best performances demand that host have Vt-x and Vt-d (Intel) or AMD-V and AMD-Vi (AMD) enabled. These settings can usually be found under the UEFI/BIOS settings.

Installation

NixOS

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

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" ];
}

Networking

The default network starts off as being inactive, you must enable it before it is accessible. This can be done by running the following command (may require sudo):

virsh net-start default

Or autostart:

virsh net-autostart default

By default this will enable the virbr0 virtual network bridge.

Display

The default Video may not allow different resolutions, `Virtio` will allow for more.

Windows Guest

See Virtio-win guest tools for additional drivers for both paravirtual and emulated hardware

Guest Agent

When running NixOS as a guest, enable the QEMU guest agent with:

{
  services.qemuGuest.enable = true;
  services.spice-vdagentd.enable = true;  # enable copy and paste between host and guest
}

The host must provide the needed virtio serial port under the special name org.qemu.guest_agent.0.

Wayland

In order to run on Wayland, virt-manager must be ran under XWayland with `$ GDK_BACKEND=x11 virt-manager` or a gdk cursor must be set. An example of setting a gdk cursor with home-manager is as follows:

 home.pointerCursor = {
    gtk.enable = true;
    package = pkgs.vanilla-dmz;
    name = "Vanilla-DMZ";
 };