How to Use Virt-Manager on Linux Mint/Ubuntu: A Step-by-Step Guide

TLDR

This article guides you through the installation and usage of Virt-Manager on Linux Mint or Ubuntu, providing an easy way to manage virtual machines (VMs).

Context

Virt-Manager is a graphical tool for managing virtual machines via libvirt. It's user-friendly and supports KVM/QEMU and Xen virtualization.

Why Virt-Manager?

  • Graphical Interface: Easy for beginners.
  • Wide Support: Works with KVM, QEMU, and Xen.
  • Linux Compatibility: Ideal for Linux Mint and Ubuntu users.

Steps

1. Installing Virt-Manager

  1. Open Terminal: You can press Ctrl + Alt + T or search for terminal in the start menu.
  2. Update Repositories:
sudo apt update
  1. Install Virt-Manager:
sudo apt install virt-manager

2. Adding Your User to Relevant Groups

  1. Add Your User to the libvirt Group:
sudo usermod -aG libvirt $USER
  1. Add Your User to the kvm Group:
sudo usermod -aG kvm $USER
  1. Reload Groups:
newgrp libvirt 
newgrp kvm

3. Using Virt-Manager

  1. Open Virt-Manager: You can search for virt-manager in the start menu or run the following command in the terminal:
virt-manager
  1. Create a New Virtual Machine: Click on the Create a new virtual machine button.
  2. Select Installation Method: Choose Local install media (ISO image or CDROM).
  3. Select ISO Image: Click on the Browse button and select the ISO image you want to use. You can downlaod Ubuntu server from here: Ubuntu Server.
  4. Follow the Wizard: Choose the installation method and configure your VM.

4. Managing Virtual Machines

  • Start/Stop VMs: Right-click on the VM and select Start or Shut Down.
  • Access VM Console: Double-click the VM.
  • Edit VM Settings: Right-click and choose Open.

Troubleshooting

1. Unable to Connect to libvirt qemu:///system Error on Linux Mint/Ubuntu

Steps to solve

1. Ensure libvirt Service is Active
  1. Check Status:
sudo systemctl status libvirtd
  1. Start Service:
sudo systemctl start libvirtd
  1. Verify user group permissions:
# check groups for user
groups $(whoami)
# add required groups if missing
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER
# reload groups or log out and log in again
newgrp libvirt 
newgrp kvm
2. Check libvirt Configuration
  1. Open libvirt Configuration File:
sudo nano /etc/libvirt/libvirtd.conf
  1. Enable TCP Connections: Uncomment listen_tcp = 1.
  2. Restart libvirtd Service:
sudo systemctl restart libvirtd

Note: Sometimes just rebooting the service also works.

Reboot the System

Sometimes, even in linux, rebooting the system can solve the problem.

References

Comments

Comments powered by Disqus