Portal:MicroOS/Virtualization

Jump to: navigation, search

Virtualization options

  • On MicroOS Desktop, we recommend using the GNOME Boxes flatpak
  • On servers, libvirt with the qemu backend is a great option. It has an a daemon that can be used to save VM state across reboots
  • If access to host hardware is required, e.g. for GPU compute, consider libvirt with the lxc backend (PCI passthrough with qemu is also an option here that works with NVidia and Intel, but does not work well with AMD GPUs)

libvirt

Installation

Using pkcon or transactional-update, install the following packages:

sudo transactional-update pkg install libvirt libvirt-daemon-qemu qemu-tools virt-install

On a headless server, you can use virsh and virt-install to manage VMs. For a UI, consider installing the virt-manager package.

After installing, reboot into the new snapshot, and enable daemons:

sudo systemctl enable --now libvirtd

Define the default (masqueraded to host) network:

 sudo virsh net-define /etc/libvirt/qemu/networks/default.xml
 sudo virsh net-autostart default
 sudo virsh net-start default

For more options, see the libvirt wiki.

Optionally, to have machines state automatically saved and restored across reboots:

sudo systemctl enable --now libvirt-guests

LXC

Install `libvirt-daemon-lxc`. See libvirt wiki on LXC for details. Note that this can coexist with the qemu backend; you just need to specify the connection URL when using virsh, e.g. virsh -c lxc:///system list --all.

Known Issues

A workaround is to use static DNS configuration in the default network:

Run `virsh net-edit default`, which pops into editing the xml:

<network>
...
  <dns>
    <forwarder addr='9.9.9.9'/>
    <forwarder addr='149.112.112.112'/>
  </dns>
...
</network>

these are the quad9 public resolvers, sub whatever you want. The generated dnsmasq.conf won't use resolv.conf, avoiding the SELinux permission issue.