Virt-manager: Difference between revisions
imported>Neubeki m Add networking section to clear up why virbr0 is not accessible after enabling virt-manager and libvirtd |
imported>Softmoth Provide instructions for getting the QEMU guest agent working under libvirt |
||
Line 64: | Line 64: | ||
By default this will enable the <code>virbr0</code> virtual network bridge. | By default this will enable the <code>virbr0</code> virtual network bridge. | ||
===Guest Agent=== | |||
When running NixOS as a guest, enable the [https://wiki.qemu.org/Features/GuestAgent QEMU guest agent] with: | |||
<syntaxhighlight lang="nix"> | |||
{ | |||
services.qemuGuest.enable = true; | |||
} | |||
</syntaxhighlight> | |||
The host must [https://wiki.libvirt.org/Qemu_guest_agent.html#setting-qemu-ga-up provide the needed virtio serial port] under the special name <code>org.qemu.guest_agent.0</code>. | |||
[[Category:Virtualization]] | [[Category:Virtualization]] |
Revision as of 14:28, 10 January 2024
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
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;
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" ];
}
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: virsh net-start default
.
By default this will enable the virbr0
virtual network bridge.
Guest Agent
When running NixOS as a guest, enable the QEMU guest agent with:
{
services.qemuGuest.enable = true;
}
The host must provide the needed virtio serial port under the special name org.qemu.guest_agent.0
.