Managing Virtual Machines on Desktop Linux

Many Linux users don't know that there's an easy-to-use native virtualization app on their systems: virt-manager. It wraps the underlying emulation components (e.g. qemu, libvirt, kvm) into a simple GUI.

In this post I'll detail its use with Ubuntu & Windows VMs (with clipboard & file sharing), and note how to use qemu directly to virtualize macOS.


NOTE: Specific commands in this post are tailored for Ubuntu, but should be generally adaptable/applicable to all Linux desktops.

Execute the following in a terminal to install it:

sudo apt-get install virt-manager virt-viewer
sudo usermod -a -G kvm libvirt-qemu YOURUSERNAME

(subtituting your username for YOURUSERNAME)

Then launch the "Virtual Machine Manager" from your Applications menu.

Creating VMs


Xubuntu makes for a great lightweight Linux VM. No special instructions are needed to create a VM with it; virt-manager should automatically detect the correct settings from the installation ISO and features like clipboard sharing will work out of the box.

File Sharing

This example will show sharing your user's ~/Public directory, with a writable vm subdirectory in it:

  • Shutdown the VM
  • Create the directory on your host system:
mkdir ~/Public/vm
chown :kvm ~/Public/kvm
chmod g+w ~/Public/kvm/
  • Edit the VM settings (double-click on it from virt-manager to "Open" it, and then click the "i" button to show hardware settings) and add a filesystem virtual hardware device:
    • Driver: default
    • Mode: Squash
    • Source Path: /home/YOURUSERNAME/Public
    • Target Path: /hostpublic

Add filesystem hardware device in virt-manager

  • Start the VM and login
  • Open a terminal and execute sudo mount -t 9p -o trans=virtio,version=9p2000.L /hostpublic Public


Basic VM operation will work without any special setup, but better performance & features can be enabled as follows:


There's a pretty good overview of installing Windows 10 using paravirtualized drivers at this blog. Follow its general instructions to:

  • Customize the VM virtual hardware before initial launch and:
    • Add a new virtual storage device (CDROM) with the virtio iso
    • Change the NIC device model to virtio
    • Remove the SATA virtual disk and replace it with a VirtIO bus-type storage device
      • On older virt-manager releases, instead change the virtual disk (advanced options) disk bus to virtio
    • Ensure a "Channel" virtual hardware device named "com.redhat.spice.0" (default device type "Spice agent (spicevmc)" is present (used for clipboard sharing)
      • Current virt-manager releases include this by default
  • Start installation. When no disk devices are detected, load drivers from the virtio iso & import:
    • viostor/w10/amd64
    • NetKVM/w10/amd64
  • After installation, install the spice guest tools (located under "Windows binaries")

File Sharing

Perform the following steps to share files between the host & VM:

One Time Setup
  • Install the Spice WebDAV daemon (under "Windows Binaries")
  • Shutdown the VM
  • Add a "Channel" virtual hardware device named "org.spice-space.webdav.0" (default device type "Spice port (spiceport)"
Sharing the Folder
  • Start the VM
  • Use virt-viewer (Alt-F2 virt-viewer) to connect to it
    • The built-in viewer in virt-manager doesn't have the necessary file sharing support
  • In virt-viewer File->Preferences, choose a folder to share to the VM (e.g. ~/Public)
  • In (admin cmd.exe) run net start spice-webdavd then "C:\Program Files\SPICE webdavd\map-drive.bat"

The shared folder will now be available as mapped network drive.


The excellent OSX-KVM project makes it simple to fire up a (slow but usuable) macOS VM.

Follow the Installation Preparation steps to prepare the VM. To simplify networking setup, you can skip the network commands (e.g. sudo ip tuntap add dev tap0 mode tap) in favor of user mode networking by changing:

         -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \


         -netdev user,id=net0 -device vmxnet3,netdev=net0,id=net0,mac=52:54:00:c9:18:27 \


Some other small changes/considerations:

  • Adding echo 1 | sudo tee -a /sys/module/kvm/parameters/ignore_msrs to the script will ensure the setting is always enabled for the VM.
  • Appending ,vmx,rdtscp to MY_OPTIONS in the script will enable nested virtual machine (e.g. Docker) use (you may want to increase RAM allocation as well, e.g. sed -i 's/ -m 3072 / -m 8192 /g'

Category Navigation: